Here are 2 ways I can think of for handling each section but I'm not sure what would be the most efficient and easiest to work into my game
Firstly handling collisions
Quote:
Idea 1:
The same way it's done in the tutorial on the wiki, where you have a block class that holds a rectangle then iterate through all those blocks
Idea 2:
Translate the players position into world coords then depending on which key is pressed check the adjacent tile on the collision layer in the .tmx file returning true or false?
(this would require a lot less code and GUESSING would be less intensive as it wouldnt have to iterate through a loop every update call)
Next handling npcs
Quote:
Idea 1:
Draw the (static) npcs in the Tiled map on a new layer and make those tiles non-passable
Idea 2:
Set the npcs on an object layer and iterate through them when checking for collisions