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.

P#143599 2024-03-17 23:57 ( Edited 2024-03-18 00:23)

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
P#143725 2024-03-18 17:23 ( Edited 2024-03-18 17:34)

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

P#143738 2024-03-18 18:19

[Please log in to post a comment]