mirror of
https://github.com/ninjamuffin99/Funkin.git
synced 2024-11-09 00:04:42 +00:00
more freeplay stuff in progress
This commit is contained in:
parent
2dd270f83e
commit
b54c459539
|
@ -14,7 +14,9 @@ import flixel.math.FlxPoint;
|
||||||
import flixel.text.FlxText;
|
import flixel.text.FlxText;
|
||||||
import flixel.tweens.FlxTween;
|
import flixel.tweens.FlxTween;
|
||||||
import flixel.util.FlxColor;
|
import flixel.util.FlxColor;
|
||||||
|
import flixel.util.FlxTimer;
|
||||||
import freeplayStuff.DJBoyfriend;
|
import freeplayStuff.DJBoyfriend;
|
||||||
|
import freeplayStuff.SongMenuItem;
|
||||||
import lime.app.Future;
|
import lime.app.Future;
|
||||||
import lime.utils.Assets;
|
import lime.utils.Assets;
|
||||||
|
|
||||||
|
@ -45,10 +47,10 @@ class FreeplayState extends MusicBeatState
|
||||||
];
|
];
|
||||||
|
|
||||||
private var grpSongs:FlxTypedGroup<Alphabet>;
|
private var grpSongs:FlxTypedGroup<Alphabet>;
|
||||||
|
private var grpCapsules:FlxTypedGroup<SongMenuItem>;
|
||||||
private var curPlaying:Bool = false;
|
private var curPlaying:Bool = false;
|
||||||
|
|
||||||
private var iconArray:Array<HealthIcon> = [];
|
private var iconArray:Array<HealthIcon> = [];
|
||||||
var bg:FlxSprite;
|
|
||||||
var scoreBG:FlxSprite;
|
var scoreBG:FlxSprite;
|
||||||
|
|
||||||
override function create()
|
override function create()
|
||||||
|
@ -106,32 +108,44 @@ class FreeplayState extends MusicBeatState
|
||||||
|
|
||||||
// LOAD CHARACTERS
|
// LOAD CHARACTERS
|
||||||
|
|
||||||
bg = new FlxSprite().loadGraphic(Paths.image('menuDesat'));
|
|
||||||
bg.setGraphicSize(Std.int(FlxG.width));
|
|
||||||
bg.updateHitbox();
|
|
||||||
trace(FlxG.width);
|
trace(FlxG.width);
|
||||||
trace(FlxG.camera.zoom);
|
trace(FlxG.camera.zoom);
|
||||||
trace(FlxG.camera.initialZoom);
|
trace(FlxG.camera.initialZoom);
|
||||||
trace(FlxCamera.defaultZoom);
|
trace(FlxCamera.defaultZoom);
|
||||||
trace(FlxG.initialZoom);
|
trace(FlxG.initialZoom);
|
||||||
add(bg);
|
|
||||||
|
|
||||||
grpSongs = new FlxTypedGroup<Alphabet>();
|
grpSongs = new FlxTypedGroup<Alphabet>();
|
||||||
add(grpSongs);
|
add(grpSongs);
|
||||||
|
|
||||||
|
grpCapsules = new FlxTypedGroup<SongMenuItem>();
|
||||||
|
add(grpCapsules);
|
||||||
|
|
||||||
for (i in 0...songs.length)
|
for (i in 0...songs.length)
|
||||||
{
|
{
|
||||||
|
var funnyMenu:SongMenuItem = new SongMenuItem(FlxG.width, (i * 150) + 160, songs[i].songName);
|
||||||
|
funnyMenu.targetPos.x = funnyMenu.x;
|
||||||
|
funnyMenu.ID = i;
|
||||||
|
|
||||||
|
new FlxTimer().start((0.06 * i) + 0.8, function(lerpTmr)
|
||||||
|
{
|
||||||
|
funnyMenu.doLerp = true;
|
||||||
|
});
|
||||||
|
|
||||||
|
grpCapsules.add(funnyMenu);
|
||||||
|
|
||||||
var songText:Alphabet = new Alphabet(0, (70 * i) + 30, songs[i].songName, true, false);
|
var songText:Alphabet = new Alphabet(0, (70 * i) + 30, songs[i].songName, true, false);
|
||||||
|
songText.x += 100;
|
||||||
songText.isMenuItem = true;
|
songText.isMenuItem = true;
|
||||||
songText.targetY = i;
|
songText.targetY = i;
|
||||||
grpSongs.add(songText);
|
|
||||||
|
// grpSongs.add(songText);
|
||||||
|
|
||||||
var icon:HealthIcon = new HealthIcon(songs[i].songCharacter);
|
var icon:HealthIcon = new HealthIcon(songs[i].songCharacter);
|
||||||
icon.sprTracker = songText;
|
icon.sprTracker = songText;
|
||||||
|
|
||||||
// using a FlxGroup is too much fuss!
|
// using a FlxGroup is too much fuss!
|
||||||
iconArray.push(icon);
|
iconArray.push(icon);
|
||||||
add(icon);
|
// add(icon);
|
||||||
|
|
||||||
// songText.x += 40;
|
// songText.x += 40;
|
||||||
// DONT PUT X IN THE FIRST PARAMETER OF new ALPHABET() !!
|
// DONT PUT X IN THE FIRST PARAMETER OF new ALPHABET() !!
|
||||||
|
@ -233,7 +247,6 @@ class FreeplayState extends MusicBeatState
|
||||||
}
|
}
|
||||||
|
|
||||||
lerpScore = CoolUtil.coolLerp(lerpScore, intendedScore, 0.4);
|
lerpScore = CoolUtil.coolLerp(lerpScore, intendedScore, 0.4);
|
||||||
bg.color = FlxColor.interpolate(bg.color, coolColors[songs[curSelected].week % coolColors.length], CoolUtil.camLerpShit(0.045));
|
|
||||||
|
|
||||||
scoreText.text = "PERSONAL BEST:" + Math.round(lerpScore);
|
scoreText.text = "PERSONAL BEST:" + Math.round(lerpScore);
|
||||||
|
|
||||||
|
@ -461,20 +474,15 @@ class FreeplayState extends MusicBeatState
|
||||||
|
|
||||||
iconArray[curSelected].alpha = 1;
|
iconArray[curSelected].alpha = 1;
|
||||||
|
|
||||||
for (item in grpSongs.members)
|
for (index => capsule in grpCapsules.members)
|
||||||
{
|
{
|
||||||
item.targetY = bullShit - curSelected;
|
capsule.selected = false;
|
||||||
bullShit++;
|
|
||||||
|
|
||||||
item.alpha = 0.6;
|
capsule.targetPos.y = ((index - curSelected) * 150) + 160;
|
||||||
// item.setGraphicSize(Std.int(item.width * 0.8));
|
capsule.targetPos.x = 270 + (60 * (Math.sin(index - curSelected)));
|
||||||
|
|
||||||
if (item.targetY == 0)
|
|
||||||
{
|
|
||||||
item.alpha = 1;
|
|
||||||
// item.setGraphicSize(Std.int(item.width));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
grpCapsules.members[curSelected].selected = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function positionHighscore()
|
function positionHighscore()
|
||||||
|
|
71
source/freeplayStuff/SongMenuItem.hx
Normal file
71
source/freeplayStuff/SongMenuItem.hx
Normal file
|
@ -0,0 +1,71 @@
|
||||||
|
package freeplayStuff;
|
||||||
|
|
||||||
|
import flixel.FlxSprite;
|
||||||
|
import flixel.graphics.frames.FlxAtlasFrames;
|
||||||
|
import flixel.group.FlxSpriteGroup.FlxTypedSpriteGroup;
|
||||||
|
import flixel.group.FlxSpriteGroup;
|
||||||
|
import flixel.math.FlxMath;
|
||||||
|
import flixel.math.FlxPoint;
|
||||||
|
import flixel.text.FlxText;
|
||||||
|
|
||||||
|
class SongMenuItem extends FlxSpriteGroup
|
||||||
|
{
|
||||||
|
var capsule:FlxSprite;
|
||||||
|
|
||||||
|
public var selected(default, set):Bool = false;
|
||||||
|
|
||||||
|
public var songTitle:String = "Test";
|
||||||
|
|
||||||
|
var songText:FlxText;
|
||||||
|
|
||||||
|
public var targetPos:FlxPoint = new FlxPoint();
|
||||||
|
public var doLerp:Bool = false;
|
||||||
|
|
||||||
|
public function new(x:Float, y:Float, song:String)
|
||||||
|
{
|
||||||
|
super(x, y);
|
||||||
|
|
||||||
|
this.songTitle = song;
|
||||||
|
|
||||||
|
capsule = new FlxSprite();
|
||||||
|
capsule.frames = Paths.getSparrowAtlas('freeplay/freeplayCapsule');
|
||||||
|
capsule.animation.addByPrefix('selected', 'mp3 capsule w backing0', 24);
|
||||||
|
capsule.animation.addByPrefix('unselected', 'mp3 capsule w backing NOT SELECTED', 24);
|
||||||
|
// capsule.animation
|
||||||
|
add(capsule);
|
||||||
|
|
||||||
|
songText = new FlxText(120, 40, 0, songTitle, 40);
|
||||||
|
songText.font = "5by7";
|
||||||
|
songText.color = 0xFF43C1EA;
|
||||||
|
add(songText);
|
||||||
|
|
||||||
|
selected = selected; // just to kickstart the set_selected
|
||||||
|
}
|
||||||
|
|
||||||
|
override function update(elapsed:Float)
|
||||||
|
{
|
||||||
|
if (doLerp)
|
||||||
|
{
|
||||||
|
x = CoolUtil.coolLerp(x, targetPos.x, 0.3);
|
||||||
|
y = CoolUtil.coolLerp(y, targetPos.y, 0.4);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (FlxG.keys.justPressed.ALT)
|
||||||
|
selected = false;
|
||||||
|
if (FlxG.keys.justPressed.CONTROL)
|
||||||
|
selected = true;
|
||||||
|
|
||||||
|
super.update(elapsed);
|
||||||
|
}
|
||||||
|
|
||||||
|
function set_selected(value:Bool):Bool
|
||||||
|
{
|
||||||
|
trace(value);
|
||||||
|
|
||||||
|
// cute one liners, lol!
|
||||||
|
songText.alpha = value ? 1 : 0.6;
|
||||||
|
capsule.offset.x = value ? 0 : -5;
|
||||||
|
capsule.animation.play(value ? "selected" : "unselected");
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue