Skip to content

Commit

Permalink
Fix minigames not being interactable properly.
Browse files Browse the repository at this point in the history
  • Loading branch information
EliteMasterEric committed Nov 30, 2024
1 parent 0702e3e commit 979b463
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 10 deletions.
Empty file removed assets/data/data-goes-here.txt
Empty file.
Empty file removed assets/music/music-goes-here.txt
Empty file.
Empty file removed assets/sounds/sounds-go-here.txt
Empty file.
23 changes: 13 additions & 10 deletions source/entities/Minigame.hx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ class Minigame extends Interactable
{
var minigame_id:String;

var ready_to_play:Bool = false;

public function new(?X:Float, ?Y:Float, width:Int, height:Int, minigame_id:String)
{
super(X, Y);
Expand All @@ -27,17 +29,18 @@ class Minigame extends Interactable
alpha = 0.5;
}

public override function mark_target(mark:Bool)
public override function mark_target(mark:Bool):Void
{
if (mark)
{
if (Ctrl.jjump[1])
{
start_minigame();
}
}
else
ready_to_play = mark;
}

public override function update(elapsed:Float):Void
{
super.update(elapsed);

if (ready_to_play && Ctrl.jjump[1])
{
start_minigame();
}
}

Expand All @@ -47,4 +50,4 @@ class Minigame extends Interactable

MinigameHandler.instance.playMinigame(minigame_id);
}
}
}

0 comments on commit 979b463

Please sign in to comment.