mirror of
https://github.com/ninjamuffin99/Funkin.git
synced 2025-02-02 09:51:12 +00:00
easier storymode menu adding onto
This commit is contained in:
parent
be95f5a298
commit
eeda572c3e
|
@ -1,41 +1,49 @@
|
|||
package;
|
||||
|
||||
import flixel.FlxG;
|
||||
import flixel.FlxSprite;
|
||||
import flixel.graphics.frames.FlxAtlasFrames;
|
||||
import flixel.group.FlxSpriteGroup;
|
||||
import flixel.math.FlxMath;
|
||||
import flixel.util.FlxColor;
|
||||
|
||||
class MenuItem extends FlxSpriteGroup
|
||||
{
|
||||
public var targetY:Float = 0;
|
||||
public var week:FlxSprite;
|
||||
public var flashingInt:Int = 0;
|
||||
|
||||
public function new(x:Float, y:Float, weekNum:Int = 0)
|
||||
{
|
||||
super(x, y);
|
||||
|
||||
var tex = Paths.getSparrowAtlas('campaign_menu_UI_assets');
|
||||
|
||||
week = new FlxSprite();
|
||||
week.frames = tex;
|
||||
// TUTORIAL IS WEEK 0
|
||||
week.animation.addByPrefix('week0', 'tutorial selected', 24);
|
||||
week.animation.addByPrefix('week1', "WEEK1 select", 24);
|
||||
week.animation.addByPrefix('week2', "week2 select", 24);
|
||||
week.animation.addByPrefix('week3', "Week 3 press", 24);
|
||||
week.animation.addByPrefix('week4', "Week 4 press", 24);
|
||||
week.animation.addByPrefix('week5', "week 5", 24);
|
||||
week.animation.addByPrefix('week6', "Week 6", 24);
|
||||
week = new FlxSprite().loadGraphic(Paths.image('storymenu/week' + weekNum));
|
||||
add(week);
|
||||
|
||||
week.animation.play('week' + weekNum);
|
||||
week.animation.pause();
|
||||
week.updateHitbox();
|
||||
}
|
||||
|
||||
private var isFlashing:Bool = false;
|
||||
|
||||
public function startFlashing():Void
|
||||
{
|
||||
isFlashing = true;
|
||||
}
|
||||
|
||||
// if it runs at 60fps, fake framerate will be 6
|
||||
// if it runs at 144 fps, fake framerate will be like 14, and will update the graphic every 0.016666 * 3 seconds still???
|
||||
// so it runs basically every so many seconds, not dependant on framerate??
|
||||
// I'm still learning how math works thanks whoever is reading this lol
|
||||
var fakeFramerate:Int = Math.round((1 / FlxG.elapsed) / 10);
|
||||
|
||||
override function update(elapsed:Float)
|
||||
{
|
||||
super.update(elapsed);
|
||||
y = FlxMath.lerp(y, (targetY * 120) + 480, 0.17);
|
||||
|
||||
if (isFlashing)
|
||||
flashingInt += 1;
|
||||
|
||||
if (flashingInt % fakeFramerate >= Math.floor(fakeFramerate / 2))
|
||||
week.color = 0xFF33ffff;
|
||||
else
|
||||
week.color = FlxColor.WHITE;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -291,7 +291,7 @@ class StoryMenuState extends MusicBeatState
|
|||
{
|
||||
FlxG.sound.play(Paths.sound('confirmMenu'));
|
||||
|
||||
grpWeekText.members[curWeek].week.animation.resume();
|
||||
grpWeekText.members[curWeek].startFlashing();
|
||||
grpWeekCharacters.members[1].animation.play('bfConfirm');
|
||||
stopspamming = true;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue