Is it possible to use tilemap for collision based events?

Just started using Construct 2? Post your questions here

Post » Tue Jan 27, 2015 10:02 am

Hi guys.

I am creating an RPG style game that uses tilemaps for it's graphics. For example I have trees and rocks that the player cannot walk through, I have pokemon style grass that have a random chance of starting a battle when walked over, I have doors and entrances that act as links to new rooms/layouts.

Right now I can do all of this easily and accurately by creating invisible sprites and placing them exactly over the relevant tiles, then tying the events to collision of the invisible sprites. The problem with this, of course, is that I actually have to keep creating and placing all these invisible sprites, this takes time and it would be easy for me to make mistakes, placing them incorrectly or forgetting to place them in places!

So yes. It would be extremely useful if I could tie an event or behavior to each tile in the tilemap, following the above examples, I would make all tree tiles have a solid behavior so the player cannot enter that tile.
B
4
Posts: 22
Reputation: 244

Post » Tue Jan 27, 2015 11:46 am

Why not have multiple tilemaps on different layers that can represent different scene objects as well as collisions.
If your vision so exceeds your ability, then look to something closer.
Moderator
B
134
S
30
G
84
Posts: 5,375
Reputation: 58,432

Post » Tue Jan 27, 2015 11:57 am

I do it the same way. I have the background as tilemap and then I draw transparent collision-boxes on houses, fences, rocks,... on a different layer. If you use "snap to grid" it is not to bad nut yes it is work to do. You might be able to solve it with a automated loop something like: for each tilemap = gras spawn transparent collision box on same position. This would save work but at the end there will be some more objects that could end up in a little performance loss.
B
34
S
9
G
3
Posts: 206
Reputation: 7,851


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 0 guests