I have my tiles working correctly thanks to you two
on Created:
PHP Code:
function isBlocking(tile) {
temp.blocktiles = {0,16,1024,1025,1026,1027,1028,1029};
return (tile in temp.blocktiles);
}
And the check:
PHP Code:
if (!isBlocking(tiles[player.x+1.5,player.y+3])){
player.y += 1;
}
So if the player is not touching the blocking tiles, the player will fall
(for platformer system)
Now I want to go advanced and make collision with certain NPCs..
So I was wondering if someone could help me write this.
The NPC
PHP Code:
function onCreated(){
this.blocking = true;
setShape(1, 32, 32);
setImg("block.png");
}
The on Created:
PHP Code:
function isBlocking(tile) {
temp.blocktiles = {0,16,1024,1025,1026,1027,1028,1029};
return (tile in temp.blocktiles);
temp.blocknpc = //Check if the temp.npc.blocking == true
}
The check:
PHP Code:
if (!isBlocking(tiles[player.x+1.5,player.y+3])){
if /*not colliding with npc that is blocking*/ {
player.y += 1;
}
}