Log In  


I have this code,
poke(0x5f2d, 1)
mset(oldposx,oldposy,oldtile)
oldposx= flr(stat(32)/32) + 8 + flr(player.camx / 3)
oldposy= flr(stat(33)/10,10) + flr(player.camy)
oldtile= mget(oldposx,oldposy)
mset(oldposx,oldposy,1)

The tile doesn't change at the mouse's location.

1


This code snippet lacks context to get fixed.
stat(32) and stat(33) are in pixels, if you are displaying the map with map() at 8 pixels per tile, flr(stat(32)/8) makes sense, and flr(stat(32)/32) doesn't, unless you're doing some kind of scaling with tlines, in witch case we definitely need more of your code to figure it out and help you.
flr(stat(33)/10,10) makes even less sense to me, as flr(value) takes only one parameter.
I'd advise to use printh to log the values of oldposx and oldposy, as they are likely not what you expect them to be.

Cart #rihapudibe-0 | 2024-03-18 | Code ▽ | Embed ▽ | No License


here's a minimal example that changes the tile under the mouse.

poke(0x5f2d, 1)
while (true) do
   map()
   x=stat(32)\8
   y=stat(33)\8
   tile=mget(x,y)
   tile+=1
   if tile==17 then
     tile=1
   end
   mset(x,y,tile)
   flip()
end

Sorry I'm new to Pico 8. You’re solution works perfectly! Thanks



[Please log in to post a comment]