How about use "Compare X" in "for each" instead of comparing the variable "whichSide"?
- For each,
- - if x < 400 : Sprite.x = Sprite.x -120
- - else : Sprite.x = Sprite.x +120
You have to place something like Solid objects in the middle to prevent the sprite to go to the other side. (otherwise, with this method, you might have a bug that both sprites move together on one side.
Logically, it is acceptable...
OR actually, a simpler method would be:
create 2 sprites with exactly same animation, etc., but name them differently, maybe player_LeftSide and player_rightSide.
Now, in your events:
- player_LeftSide.x = player_LeftSide.x - 100*dt
- player_RightSide.x = player_RightSide.x + 100*dt
- player_LeftSide.x = player_LeftSide.x + 100*dt
- player_RightSide.x = player_RightSide.x - 100*dt
This will allow you to make do without using "For Each". However, this event design may make you doing things for the player twice.
Is this ok for you?