Navigation

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

    can you help me with shape collision

    Beginners
    3
    4
    266
    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.
    • R
      Rex9000 last edited by

      I've simulated gravity using Moveshape += Circ_Y Which moves it towards the ground like gravity but how do you make it collide with a box at the bottom of the screen?

      1 Reply Last reply Reply Quote 0
      • pianofire
        pianofire Fuze Team last edited by

        You could use the distance function https://fuzearena.com/help/view/distance to find when the distance between two points in close enough to be a hit

        Have a look at the "Fun with Shapes!" demo which has a Minigame at the end with shape collision

        1 Reply Last reply Reply Quote 1
        • R
          Rex9000 last edited by

          I'll try it, thank you for being very supportive.

          1 Reply Last reply Reply Quote 1
          • Dave
            Dave Fuze Team last edited by Dave

            If you're just wanting to see if that shape has reached a box, an if statement will work too:

            if circY + radius > boxY + boxHeight and
               circX + radius > boxX and
               circX + radius < boxX + boxWidth
            then
                // do your collision stuff   
            endif
            

            This is dependent on where the origin point for your shapes are. If you're using the box() function, this top left.

            The drawShape() functions used in the "Fun With Shapes" demo pointed out by @pianofire allow you to do all sorts of awesome things with shapes with ease. Well worth checking out! Some of the help pages for those functions are missing examples, but they're coming in a future update!

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