Query about setdrawtarget and map collision
-
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()
repeatand 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
-
@SteveZX81 collidemap()
or detectmapcollision(sprite) -
my collide() function is
function collide()
col = detectmapcollision(player)
if !col then player.x += 2 endif
return voidyeah, as simple as it gets.
-
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?
-
What about moving the collide function above the other 2? (that you said it works when they are //)
-
@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? :)
-
I think that this may be related: https://fuzearena.com/forum/topic/722/moving-maps/9. I will take a look later
-
Pianofire mate, it's really not that important it's only a minor project I'm tinkering with.