diff --git a/source/PlayState.hx b/source/PlayState.hx index fd10a8f37..72a6de6cc 100644 --- a/source/PlayState.hx +++ b/source/PlayState.hx @@ -110,13 +110,6 @@ class PlayState extends MusicBeatState var foregroundSprites:FlxTypedGroup; - var upperBoppers:FlxSprite; - var bottomBoppers:FlxSprite; - var santa:FlxSprite; - - var bgGirls:BackgroundGirls; - var wiggleShit:WiggleEffect = new WiggleEffect(); - var tankmanRun:FlxTypedGroup; var gfCutsceneLayer:FlxGroup; var bfTankCutsceneLayer:FlxGroup; @@ -383,6 +376,7 @@ class PlayState extends MusicBeatState // a lot of this stage code will be cleaned up more when the stage load shit is more fleshed out! For now it's still a lot of hardcoded shit!! function initStageBullshit() { + // TODO: Move stageId to the song file. switch (SONG.song.toLowerCase()) { case 'spookeez' | 'monster' | 'south': @@ -411,92 +405,16 @@ class PlayState extends MusicBeatState case 'senpai' | 'roses': curStageId = 'school'; + loadStage(curStageId); - // defaultCamZoom *= 0.9; + case "darnell": + curStageId = 'phillyStreets'; + loadStage(curStageId); - var bgSky = new FlxSprite().loadGraphic(Paths.image('weeb/weebSky')); - bgSky.scrollFactor.set(0.1, 0.1); - add(bgSky); - - var repositionShit = -200; - - var bgSchool:FlxSprite = new FlxSprite(repositionShit, 0).loadGraphic(Paths.image('weeb/weebSchool')); - bgSchool.scrollFactor.set(0.6, 0.90); - add(bgSchool); - - var bgStreet:FlxSprite = new FlxSprite(repositionShit).loadGraphic(Paths.image('weeb/weebStreet')); - bgStreet.scrollFactor.set(0.95, 0.95); - add(bgStreet); - - var fgTrees:FlxSprite = new FlxSprite(repositionShit + 170, 130).loadGraphic(Paths.image('weeb/weebTreesBack')); - fgTrees.scrollFactor.set(0.9, 0.9); - add(fgTrees); - - var bgTrees:FlxSprite = new FlxSprite(repositionShit - 380, -800); - var treetex = Paths.getPackerAtlas('weeb/weebTrees'); - bgTrees.frames = treetex; - bgTrees.animation.add('treeLoop', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18], 12); - bgTrees.animation.play('treeLoop'); - bgTrees.scrollFactor.set(0.85, 0.85); - add(bgTrees); - - var treeLeaves:FlxSprite = new FlxSprite(repositionShit, -40); - treeLeaves.frames = Paths.getSparrowAtlas('weeb/petals'); - treeLeaves.animation.addByPrefix('leaves', 'PETALS ALL', 24, true); - treeLeaves.animation.play('leaves'); - treeLeaves.scrollFactor.set(0.85, 0.85); - add(treeLeaves); - - var widShit = Std.int(bgSky.width * 6); - - bgSky.setGraphicSize(widShit); - bgSchool.setGraphicSize(widShit); - bgStreet.setGraphicSize(widShit); - bgTrees.setGraphicSize(Std.int(widShit * 1.4)); - fgTrees.setGraphicSize(Std.int(widShit * 0.8)); - treeLeaves.setGraphicSize(widShit); - - fgTrees.updateHitbox(); - bgSky.updateHitbox(); - bgSchool.updateHitbox(); - bgStreet.updateHitbox(); - bgTrees.updateHitbox(); - treeLeaves.updateHitbox(); - - bgGirls = new BackgroundGirls(-100, 190); - bgGirls.scrollFactor.set(0.9, 0.9); - - if (SONG.song.toLowerCase() == 'roses') - { - bgGirls.getScared(); - } - - bgGirls.setGraphicSize(Std.int(bgGirls.width * daPixelZoom)); - bgGirls.updateHitbox(); - add(bgGirls); case 'thorns': - // loadStage('schoolEvil'); curStageId = 'schoolEvil'; + loadStage(curStageId); - var schoolBG:FlxSprite = new FlxSprite(-200, 0).loadGraphic(Paths.image('weeb/evilSchoolBG')); - wiggleShit.waveAmplitude = 0.017; - wiggleShit.waveSpeed = 2; - wiggleShit.waveFrequency = 4; - schoolBG.shader = wiggleShit.shader; - schoolBG.setGraphicSize(Std.int(schoolBG.width * 6)); - schoolBG.updateHitbox(); - // schoolBG.scale.set(6, 6); - add(schoolBG); - - schoolBG.scrollFactor.set(0.7, 1); - - var schoolFront:FlxSprite = new FlxSprite(-250, schoolBG.y + 20).loadGraphic(Paths.image('weeb/evilSchoolFG')); - - schoolFront.shader = wiggleShit.shader; - - schoolFront.setGraphicSize(Std.int(schoolFront.width * 6)); - schoolFront.updateHitbox(); - add(schoolFront); case 'guns' | 'stress' | 'ugh': loadStageOld('tank'); @@ -544,11 +462,9 @@ class PlayState extends MusicBeatState var fgTank3:BGSprite = new BGSprite('tank3', 1300, 1200, 3.5, 2.5, ['fg']); foregroundSprites.add(fgTank3); - case "darnell": - curStageId = 'phillyStreets'; - loadStage(curStageId); default: - loadStage('mainStage'); + curStageId = "mainStage"; + loadStage(curStageId); } } @@ -648,11 +564,6 @@ class PlayState extends MusicBeatState // REPOSITIONING PER STAGE switch (curStageId) { - case 'school': - boyfriend.x += 200; - boyfriend.y += 220; - gf.x += 180; - gf.y += 300; case 'schoolEvil': // trailArea.scrollFactor.set(); @@ -1865,8 +1776,6 @@ class PlayState extends MusicBeatState super.update(elapsed); // idk if there's a particular reason why some code is before super.update(), and some is after. Prob nothing too much to worry about. - wiggleShit.update(elapsed); - var androidPause:Bool = false; #if android @@ -2852,9 +2761,6 @@ class PlayState extends MusicBeatState // boppin friends switch (curStageId) { - case 'school': - bgGirls.dance(); - case 'tank': tankWatchtower.dance(); } diff --git a/source/play/stage/Bopper.hx b/source/play/stage/Bopper.hx index 910fc85ff..c020e9975 100644 --- a/source/play/stage/Bopper.hx +++ b/source/play/stage/Bopper.hx @@ -33,6 +33,15 @@ class Bopper extends FlxSprite return value; } + public var idleSuffix(default, set):String = ""; + + function set_idleSuffix(value:String):String + { + this.idleSuffix = value; + this.dance(); + return value; + } + /** * Set this value to define an additional vertical offset to this sprite's position. */ @@ -94,17 +103,17 @@ class Bopper extends FlxSprite { if (hasDanced) { - this.animation.play('danceRight'); + this.animation.play('danceRight$idleSuffix'); } else { - this.animation.play('danceLeft'); + this.animation.play('danceLeft$idleSuffix'); } hasDanced = !hasDanced; } else { - this.animation.play('idle'); + this.animation.play('idle$idleSuffix'); } } } diff --git a/source/play/stage/Stage.hx b/source/play/stage/Stage.hx index fbb1ed053..51d7bbdbb 100644 --- a/source/play/stage/Stage.hx +++ b/source/play/stage/Stage.hx @@ -80,7 +80,13 @@ class Stage extends FlxSpriteGroup implements IHook if (isAnimated) { // Initalize sprite frames. - propSprite.frames = Paths.getSparrowAtlas(dataProp.assetPath); + switch (dataProp.animType) + { + case "packer": + propSprite.frames = Paths.getPackerAtlas(dataProp.assetPath); + default: // "sparrow" + propSprite.frames = Paths.getSparrowAtlas(dataProp.assetPath); + } } else { @@ -112,17 +118,27 @@ class Stage extends FlxSpriteGroup implements IHook propSprite.zIndex = dataProp.zIndex; - for (propAnim in dataProp.animations) + switch (dataProp.animType) { - if (propAnim.frameIndices.length == 0) - { - propSprite.animation.addByPrefix(propAnim.name, propAnim.prefix, propAnim.frameRate, propAnim.loop, propAnim.flipX, propAnim.flipY); - } - else - { - propSprite.animation.addByIndices(propAnim.name, propAnim.prefix, propAnim.frameIndices, "", propAnim.frameRate, propAnim.loop, - propAnim.flipX, propAnim.flipY); - } + case "packer": + for (propAnim in dataProp.animations) + { + propSprite.animation.add(propAnim.name, propAnim.frameIndices); + } + default: // "sparrow" + for (propAnim in dataProp.animations) + { + if (propAnim.frameIndices.length == 0) + { + propSprite.animation.addByPrefix(propAnim.name, propAnim.prefix, propAnim.frameRate, propAnim.loop, propAnim.flipX, + propAnim.flipY); + } + else + { + propSprite.animation.addByIndices(propAnim.name, propAnim.prefix, propAnim.frameIndices, "", propAnim.frameRate, propAnim.loop, + propAnim.flipX, propAnim.flipY); + } + } } if (dataProp.startingAnimation != null) diff --git a/source/play/stage/StageData.hx b/source/play/stage/StageData.hx index eb3c9b698..2e8c07e29 100644 --- a/source/play/stage/StageData.hx +++ b/source/play/stage/StageData.hx @@ -179,6 +179,7 @@ class StageDataParser static final DEFAULT_POSITION:Array = [0, 0]; static final DEFAULT_SCROLL:Array = [0, 0]; static final DEFAULT_FRAMEINDICES:Array = []; + static final DEFAULT_ANIMTYPE:String = "sparrow"; static final DEFAULT_CHARACTER_DATA:StageDataCharacter = { zIndex: DEFAULT_ZINDEX, @@ -258,6 +259,11 @@ class StageDataParser inputProp.scale = DEFAULT_SCALE; } + if (inputProp.animType == null) + { + inputProp.animType = DEFAULT_ANIMTYPE; + } + if (Std.isOfType(inputProp.scale, Float)) { inputProp.scale = [inputProp.scale, inputProp.scale]; @@ -440,6 +446,13 @@ typedef StageDataProp = * @default Don't play an animation. */ var startingAnimation:String; + + /** + * The animation type to use. + * Options: "sparrow", "packer" + * @default "sparrow" + */ + var animType:String; }; typedef StageDataPropAnimation = diff --git a/source/WiggleEffect.hx b/source/shaderslmfao/WiggleEffect.hx similarity index 99% rename from source/WiggleEffect.hx rename to source/shaderslmfao/WiggleEffect.hx index d11bf6e7a..9d58c591f 100644 --- a/source/WiggleEffect.hx +++ b/source/shaderslmfao/WiggleEffect.hx @@ -1,4 +1,4 @@ -package; +package shaderslmfao; // STOLEN FROM HAXEFLIXEL DEMO LOL import flixel.system.FlxAssets.FlxShader;