Skip to content

Commit

Permalink
fix tankmen gf
Browse files Browse the repository at this point in the history
  • Loading branch information
MaybeMaru committed Jun 28, 2024
1 parent bf81b21 commit f9c4eab
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 14 deletions.
10 changes: 9 additions & 1 deletion source/funkin/objects/Character.hx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ typedef CharacterJson = {
var isGF:Bool;
} & SpriteJson;

enum abstract CharacterType(String) from String to String
{
var BF = "bf";
var DAD = "dad";
var GF = "gf";
var UNKNOWN = "";
}

class Character extends FlxSpriteExt
{
public static final DEFAULT_CHARACTER:CharacterJson = {
Expand Down Expand Up @@ -42,7 +50,7 @@ class Character extends FlxSpriteExt
public var debugMode:Bool = false;
public var botMode:Bool = false;
public var script:FunkScript = null;
public var type:String = "";
public var type:CharacterType = UNKNOWN;

// Display
public var icon:String = 'face';
Expand Down
4 changes: 2 additions & 2 deletions source/funkin/objects/NotesGroup.hx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class NotesGroup extends Group
return dadBotplay = value;
}

public function spawnSplash(note:Note) {
public inline function spawnSplash(note:Note) {
grpNoteSplashes.spawnSplash(note);
}

Expand All @@ -66,7 +66,7 @@ class NotesGroup extends Group

if (character != null) {
character.sing(note.noteData, note.altAnim);
Conductor.vocals.volume = 1;
Conductor.vocals.volume = note.mustHit ? 1 : 0;
}

if (!botplayCheck || prefBot) {
Expand Down
8 changes: 4 additions & 4 deletions source/funkin/states/PlayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,8 @@ class PlayState extends MusicBeatState
stageScript.set("ScriptStage", stage);

// Set stage character positions
gfOpponent = SONG.players[1] == SONG.players[2] && dad.isGF;
stage.setupPlayState(this);
gfOpponent = (SONG.players[1] == SONG.players[2]) && dad.isGF;
stage.setupPlayState(this, true);

iconGroup = new SpriteGroup();
iconP1 = new HealthIcon(boyfriend.icon, true, true);
Expand All @@ -203,7 +203,7 @@ class PlayState extends MusicBeatState
boyfriend.iconSpr = iconP1;

//Character Scripts
boyfriend.type = "bf"; dad.type = "dad"; gf.type = "gf";
boyfriend.type = BF; dad.type = DAD; gf.type = GF;
addCharScript(boyfriend); addCharScript(dad); addCharScript(gf);

//Song Scripts
Expand Down Expand Up @@ -636,7 +636,7 @@ class PlayState extends MusicBeatState
public function exitSong():Void {
if (isStoryMode) {
campaignScore += songScore;
storyPlaylist.remove(storyPlaylist[0]);
storyPlaylist.removeAt(0);
storyPlaylist.length <= 0 ? endWeek() : switchSong();
}
else {
Expand Down
16 changes: 9 additions & 7 deletions source/funkin/util/Stage.hx
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ class Stage extends TypedGroup<Layer> implements IMusicHit
return super.set_active(value);
}

public function setupPlayState(instance:PlayState) {
public function setupPlayState(instance:PlayState, init:Bool = false) {
final dadOpponent:Bool = !instance.gfOpponent;

__existsAddToLayer("bf", instance.boyfriendGroup);
Expand All @@ -226,7 +226,8 @@ class Stage extends TypedGroup<Layer> implements IMusicHit
applyData(
instance.boyfriend,
instance.dad,
instance.gf
instance.gf,
init
);
}
else
Expand All @@ -236,29 +237,30 @@ class Stage extends TypedGroup<Layer> implements IMusicHit
applyData(
instance.boyfriend,
null,
instance.dad
instance.dad,
init
);
}
}

public function applyData(bf:Character, dad:Character, gf:Character)
public function applyData(bf:Character, dad:Character, gf:Character, init:Bool = false)
{
if (bf != null) {
bf.stageOffsets.set(data.bfOffsets[0], data.bfOffsets[1]);
bf.stageCamOffsets.set(data.bfCamOffsets[0], data.bfCamOffsets[1]);
bf.reposition(770, 450);
init ? bf.setXY(770, 450) : bf.reposition(770, 450);
}

if (dad != null) {
dad.stageOffsets.set(data.dadOffsets[0], data.dadOffsets[1]);
dad.stageCamOffsets.set(data.dadCamOffsets[0], data.dadCamOffsets[1]);
dad.reposition(100, 450);
init ? dad.setXY(100, 450) : dad.reposition(100, 450);
}

if (gf != null) {
gf.stageOffsets.set(data.gfOffsets[0], data.gfOffsets[1]);
gf.stageCamOffsets.set(data.gfCamOffsets[0], data.gfCamOffsets[1]);
gf.reposition(400, 360);
init ? gf.setXY(400, 360) : gf.reposition(400, 360);
}
}

Expand Down

0 comments on commit f9c4eab

Please sign in to comment.