Advertisement
fedexist

testmap

Aug 25th, 2014
243
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.56 KB | None | 0 0
  1. function Player.TestMap(x, y)
  2.    
  3.     local current_location = gamestate.current().layers[1]
  4.     local tileheight, tilewidth = gamestate.current().tileheight, gamestate.current().tilewidth
  5.    
  6.     actual_position = vector(Player.position.x + 36.5, Player.position.y + 97) --valori numerici apposta per la sprite usata
  7.    
  8.     if current_location[math.floor(actual_position.x/tilewidth)+x][math.floor(actual_position.y/tileheight)+y]~=0 then
  9.         return false   
  10.     return true
  11. end
  12.  
  13. --[[
  14. if love.keyboard.isDown("up") then
  15.     if TestMap(0,-1) then
  16.         -- allow update position
  17.     end
  18. end
  19. ]]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement