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.
This is what I use for drawing the map and updating.
function draw_game()
map(0,0,0,0,16,16)
update_map()
draw_house()
draw_cows()
cow_grazing_anim()
draw_cursor()
print("⧗:"..game_time,60,8,1)
end
function update_map()
for g in all(grass) do
mset(g.x,g.y,g.s)
end
end
|
And I use this to check with mget, it returns all the same sprite number.
if btnp(4) then
--state=2
local t=mget(to_grid(cs.x,cs.y))
printh("x:"..cs.x.."y:"..cs.y..",spr:"..t)
end
|
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#81462 2020-09-03 04:03





  1 comment