Navigation

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

    Query about setdrawtarget and map collision

    Beginners
    4
    8
    287
    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.
    • SteveZX81
      SteveZX81 F last edited by SteveZX81

      One of my many projects I'm working on is a game that looks like its running on a ZX Spectrum, but I have something that I don't seem to grasp (that's not new with me) my main loop is thus

      loop
      clear()
      setdrawtarget(screen)
      drawmap()
      setdrawtarget(framebuffer)
      drawimage(screen,200,5,3.5)
      collide()
      updatesprites()
      drawsprites()
      update()
      repeat

      and if I run that, the player - map collision does not work at all. (btw collide is simply a function that tests for map collision and moves the player down if there is none)

      yet if I comment out these two lines
      setdrawtarget(screen)
      setdrawtarget(framebuffer)

      then map collision works and my little guy doesn't fall through the ground.

      What's the reason it's not working with setdrawtarget?
      (yes, I am fully aware than yet again the answer is going to be simple and make me look a fool. so be it)

      Thanks folks

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

        @SteveZX81 collidemap()
        or detectmapcollision(sprite)

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

          my collide() function is

          function collide()
          col = detectmapcollision(player)
          if !col then player.x += 2 endif
          return void

          yeah, as simple as it gets.

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

            i can share my project if you want its still very basic but it might have what your looking for, its got a sprite with collison?

            1 Reply Last reply Reply Quote 1
            • M
              Maxwello F last edited by Maxwello

              What about moving the collide function above the other 2? (that you said it works when they are //)

              SteveZX81 1 Reply Last reply Reply Quote 1
              • SteveZX81
                SteveZX81 F @Maxwello last edited by

                @Maxwello said in Query about setdrawtarget and map collision:

                What about moving the collide function above the other 2? (that you said it works when they are //)

                Tried that already and it was the same but thanks anyway.

                @waldron said in Query about setdrawtarget and map collision:

                i can share my project if you want its still very basic but it might have what your looking for, its got a sprite with collison?

                Thanks but that really would only be helpful if its map collisions and you are using setdrawtarget? :)

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

                  I think that this may be related: https://fuzearena.com/forum/topic/722/moving-maps/9. I will take a look later

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

                    Pianofire mate, it's really not that important it's only a minor project I'm tinkering with.

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