Skip to content

Commit

Permalink
fix gameplay customize for the final time
Browse files Browse the repository at this point in the history
  • Loading branch information
TheRealJake12 committed Jan 9, 2024
1 parent 27d9770 commit 8652cb8
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 45 deletions.
2 changes: 2 additions & 0 deletions source/GameOverSubstate.hx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ class GameOverSubstate extends MusicBeatSubstate
Conductor.songPosition = 0;

bf = new Boyfriend(x, y, daBf);
if (daBf == 'bf-pixel-dead')
bf.antialiasing = false;
add(bf);

camFollow = new FlxObject(bf.getGraphicMidpoint().x, bf.getGraphicMidpoint().y, 1, 1);
Expand Down
111 changes: 74 additions & 37 deletions source/GameplayCustomizeState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import openfl.ui.Keyboard;
import flixel.FlxSprite;
import flixel.FlxG;
import stages.Stage;
import flixel.addons.display.FlxExtendedSprite;

class GameplayCustomizeState extends MusicBeatState
{
Expand All @@ -39,7 +40,7 @@ class GameplayCustomizeState extends MusicBeatState
var curt:FlxSprite;
var front:FlxSprite;

var sick:FlxSprite;
var sick:FlxExtendedSprite;

var pixelShitPart1:String = '';
var pixelShitPart2:String = '';
Expand Down Expand Up @@ -77,24 +78,37 @@ class GameplayCustomizeState extends MusicBeatState

instance = this;

sick = new FlxSprite().loadGraphic(Paths.image('sick', 'shared'));
sick.antialiasing = FlxG.save.data.antialiasing;
sick.scrollFactor.set();
sick.setGraphicSize(Std.int(sick.width * 0.7));

// Conductor.changeBPM(102);
persistentUpdate = true;

var stageCheck:String = 'stage';

super.create();

if (freeplayNoteStyle == 'pixel')
{
PlayState.noteskinPixelSprite = CustomNoteHelpers.Skin.generatePixelSprite(FlxG.save.data.noteskin);
PlayState.noteskinPixelSpriteEnds = CustomNoteHelpers.Skin.generatePixelSprite(FlxG.save.data.noteskin, true);
}
else
{
PlayState.noteskinSprite = CustomNoteHelpers.Skin.generateNoteskinSprite(FlxG.save.data.noteskin);
PlayState.cpuNoteskinSprite = CustomNoteHelpers.Skin.generateNoteskinSprite(FlxG.save.data.cpuNoteskin);
}

Stage = new Stage(freeplayStage);

Stage.loadStageData(freeplayStage);
Stage.initStageProperties();

camHUD = new SwagCamera();
camHUD.bgColor.alpha = 0;

camOverlay = new SwagCamera();
camOverlay.bgColor.alpha = 0;

Stage.initCamPos();

// Game Camera (where stage and characters are)
FlxG.cameras.reset(camGame);

Expand All @@ -105,13 +119,17 @@ class GameplayCustomizeState extends MusicBeatState
camOverlay.zoom = 1;

var camFollow = new FlxObject(0, 0, 1, 1);
var camPos:FlxPoint = new FlxPoint(0, 0);
camPos.set(Stage.camPosition[0], Stage.camPosition[1]);
camFollow.setPosition(camPos.x, camPos.y);
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.zoom = Stage.camZoom;
FlxG.camera.focusOn(camFollow.getPosition());

dad = new Character(100, 100, 'dad');
dad = new Character(100, 100, freeplayDad);

if (dad.frames == null)
{
Expand All @@ -121,7 +139,7 @@ class GameplayCustomizeState extends MusicBeatState
dad = new Character(100, 100, 'dad');
}

boyfriend = new Boyfriend(770, 450, 'bf');
boyfriend = new Boyfriend(770, 450, freeplayBf);

if (boyfriend.frames == null)
{
Expand All @@ -131,9 +149,27 @@ class GameplayCustomizeState extends MusicBeatState
boyfriend = new Boyfriend(770, 450, 'bf');
}

// defaults if no gf was found in chart
var gfCheck:String = 'gf';

gf = new Character(400, 130, 'gf');
if (freeplayGf == null)
{
switch (freeplayWeek)
{
case 4:
gfCheck = 'gf-car';
case 5:
gfCheck = 'gf-christmas';
case 6:
gfCheck = 'gf-pixel';
case 7:
gfCheck = 'gfTank';
}
}
else
gfCheck = freeplayGf;

gf = new Character(400, 130, freeplayGf);

if (gf.frames == null)
{
Expand All @@ -143,11 +179,6 @@ class GameplayCustomizeState extends MusicBeatState
gf = new Character(400, 130, 'gf');
}

Stage = new Stage('stage');

Stage.loadStageData('stage');
Stage.initStageProperties();

var positions = Stage.positions[Stage.curStage];
if (positions != null)
{
Expand All @@ -166,7 +197,8 @@ class GameplayCustomizeState extends MusicBeatState
switch (index)
{
case 0:
add(gf);
if (Stage.hasGF)
add(gf);
gf.scrollFactor.set(0.95, 0.95);
for (bg in array)
add(bg);
Expand All @@ -180,21 +212,31 @@ class GameplayCustomizeState extends MusicBeatState
add(bg);
}
}

if (freeplayNoteStyle == 'pixel')
{
pixelShitPart1 = 'weeb/pixelUI/';
pixelShitPart2 = '-pixel';
pixelShitPart3 = 'week6';
pixelShitPart4 = 'week6';
}

Stage.initCamPos();

var camPos:FlxPoint = new FlxPoint(dad.getGraphicMidpoint().x + 400, dad.getGraphicMidpoint().y);

camFollow.setPosition(camPos.x, camPos.y);

add(gf);
add(boyfriend);
add(dad);

sick = new FlxExtendedSprite(0, 0, Paths.image(pixelShitPart1 + 'sick' + pixelShitPart2, pixelShitPart3));
if (freeplayNoteStyle != 'pixel')
{
sick.setGraphicSize(Std.int(sick.width * 0.7));
sick.antialiasing = FlxG.save.data.antialiasing;
}
else
{
sick.antialiasing = false;
sick.setGraphicSize(Std.int(sick.width * CoolUtil.daPixelZoom * 0.7));
}
sick.scrollFactor.set();
sick.updateHitbox();
sick.enableMouseDrag();
add(sick);

add(camFollow);

strumLine = new FlxSprite(0, 50).makeGraphic(FlxG.width, 10);
strumLine.scrollFactor.set();

Expand Down Expand Up @@ -265,12 +307,6 @@ class GameplayCustomizeState extends MusicBeatState
FlxG.camera.zoom = FlxMath.lerp(0.9, FlxG.camera.zoom, 0.95);
camHUD.zoom = FlxMath.lerp(FlxG.save.data.zoom, camHUD.zoom, 0.95);

if (FlxG.mouse.overlaps(sick) && FlxG.mouse.pressed)
{
sick.x = (FlxG.mouse.x - sick.width / 2) - 60;
sick.y = (FlxG.mouse.y - sick.height) - 60;
}

if (FlxG.keys.justPressed.E)
{
FlxG.save.data.zoom += 0.02;
Expand All @@ -283,7 +319,7 @@ class GameplayCustomizeState extends MusicBeatState
camHUD.zoom = FlxG.save.data.zoom;
}

if (FlxG.mouse.overlaps(sick) && FlxG.mouse.justReleased)
if (sick.x != defaultX && sick.y != defaultY)
{
FlxG.save.data.changedHitX = sick.x;
FlxG.save.data.changedHitY = sick.y;
Expand Down Expand Up @@ -332,9 +368,10 @@ class GameplayCustomizeState extends MusicBeatState
for (i in 0...4)
{
var babyArrow:StaticArrow = new StaticArrow(-10, strumLine.y, player, i);

var noteTypeCheck:String = 'normal';
babyArrow.downScroll = FlxG.save.data.downscroll;

babyArrow.noteTypeCheck = freeplayNoteStyle;
babyArrow.reloadNote();

babyArrow.loadLane();

Expand Down
10 changes: 4 additions & 6 deletions source/StaticArrow.hx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ class StaticArrow extends FlxSprite
private var player:Int;
private var noteData:Int = 0;

public var noteTypeCheck:String = 'normal';

private function set_texture(value:String):String
{
if (texture != value)
Expand Down Expand Up @@ -81,21 +83,17 @@ class StaticArrow extends FlxSprite
scrollFactor.set();
}

private function reloadNote()
public function reloadNote()
{
if (texture == null)
texture = '';

var lastAnim:String = null;
if (animation.curAnim != null)
lastAnim = animation.curAnim.name;

var noteTypeCheck:String = 'normal';

if (PlayState.SONG != null)
noteTypeCheck = PlayState.SONG.noteStyle;
else
noteTypeCheck = 'normal';

switch (noteTypeCheck)
{
case 'pixel':
Expand Down
5 changes: 3 additions & 2 deletions source/stages/Stage.hx
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ class Stage extends MusicBeatState
var bgGirls = new BackgroundGirls(-100, 190);
bgGirls.scrollFactor.set(0.9, 0.9);
bgGirls.setGraphicSize(Std.int(bgGirls.width * CoolUtil.daPixelZoom));
if (PlayState.SONG.songId == 'roses')
if (PlayState.SONG != null && PlayState.SONG.songId == 'roses')
bgGirls.getScared();
bgGirls.updateHitbox();
swagBacks['bgGirls'] = bgGirls;
Expand Down Expand Up @@ -620,6 +620,7 @@ class Stage extends MusicBeatState

case 'stage':
{
camPosition = [639, 359];
curStage = 'stage';
var bg:FlxSprite = new FlxSprite(-600, -200).loadGraphic(Paths.image('stageback', 'shared'));
bg.antialiasing = FlxG.save.data.antialiasing;
Expand Down Expand Up @@ -820,7 +821,7 @@ class Stage extends MusicBeatState
bg.animation.play('idle', true);
}

if (FlxG.save.data.distractions && FlxG.save.data.background && !FlxG.save.data.optimize)
if (FlxG.save.data.distractions && FlxG.save.data.background)
{
switch (curStage)
{
Expand Down

0 comments on commit 8652cb8

Please sign in to comment.