Skip to content

Commit

Permalink
Fix button detection
Browse files Browse the repository at this point in the history
  • Loading branch information
Austin-Tan committed Mar 10, 2020
1 parent b2aaee7 commit a574806
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 7 deletions.
Binary file modified assets/images/button.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/images/yellow-button.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 2 additions & 4 deletions source/HitButton.hx
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,10 @@ class HitButton extends FlxSprite {
super(x, y);
trace('timer ' + timer);
if (timer == 0) {
loadGraphic("assets/images/yellow-button.png", true, 32, 20);
loadGraphic("assets/images/yellow-button.png", true, 64, 40);
} else {
loadGraphic("assets/images/button.png", true, 32, 20);
loadGraphic("assets/images/button.png", true, 64, 40);
}
this.scale.set(2, 2);
this.updateHitbox();
this.animation.add("unpressed", [0], 0, false);
this.animation.add("pressed", [1], 0, false);
this.animation.play("unpressed");
Expand Down
2 changes: 1 addition & 1 deletion source/Level.hx
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ class Level {
// stage 1
[[500-50, 70]],
// stage 2
[[-9, cast(FlxG.height / 2, Int) - 30]],
[[-6, cast(FlxG.height / 2, Int) -30]],
// stage 3
[[cast(FlxG.width / 2, Int) - 30, 5], [-9, cast(FlxG.height / 2, Int) - 30], [cast(FlxG.width / 2, Int) - 30, FlxG.height - 43]]
];
Expand Down
2 changes: 0 additions & 2 deletions source/PlayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -513,9 +513,7 @@ class PlayState extends FlxState
}
}
for (button in activeButtons) {
trace ("button present in stage " + this.curStage);
if (FlxG.pixelPerfectOverlap(knife, button, 0)) {
trace("hit detected");
unstuckKnives.remove(knife);
knife.stuck = true;
knife.body.type = BodyType.STATIC;
Expand Down

0 comments on commit a574806

Please sign in to comment.