kristalize [Lexaloffle Blog Feed]https://www.lexaloffle.com/bbs/?uid=26138 Mget returning same sprite <p>I generated a map and use mset to update the sprites on the map. But when I tested to print out the sprite number using mget and the coordinates of my cursor, it always returns the same sprite number. I am confused about where I did wrong. </p> <p>This is what I use for drawing the map and updating. </p> <div> <div class=scrollable_with_touch style="width:100%; max-width:800px; overflow:auto; margin-bottom:12px"> <table style="width:100%" cellspacing=0 cellpadding=0> <tr><td background=/gfx/code_bg1.png width=16><div style="width:16px;display:block"></div></td> <td background=/gfx/code_bg0.png> <div style="font-family : courier; color: #000000; display:absolute; padding-left:10px; padding-top:4px; padding-bottom:4px; "> <pre>function draw_game() map(0,0,0,0,16,16) update_map() draw_house() draw_cows() cow_grazing_anim() draw_cursor() print(&quot;⧗:&quot;..game_time,60,8,1) end function update_map() for g in all(grass) do mset(g.x,g.y,g.s) end end </pre></div></td> <td background=/gfx/code_bg1.png width=16><div style="width:16px;display:block"></div></td> </tr></table></div></div> <p>And I use this to check with mget, it returns all the same sprite number.</p> <div> <div class=scrollable_with_touch style="width:100%; max-width:800px; overflow:auto; margin-bottom:12px"> <table style="width:100%" cellspacing=0 cellpadding=0> <tr><td background=/gfx/code_bg1.png width=16><div style="width:16px;display:block"></div></td> <td background=/gfx/code_bg0.png> <div style="font-family : courier; color: #000000; display:absolute; padding-left:10px; padding-top:4px; padding-bottom:4px; "> <pre>if btnp(4) then --state=2 local t=mget(to_grid(cs.x,cs.y)) printh(&quot;x:&quot;..cs.x..&quot;y:&quot;..cs.y..&quot;,spr:&quot;..t) end </pre></div></td> <td background=/gfx/code_bg1.png width=16><div style="width:16px;display:block"></div></td> </tr></table></div></div> <p>I attached an image with the map I draw and the grass sprite should be from 50 to 53 but I get like all 53 or all 52. which is weird. I have attached my cartridge below, would be great if someone enlighten me on what I did wrong. </p> <p> <table><tr><td> <a href="/bbs/?pid=81462#p"> <img src="/bbs/thumbs/pico8_mimazihofu-0.png" style="height:256px"></a> </td><td width=10></td><td valign=top> <a href="/bbs/?pid=81462#p"> the-common-moo-0.1</a><br><br> by <a href="/bbs/?uid=26138"> kristalize</a> <br><br><br> <a href="/bbs/?pid=81462#p"> [Click to Play]</a> </td></tr></table> </p> https://www.lexaloffle.com/bbs/?tid=39473 https://www.lexaloffle.com/bbs/?tid=39473 Thu, 03 Sep 2020 04:03:29 UTC