Collision Polygons for Dungeon-Rooms

0 favourites
  • 4 posts
From the Asset Store
Build Social Apps, Chats and Advanced Lists using Firebase Realtime-Database
  • 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 can?t 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!

  • 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.

  • place some empty sprites over the doors?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)