I'm creating a RPG game, I need to create a monster respawn area like the Pokemon games where if I walk through the long grass areas a Pokemon can appear. I already created the battle scene, I've seen examples of tile collision with solid objects but I don't know how create a collision action with passable objects.
|
I suppose you could call it a collision, but it's more like an intersection. You can create a trigger zone that activates when the player enters it. A simple way of doing that would just create a list of these zones, then check to see if the player is inside them every frame or when the player moves. A zone is just two points, a min and a max. Then you can check when something is inside like so:
|
|||
|
|
Finally i got how create the respawn zone, i create 2 arrays of tmxmap objects and extract is properties in the example i create wall(unwalkable zone) and isMonsterRespawn zone, where if the player collide with that zone certain action happens, in my example case the respawn zone change the color tile. There i can set an action that cant send my character to the battle scene with a randomly chance:
|
|||
|
|
