Navigation

    Fuze Arena Logo
    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Popular
    • Users
    • Groups
    • Help
    • Discord

    How can I make collision?

    Help
    collision screen sprite
    2
    2
    364
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • N
      NewJoeniel last edited by

      How can I make collision with a sprite and on screen "border"?

      1 Reply Last reply Reply Quote 0
      • PickleCatStars
        PickleCatStars F last edited by

        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!

        1 Reply Last reply Reply Quote 4
        • First post
          Last post