microStudio Collisions with tiles
my simple case for collision with tiles is very simple I use this simple code for do it:
// detect collision with tiles and back xy if it
local currentTile = maps["map"].get(floor((player.x+768/2)/32),floor((player.y+512/2)/32))
for collideSprite in collideSprites
if (currentTile.startsWith(collideSprite)) then
player.x = oldx
player.y = oldy
end
end
this code paste to end of update function
declare vars:
local oldx = player.x
local oldy = player.y
local collideSprite = ""
declare list of sprite names to collide with
collideSprites = ["kust","baker","butchers","postoffice"]
Thats it !
Original subj about it in http://jkeks.ru/jkeks.ru/archives/20580