How can I make collision?
-
How can I make collision with a sprite and on screen "border"?
-
Normally what I do is a bunch of ‘if player x position < 0 then player xspeed = - player xspeed
If player x > screenwidth then player xspeed = - player xspeed
If player y position < 0 then player y speed = - player y speed
If player y position > screen height then player y speed = - player y speed.’This has the effect of bouncing you off walls. To stop dead, you’d put speed = 0, and laso probably shift the players position a bit to put them back jnside the screen if they go over by a few pixels.
There’s a clever example in the tutorials using clamp() which looks neater. It’s at https://fuzearena.com/help/view/Sprite Game - scroll down to the part ‘creating boundaries’
You can also use maps, probably, and use the map collision. All sorts of ways to skin a cat. Hope this helps!