[Help] Help with this collision

36 views
Skip to first unread message

Cajujoe

unread,
Feb 15, 2021, 9:24:11 PMFeb 15
to PuzzleScript
Hello guys,
I'm making a game where if a dog player is in the same tile as a dog enemy, he "dies"and the level restart. When the player moves, the enemy moves horizontaly. This is the rule:

late [ Player  enemies ] -> [ Player enemies ] sfx1 restart

But in certain start positions, it's impossible for the player to be in the same tile as the enemy, so they cross paths and nothing happens. Somebody could help me with this problem? Here is the simplified code with only one level. It happens with the first enemy dog, but not with the second and the third. Thanks!
Iron_Code-Test.txt

Chris Pickel

unread,
Feb 15, 2021, 9:49:56 PMFeb 15
to Cajujoe, PuzzleScript
You can detect crossing movement in a non-late rule, like this:

[> Player | < Enemies] -> [Player | Enemies] sfx1 restart

--
You received this message because you are subscribed to the Google Groups "PuzzleScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puzzlescript...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/puzzlescript/32ac3eb8-1857-418e-a186-9b1968c055e9n%40googlegroups.com.

Cajujoe

unread,
Feb 15, 2021, 10:52:31 PMFeb 15
to PuzzleScript
Hello Chris, thank you very much for your answer.
Unfortunately the problem persists, the Player continues to cross freely in the horizontal line with some enemies depending on the start position.

Chris Pickel

unread,
Feb 15, 2021, 11:03:04 PMFeb 15
to Cajujoe, PuzzleScript
I see. You want to player to lose if they enter a tile as an enemy is either entering or exiting it? In that case you would drop the <:

[> Player | Enemies] -> sfx1 restart

(you actually don’t need the right-hand side if the result is to restart)

Sandro Massarani

unread,
Feb 15, 2021, 11:52:57 PMFeb 15
to Chris Pickel, PuzzleScript
Thanks Chris!! 
I only want the collision to happen if the enemy is entering a tile, not if he is exiting. So, I changed the rule to:
[> Player | < Enemies] -> sfx1 restart
and now works!!
Thank you very much!

Chris Pickel

unread,
Feb 16, 2021, 12:48:01 AMFeb 16
to Sandro Massarani, PuzzleScript
Oh, I see the mistake I made.

Your game sets “require_player_movement”. The original rule I wrote stopped the movement. I thought that was irrelevant, because the result of the turn shouldn’t matter if the game restarts. Actually, PuzzleScript detects the lack of movement, and cancels the whole turn, including the restart. Removing the right side restores the movement, allowing the game to restart.

This is surprising to me, maybe a bug? I thought that “restart” would count as an outcome as far as require_player_movement goes. I reduced a demonstration down to https://www.puzzlescript.net/editor.html?hack=72649bfb7b72f42306261e6211841b57

Stephen Lavelle

unread,
Feb 16, 2021, 8:49:10 AMFeb 16
to Chris Pickel, Sandro Massarani, PuzzleScript
It's a weird edge case, but I'm going to make a call and say that it's not a bug ^^. (Thanks for assembling a demo version).

Reply all
Reply to author
Forward
0 new messages