Navigation

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

    Problems with collisions

    Beginners
    collision help
    7
    36
    2357
    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.
    • Jongjungbu
      Jongjungbu F last edited by

      I have found setSpriteLocation() can override the collision. When using that function, I need to instead detectSpriteCollision(), I think that's the right one, and then move the player myself if detected. It won't naturally block him from moving.

      If using setSpriteSpeed() then follow it with collideSprites(), it will naturally block the player from moving.

      1 Reply Last reply Reply Quote 1
      • landein207
        landein207 last edited by

        But i think with the setspritespeed i can't make playet controls so i probably will need search a bit to find how to use the detectspritecollision :P
        But thanks that helps me a lot and probably in future fuse updates see if is possible correct that problem with the sprite location and sprite colision

        waldron 1 Reply Last reply Reply Quote 1
        • Jongjungbu
          Jongjungbu F last edited by

          I think that works as intended. You have one way, where Fuze detects and you code the effects. Maybe you want to bounce the player or teleport him. The other is use Fuze built-in effect of blocking pathing.

          1 Reply Last reply Reply Quote 0
          • waldron
            waldron F @landein207 last edited by

            @landein207 i think its just a matter of getting used to how you set out code, il be less busy tomorrow if you wanted me to share a program demonstrating how to work with collision ?

            1 Reply Last reply Reply Quote 1
            • landein207
              landein207 last edited by

              Yes plz that may help me

              1 Reply Last reply Reply Quote 1
              • landein207
                landein207 last edited by

                Ok i was testing the controls with setspritespeed instead of setspritelocation the collision works but the movement looks like sliding in ice.
                how can i avoid that effect in the movement?

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

                  I’ve never used setspritespeed, so I don’t know the exact way, but if you ’spritespeed *= 0.8’ at the end of your loop somewhere, that’ll work like friction..

                  1 Reply Last reply Reply Quote 0
                  • landein207
                    landein207 last edited by

                    I think i will open a new topic for that but thank you for the friction 'command'

                    waldron 1 Reply Last reply Reply Quote 1
                    • Jongjungbu
                      Jongjungbu F last edited by

                      If you decide to use setSpriteSpeed(), what you ought to do after the collision event happens is then stop the player from moving yourself.

                      setSpriteSpeed(player,150,0)
                      col = collideSprites(player,wall,false,false)
                      if col.exists then
                      setSpriteSpeed(player,0,0)
                      endif

                      1 Reply Last reply Reply Quote 0
                      • landein207
                        landein207 last edited by

                        @Jongjungbu that code setSpriteSpeed(player,150,0)
                        col = collideSprites(player,wall,false,false)
                        if col.exists then
                        setSpriteSpeed(player,0,0)
                        endif

                        It will make the player get stuck to the wall :P

                        Jongjungbu 1 Reply Last reply Reply Quote 2
                        • waldron
                          waldron F last edited by

                          Iv made a collision demo for you download code NDL89RND5U

                          1 Reply Last reply Reply Quote 3
                          • Jongjungbu
                            Jongjungbu F @landein207 last edited by

                            @landein207

                            Well, I sort of simplified it. But maybe check out waldron's example :)

                            1 Reply Last reply Reply Quote 0
                            • waldron
                              waldron F @landein207 last edited by

                              @landein207 the demo is pending but should be available soon.

                              1 Reply Last reply Reply Quote 0
                              • landein207
                                landein207 last edited by

                                Ok thanks for helping me understanding how collisions work here :)

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

                                  That has been approved

                                  1 Reply Last reply Reply Quote 2
                                  • waldron
                                    waldron F last edited by

                                    Lightning ⚡ fast :)

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

                                      @waldron Express delivery!

                                      1 Reply Last reply Reply Quote 3
                                      • landein207
                                        landein207 last edited by

                                        Ok i just saw the code i understand how to make collisions with setplayerspeed now i think i will try see in another games with setspritelocation controls to see how to make collisions because im trying to make a game like undertale battle fan made that i think would be hard to play with a always moving character but thanks a lot now i know how to work with collidesprites + setspritespeed thank you all for helping me :)

                                        waldron 1 Reply Last reply Reply Quote 3
                                        • waldron
                                          waldron F @landein207 last edited by

                                          @landein207 that's fine that demo was just to demonstrate collision for you. I can update the demo tomorrow to stop the player when not pressing the button and also add in another way to move the player without using the setspritespeed

                                          1 Reply Last reply Reply Quote 0
                                          • landein207
                                            landein207 last edited by

                                            Ok @waldron i was testing with the demo that you gave to me and i was trying to do the controls like this

                                            loop
                                            clear()
                                            plr.show_collision_shape = true
                                            wall.show_collision_shape = true
                                            c = controls(0)
                                            oldc = controls(0)

                                            If c.lx == 0 and c.ly == 0 then
                                            Setspritespeed(plr,0,0)
                                            endif

                                            If c.lx > 0 then
                                            Setspritespeed(plr,100,0)
                                            endif
                                            If c.lx < 0 then
                                            Setspritespeed(plr,-100,0)
                                            endif
                                            If c.ly > 0 then
                                            Setspritespeed(plr,0,-100)
                                            endif
                                            If c.ly < 0 then
                                            Setspritespeed(plr,0,100)
                                            endif
                                            If c.lx > 0 and c.ly < 0 then
                                            Setspritespeed(plr,100,100)
                                            endif
                                            If c.lx < 0 and c.ly < 0 then
                                            Setspritespeed(plr,-100,100)
                                            endif
                                            If c.lx < 0 and c.ly > 0 then
                                            Setspritespeed(plr,-100,-100)
                                            endif
                                            If c.lx > 0 and c.ly > 0 then
                                            Setspritespeed(plr,100,-100)
                                            endif
                                            //the rest of the code

                                            but idk how this happens but looks that the diagonal one override the another one how does that work with out the diagonals override the rest of the controls?

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