Lol, that's the weird thing. It should work, but doesn't.
var name = GetInputPerson();var x = Math.floor(GetPersonX(name) / 16);var y = Math.floor(GetPersonY(name) / 16);var position = "(" + x + ", " + y + ")";
function Movement(){ var Player = GetInputPerson(); if (!IsCommandQueueEmpty(Player)) return; var x = Math.floor(GetPersonX(Player) / 16); var y = Math.floor(GetPersonY(Player) / 16); if (x < 0 || y < 0) return; TileName = GetTileName(GetTile(x, y, 0)); NextTileName = GetTileName(GetTileInFront()); var Command = null; //Start defining keys here if (IsKeyPressed(KEY_UP) ) { Command = North; QueuePersonCommand(Player, FaceNorth, true); } if (IsKeyPressed(KEY_DOWN) ) { Command = South; QueuePersonCommand(Player, FaceSouth, true); } if (IsKeyPressed(KEY_RIGHT)) { Command = East ; QueuePersonCommand(Player, FaceEast, true) ; } if (IsKeyPressed(KEY_LEFT) ) { Command = West ; QueuePersonCommand(Player, FaceWest, true) ; } IgnoreTileObstructions(Player, false); if (NextTileName == "obstruct_n" || NextTileName == "obstruct_nw" || NextTileName == "obstruct_ne" || TileName == "obstruct_n" || TileName == "obstruct_nw" || TileName == "obstruct_ne") { IgnoreTileObstructions(Player, true); } if (Command == North && (TileName == "obstruct_n" || TileName == "obstruct_nw" || TileName == "obstruct_ne")) { Command = null; } if (Command != null && !IsObstructed(Player, Command)) { for (var i = 0; i < 16; ++i) { QueuePersonCommand(Player, Command, false); } } }