mirror of
https://github.com/FunkinCrew/Funkin.git
synced 2025-02-17 04:11:23 -05:00
freeplay stuff in progress teehee
This commit is contained in:
parent
ec959f5d83
commit
2dd270f83e
2 changed files with 56 additions and 0 deletions
|
@ -14,6 +14,7 @@ import flixel.math.FlxPoint;
|
|||
import flixel.text.FlxText;
|
||||
import flixel.tweens.FlxTween;
|
||||
import flixel.util.FlxColor;
|
||||
import freeplayStuff.DJBoyfriend;
|
||||
import lime.app.Future;
|
||||
import lime.utils.Assets;
|
||||
|
||||
|
@ -155,6 +156,9 @@ class FreeplayState extends MusicBeatState
|
|||
changeSelection();
|
||||
changeDiff();
|
||||
|
||||
var dj:DJBoyfriend = new DJBoyfriend(0, -100);
|
||||
add(dj);
|
||||
|
||||
// FlxG.sound.playMusic(Paths.music('title'), 0);
|
||||
// FlxG.sound.music.fadeIn(2, 0, 0.8);
|
||||
// selector = new FlxText();
|
||||
|
|
52
source/freeplayStuff/DJBoyfriend.hx
Normal file
52
source/freeplayStuff/DJBoyfriend.hx
Normal file
|
@ -0,0 +1,52 @@
|
|||
package freeplayStuff;
|
||||
|
||||
import flixel.FlxSprite;
|
||||
|
||||
class DJBoyfriend extends FlxSprite
|
||||
{
|
||||
public function new(x:Float, y:Float)
|
||||
{
|
||||
super(x, y);
|
||||
|
||||
animOffsets = new Map<String, Array<Dynamic>>();
|
||||
|
||||
frames = Paths.getSparrowAtlas('freeplay/bfFreeplay');
|
||||
animation.addByPrefix('intro', "boyfriend dj intro", 24, false);
|
||||
animation.addByPrefix('idle', "Boyfriend DJ0", 24);
|
||||
animation.addByPrefix('confirm', "Boyfriend DJ confirm", 24);
|
||||
|
||||
addOffset('intro', 0, 0);
|
||||
addOffset('idle', -4, -426);
|
||||
|
||||
playAnim('intro');
|
||||
animation.finishCallback = function(anim)
|
||||
{
|
||||
switch (anim)
|
||||
{
|
||||
case "intro":
|
||||
playAnim('idle'); // plays idle anim after playing intro
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// playAnim stolen from Character.hx, cuz im lazy lol!
|
||||
public var animOffsets:Map<String, Array<Dynamic>>;
|
||||
|
||||
public function playAnim(AnimName:String, Force:Bool = false, Reversed:Bool = false, Frame:Int = 0):Void
|
||||
{
|
||||
animation.play(AnimName, Force, Reversed, Frame);
|
||||
|
||||
var daOffset = animOffsets.get(AnimName);
|
||||
if (animOffsets.exists(AnimName))
|
||||
{
|
||||
offset.set(daOffset[0], daOffset[1]);
|
||||
}
|
||||
else
|
||||
offset.set(0, 0);
|
||||
}
|
||||
|
||||
public function addOffset(name:String, x:Float = 0, y:Float = 0)
|
||||
{
|
||||
animOffsets[name] = [x, y];
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue