Jump to content

Enemy ai in 2d platformer. Check tile


booozaqa
 Share

Recommended Posts

Hi!  :)

I'm use arcade physics in my game. After adding enemies in world, need to revive him : ) In update method, i change enemy.body.position to make him moving. Checking if enemy collide with worlds bounds then swipe direction. But i have problem. How i can check tile before enemy is drop down? I have one tile map, and two layers. Background layer and collision layer. So i figure out that tilemap have method hasTile which take three parameters x,y - tile coordinates, and layer. Can you please give me example how to convert worlds coordinates in pixels to coordinate in tiles and how to correctly use map.hasTile()? Sorry for my terrible English  :ph34r:

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...