Collision Polygons for Dungeon-Rooms

Get help using Construct 2

Post » Wed Aug 29, 2012 7:11 pm

Hey guys,

i now searched the whole forum up and down and found nothing suitable for my problem.

Im doing a little top-down-game with some predefined "rooms" which i created in a graphics-program. Each of the rooms has an entrance and an exit. Now at the beginning of my game a dungeon is randomly generated: The game picks a few of the predefined rooms and arranges them together, so there is a small corridor between two adjacent rooms.

Everything is working quite fine, but my problem is the collision of the player with the walls of the rooms.
Due to the fact, that there are two doors in each room, i cant arrange the collision-polygon properly: i want the player to collide with the walls of each room, but he should be able to use the entrance and exit and the corridors between two rooms. That means the collision-polygon must be open at two positionsin each room. How can i do this?

Is it possible to add a second collision-polygon to an object or how can i achieve this kind of collision?

Thank you.
Greetings!JkerryZ2012-08-29 19:44:55
B
5
S
1
Posts: 5
Reputation: 815

Post » Thu Aug 30, 2012 1:53 pm

Ahh,

I think I understand. So effectively, the room is a solid sprite, but because it has 2 doors it needs 2 collision polygons, which you can't do.

What I would do is have the room sprite built in two halves, and give each half its own collision polygon. Then have an event that will only call in one half to build the dungeon, and another code that spawns the other half of the room onto the first half if it is recognised in the layout using a for each command.

Hope that makes sense.
@bearboxmedia
www.bearboxmedia.com

Nintendo Wii U Developer using Construct 2
B
68
S
8
G
6
Posts: 931
Reputation: 9,360

Post » Thu Aug 30, 2012 1:56 pm

place some empty sprites over the doors?
B
69
S
21
G
15
Posts: 701
Reputation: 15,629

Post » Fri Aug 31, 2012 1:11 pm

Allright, thank you guys!

AnD4D, thats it. Its working fine. Thank you.

Ianceal, i just couldnt figure out how this could be working. I tried some variations of it, but without any results.

Well, thanks again, its running now.. Yeah!
B
5
S
1
Posts: 5
Reputation: 815


Return to How do I....?

Who is online

Users browsing this forum: farfetchd83, Laurent, makkancs and 28 guests