Gameplay Customization
This commit is contained in:
parent
8b506680ab
commit
8796ce1b97
@ -124,7 +124,7 @@ class Character extends FlxSprite
|
|||||||
|
|
||||||
case 'dad':
|
case 'dad':
|
||||||
// DAD ANIMATION LOADING CODE
|
// DAD ANIMATION LOADING CODE
|
||||||
tex = Paths.getSparrowAtlas('DADDY_DEAREST');
|
tex = Paths.getSparrowAtlas('DADDY_DEAREST','shared');
|
||||||
frames = tex;
|
frames = tex;
|
||||||
animation.addByPrefix('idle', 'Dad idle dance', 24);
|
animation.addByPrefix('idle', 'Dad idle dance', 24);
|
||||||
animation.addByPrefix('singUP', 'Dad Sing Note UP', 24);
|
animation.addByPrefix('singUP', 'Dad Sing Note UP', 24);
|
||||||
@ -267,7 +267,7 @@ class Character extends FlxSprite
|
|||||||
flipX = true;
|
flipX = true;
|
||||||
|
|
||||||
case 'bf':
|
case 'bf':
|
||||||
var tex = Paths.getSparrowAtlas('BOYFRIEND');
|
var tex = Paths.getSparrowAtlas('BOYFRIEND','shared');
|
||||||
frames = tex;
|
frames = tex;
|
||||||
animation.addByPrefix('idle', 'BF idle dance', 24, false);
|
animation.addByPrefix('idle', 'BF idle dance', 24, false);
|
||||||
animation.addByPrefix('singUP', 'BF NOTE UP0', 24, false);
|
animation.addByPrefix('singUP', 'BF NOTE UP0', 24, false);
|
||||||
|
176
source/GameplayCustomizeState.hx
Normal file
176
source/GameplayCustomizeState.hx
Normal file
@ -0,0 +1,176 @@
|
|||||||
|
import flixel.math.FlxPoint;
|
||||||
|
import flixel.FlxObject;
|
||||||
|
#if desktop
|
||||||
|
import Discord.DiscordClient;
|
||||||
|
import sys.thread.Thread;
|
||||||
|
#end
|
||||||
|
|
||||||
|
import flixel.group.FlxGroup.FlxTypedGroup;
|
||||||
|
import openfl.ui.Keyboard;
|
||||||
|
import flixel.FlxSprite;
|
||||||
|
import flixel.FlxG;
|
||||||
|
|
||||||
|
class GameplayCustomizeState extends MusicBeatState
|
||||||
|
{
|
||||||
|
|
||||||
|
var defaultX:Float = FlxG.width * 0.55 - 135;
|
||||||
|
var defaultY:Float = FlxG.height / 2 - 50;
|
||||||
|
|
||||||
|
var background:FlxSprite = new FlxSprite(-600, -200).loadGraphic(Paths.image('stageback','shared'));
|
||||||
|
var curt:FlxSprite = new FlxSprite(-500, -300).loadGraphic(Paths.image('stagecurtains','shared'));
|
||||||
|
var front:FlxSprite = new FlxSprite(-650, 600).loadGraphic(Paths.image('stagefront','shared'));
|
||||||
|
|
||||||
|
var sick:FlxSprite = new FlxSprite().loadGraphic(Paths.image('sick','shared'));
|
||||||
|
|
||||||
|
var bf:Boyfriend = new Boyfriend(770, 450, 'bf');
|
||||||
|
var dad:Character;
|
||||||
|
|
||||||
|
var strumLine:FlxSprite;
|
||||||
|
var strumLineNotes:FlxTypedGroup<FlxSprite>;
|
||||||
|
var playerStrums:FlxTypedGroup<FlxSprite>;
|
||||||
|
|
||||||
|
override function create() {
|
||||||
|
#if desktop
|
||||||
|
// Updating Discord Rich Presence
|
||||||
|
DiscordClient.changePresence("Customizing Gameplay", null);
|
||||||
|
#end
|
||||||
|
|
||||||
|
background.scrollFactor.set(0.9,0.9);
|
||||||
|
curt.scrollFactor.set(0.9,0.9);
|
||||||
|
front.scrollFactor.set(0.9,0.9);
|
||||||
|
|
||||||
|
add(background);
|
||||||
|
add(front);
|
||||||
|
add(curt);
|
||||||
|
|
||||||
|
|
||||||
|
add(sick);
|
||||||
|
|
||||||
|
bf.playAnim('idle');
|
||||||
|
|
||||||
|
var camFollow = new FlxObject(0, 0, 1, 1);
|
||||||
|
|
||||||
|
dad = new Character(100, 100, 'dad');
|
||||||
|
|
||||||
|
var camPos:FlxPoint = new FlxPoint(dad.getGraphicMidpoint().x + 400, dad.getGraphicMidpoint().y);
|
||||||
|
|
||||||
|
camFollow.setPosition(camPos.x, camPos.y);
|
||||||
|
|
||||||
|
add(bf);
|
||||||
|
add(dad);
|
||||||
|
|
||||||
|
add(camFollow);
|
||||||
|
|
||||||
|
FlxG.camera.follow(camFollow, LOCKON, 0.01);
|
||||||
|
// FlxG.camera.setScrollBounds(0, FlxG.width, 0, FlxG.height);
|
||||||
|
FlxG.camera.zoom = 0.9;
|
||||||
|
FlxG.camera.focusOn(camFollow.getPosition());
|
||||||
|
|
||||||
|
strumLine = new FlxSprite(0, 25).makeGraphic(FlxG.width, 10);
|
||||||
|
strumLine.scrollFactor.set();
|
||||||
|
|
||||||
|
if (FlxG.save.data.downscroll)
|
||||||
|
strumLine.y = FlxG.height - 165;
|
||||||
|
|
||||||
|
strumLineNotes = new FlxTypedGroup<FlxSprite>();
|
||||||
|
add(strumLineNotes);
|
||||||
|
|
||||||
|
playerStrums = new FlxTypedGroup<FlxSprite>();
|
||||||
|
|
||||||
|
generateStaticArrows(0);
|
||||||
|
generateStaticArrows(1);
|
||||||
|
|
||||||
|
if (!FlxG.save.data.changedHit)
|
||||||
|
{
|
||||||
|
FlxG.save.data.changedHitX = defaultX;
|
||||||
|
FlxG.save.data.changedHitY = defaultY;
|
||||||
|
}
|
||||||
|
|
||||||
|
sick.x = FlxG.save.data.changedHitX;
|
||||||
|
sick.y = FlxG.save.data.changedHitY;
|
||||||
|
|
||||||
|
FlxG.mouse.visible = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
override function update(elapsed:Float) {
|
||||||
|
bf.playAnim('idle');
|
||||||
|
dad.dance();
|
||||||
|
|
||||||
|
if (FlxG.mouse.overlaps(sick) && FlxG.mouse.pressed)
|
||||||
|
{
|
||||||
|
sick.x = FlxG.mouse.x - sick.width / 2;
|
||||||
|
sick.y = FlxG.mouse.y - sick.height / 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (FlxG.mouse.overlaps(sick) && FlxG.mouse.justReleased)
|
||||||
|
{
|
||||||
|
FlxG.save.data.changedHitX = sick.x;
|
||||||
|
FlxG.save.data.changedHitY = sick.y;
|
||||||
|
FlxG.save.data.changedHit = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (controls.BACK)
|
||||||
|
{
|
||||||
|
FlxG.mouse.visible = false;
|
||||||
|
FlxG.sound.play(Paths.sound('cancelMenu'));
|
||||||
|
FlxG.switchState(new OptionsMenu());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ripped from play state cuz im lazy
|
||||||
|
|
||||||
|
private function generateStaticArrows(player:Int):Void
|
||||||
|
{
|
||||||
|
for (i in 0...4)
|
||||||
|
{
|
||||||
|
// FlxG.log.add(i);
|
||||||
|
var babyArrow:FlxSprite = new FlxSprite(0, strumLine.y);
|
||||||
|
babyArrow.frames = Paths.getSparrowAtlas('NOTE_assets', 'shared');
|
||||||
|
babyArrow.animation.addByPrefix('green', 'arrowUP');
|
||||||
|
babyArrow.animation.addByPrefix('blue', 'arrowDOWN');
|
||||||
|
babyArrow.animation.addByPrefix('purple', 'arrowLEFT');
|
||||||
|
babyArrow.animation.addByPrefix('red', 'arrowRIGHT');
|
||||||
|
babyArrow.antialiasing = true;
|
||||||
|
babyArrow.setGraphicSize(Std.int(babyArrow.width * 0.7));
|
||||||
|
switch (Math.abs(i))
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
babyArrow.x += Note.swagWidth * 0;
|
||||||
|
babyArrow.animation.addByPrefix('static', 'arrowLEFT');
|
||||||
|
babyArrow.animation.addByPrefix('pressed', 'left press', 24, false);
|
||||||
|
babyArrow.animation.addByPrefix('confirm', 'left confirm', 24, false);
|
||||||
|
case 1:
|
||||||
|
babyArrow.x += Note.swagWidth * 1;
|
||||||
|
babyArrow.animation.addByPrefix('static', 'arrowDOWN');
|
||||||
|
babyArrow.animation.addByPrefix('pressed', 'down press', 24, false);
|
||||||
|
babyArrow.animation.addByPrefix('confirm', 'down confirm', 24, false);
|
||||||
|
case 2:
|
||||||
|
babyArrow.x += Note.swagWidth * 2;
|
||||||
|
babyArrow.animation.addByPrefix('static', 'arrowUP');
|
||||||
|
babyArrow.animation.addByPrefix('pressed', 'up press', 24, false);
|
||||||
|
babyArrow.animation.addByPrefix('confirm', 'up confirm', 24, false);
|
||||||
|
case 3:
|
||||||
|
babyArrow.x += Note.swagWidth * 3;
|
||||||
|
babyArrow.animation.addByPrefix('static', 'arrowRIGHT');
|
||||||
|
babyArrow.animation.addByPrefix('pressed', 'right press', 24, false);
|
||||||
|
babyArrow.animation.addByPrefix('confirm', 'right confirm', 24, false);
|
||||||
|
}
|
||||||
|
babyArrow.updateHitbox();
|
||||||
|
babyArrow.scrollFactor.set();
|
||||||
|
|
||||||
|
babyArrow.ID = i;
|
||||||
|
|
||||||
|
if (player == 1)
|
||||||
|
{
|
||||||
|
playerStrums.add(babyArrow);
|
||||||
|
}
|
||||||
|
|
||||||
|
babyArrow.animation.play('static');
|
||||||
|
babyArrow.x += 50;
|
||||||
|
babyArrow.x += ((FlxG.width / 2) * player);
|
||||||
|
|
||||||
|
strumLineNotes.add(babyArrow);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -12,6 +12,7 @@ class HealthIcon extends FlxSprite
|
|||||||
public function new(char:String = 'bf', isPlayer:Bool = false)
|
public function new(char:String = 'bf', isPlayer:Bool = false)
|
||||||
{
|
{
|
||||||
super();
|
super();
|
||||||
|
trace(Paths.image('iconGrid','data'));
|
||||||
loadGraphic(Paths.image('iconGrid'), true, 150, 150);
|
loadGraphic(Paths.image('iconGrid'), true, 150, 150);
|
||||||
|
|
||||||
antialiasing = true;
|
antialiasing = true;
|
||||||
|
@ -30,5 +30,12 @@ class KadeEngineData
|
|||||||
|
|
||||||
if (FlxG.save.data.fps == null)
|
if (FlxG.save.data.fps == null)
|
||||||
FlxG.save.data.fps = false;
|
FlxG.save.data.fps = false;
|
||||||
|
|
||||||
|
if (FlxG.save.data.changedHit == null)
|
||||||
|
{
|
||||||
|
FlxG.save.data.changedHitX = -1;
|
||||||
|
FlxG.save.data.changedHitY = -1;
|
||||||
|
FlxG.save.data.changedHit = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -157,3 +157,19 @@ class ReplayOption extends Option
|
|||||||
return "Load replays";
|
return "Load replays";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class CustomizeGameplay extends Option
|
||||||
|
{
|
||||||
|
public override function press():Bool
|
||||||
|
{
|
||||||
|
trace("switch");
|
||||||
|
FlxG.switchState(new GameplayCustomizeState());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private override function updateDisplay():String
|
||||||
|
{
|
||||||
|
return "Customize Gameplay";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -28,6 +28,7 @@ class OptionsMenu extends MusicBeatState
|
|||||||
new FPSOption(),
|
new FPSOption(),
|
||||||
#end
|
#end
|
||||||
new EtternaModeOption(),
|
new EtternaModeOption(),
|
||||||
|
new CustomizeGameplay(),
|
||||||
new ReplayOption()
|
new ReplayOption()
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -2160,6 +2160,12 @@ class PlayState extends MusicBeatState
|
|||||||
rating.screenCenter();
|
rating.screenCenter();
|
||||||
rating.y -= 50;
|
rating.y -= 50;
|
||||||
rating.x = coolText.x - 125;
|
rating.x = coolText.x - 125;
|
||||||
|
|
||||||
|
if (FlxG.save.data.changedHit)
|
||||||
|
{
|
||||||
|
rating.x = FlxG.save.data.changedHitX;
|
||||||
|
rating.y = FlxG.save.data.changedHitY;
|
||||||
|
}
|
||||||
rating.acceleration.y = 550;
|
rating.acceleration.y = 550;
|
||||||
rating.velocity.y -= FlxG.random.int(140, 175);
|
rating.velocity.y -= FlxG.random.int(140, 175);
|
||||||
rating.velocity.x -= FlxG.random.int(0, 10);
|
rating.velocity.x -= FlxG.random.int(0, 10);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user