Navigation

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

    Some questions about collideSprites...

    Beginners
    8
    37
    1714
    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.
    • waldron
      waldron F @vinicity last edited by

      @vinicity i only figured the sprite collision thing last week, before i was just using true/false didn't know you could link events triggers ect been a big 1 -UP for my code since

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

        @waldron said in Some questions about collideSprites...:

        @vinicity i only figured the sprite collision thing last week, before i was just using true/false didn't know you could link events triggers ect been a big 1 -UP for my code since

        Link events triggers? That sounds interesting. Care to elaborate a bit?

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

          @vinicity
          collide1 = collidesprites(sprite.plr,sprite.boss)
          collide2 = collidesprites(sprite.plr,sprite.door)
          if collide1 or collide2 then
          (stuff happens)
          endif

          you can also add in stuff like boss health and have triggers on his/her health level. then you got else statements ect.

          i only figured this after playing Steve's Row ya boat :) cheers Steve

          i can add to this later

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

            in Fact il cover it in my next video tutorial, iv sorted the quality in my last test so youl be able to actually see the code :) il cover sprite collisions and triggers wrapped in a simple boss fight program. il aim for next week to make and release it

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

              @waldron said in Some questions about collideSprites...:

              @vinicity
              collide1 = collidesprites(sprite.plr,sprite.boss)
              collide2 = collidesprites(sprite.plr,sprite.boss)
              if collide1 or collide2 then
              (stuff happens)
              endif

              you can also add in stuff like boss health and have triggers on his/her health level. then you got else statements ect.

              i only figured this after playing Steve's Row ya boat :) cheers Steve

              But how does that even work? collide1 and collide2 are not booleans (or actually integers; I know Fuze does not have proper bools), but structs? How can you test a struct in an if clause just like that?

              I would have thought you would need something like:

              collide1 = collidesprites(sprite.plr,sprite.boss)
              collide2 = collidesprites(sprite.plr,sprite.boss)
              if collide1.exists or collide2.exists then
              (stuff happens)
              endif

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

                @vinicity sorry the second collision is supposed to be sprite. plr , sprite.door)

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

                  then if collide1 then//it already reads the collision between sprites because of the collidesprites function, the collide1 is just calling it

                  im guessing if you don't call if it exists then its at its default ??
                  il have to check when im home but works

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

                    Are you saying that once you have called collideSprites() once, you can then test the resulting struct multiple times, and that it will update depending on whether the collision has occurred or not? So the collideSprites() call does need to be inside the game loop?

                    I must test this tonight, but I think it sounds a bit strange...

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

                      @vinicity i have it in my main loop yes, il double check also when home but works. i use it to collect sprites move sprites all sorts

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

                        I am also confused by this collidesprites returns a struct. If I treat it as a condition (bool) it seems to always be true. Interestingly if I try to negate it using ! I get an error. Are you sure that this works?

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

                          @pianofire ok so i shouldn't write code without seeing it, i have
                          for i = 0 to len(sprite) loop
                          collide1 = detectspritecollision (sprite,coins[i])
                          if collide1 then
                          (stuff)
                          endif
                          repeat

                          1 Reply Last reply Reply Quote 1
                          • Retrocade_media
                            Retrocade_media F last edited by

                            For checking if it's true I always just use detectspritecollision(spr1,spr2). All it returns is a true or false statement

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

                              i missed that part detect....

                              1 Reply Last reply Reply Quote 1
                              • vinicity
                                vinicity F last edited by

                                That explains it!

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