# Mr Weird Guy

Member Since 30 Jul 2009
Offline Last Active Jul 22 2012 10:08 PM

### In Topic: Preventing secluded rooms

22 July 2012 - 10:08 PM

I just can't figure out a working algorithm, so I think I'm gonna opt for the easier but more time-consuming method: Manually creating like 50-100 different path setups, and just having the game create paths based on the setup chosen. Time consuming, sure. But at least it'll 100% prevent secluded rooms.

### In Topic: Preventing secluded rooms

20 July 2012 - 05:35 AM

First off, I guess I should have explained that in this 4x3 grid of rooms, there are only straight paths.
Also, (kinda important) an instance of the object that runs this code is created for each room in the map, meaning 12 total.
The first lines of the code randomly add paths to each side of the room.

So if a room's paths are set to
hallN = 0; hallE = 1; hallS = 1; hallW = 0;
it would look like this.
```+-----+
|     |
|  A  ---
|     |
+--|--+
|```

What I don't get is how you actually connect rooms depending on those variables and arrays. The second piece of code looks to ensure that two adjacent rooms have openings on the facing side each other:

Yeah, that's correct.

But what happens if they aren't next to each other?

The code in the alarm to connect rooms only checks other rooms that are adjacent to it, so it never checks a room that is not adjacent.

Also, how do you handle the case that two rooms are adjacent but have no opening at the shared edge?

Every space in the grid is filled with a room; there are no blank spaces. Every room will have adjacent rooms.
If I connected every adjacent room, it would look like this:
```+-----+ +-----+ +-----+ +-----+
|     | |     | |     | |     |
|  A  ---  B  ---  C  ---  D  |
|     | |     | |     | |     |
+--|--+ +--|--+ +--|--+ +--|--+
|       |       |       |
+--|--+ +--|--+ +--|--+ +--|--+
|     | |     | |     | |     |
|  E  ---  F  ---  G  ---  H  |
|     | |     | |     | |     |
+--|--+ +--|--+ +--|--+ +--|--+
|       |       |       |
+--|--+ +--|--+ +--|--+ +--|--+
|     | |     | |     | |     |
|  I  ---  J  ---  K  ---  L  |
|     | |     | |     | |     |
+-----+ +-----+ +-----+ +-----+```
Which is fine, and it does happen from time to time, but this (below) is a much more interesting map:
```+-----+ +-----+ +-----+ +-----+
|     | |     | |     | |     |
|  A  ---  B  | |  C  ---  D  |
|     | |     | |     | |     |
+-----+ +--|--+ +-----+ +--|--+
|               |
+-----+ +--|--+ +-----+ +--|--+
|     | |     | |     | |     |
|  E  ---  F  ---  G  | |  H  |
|     | |     | |     | |     |
+-----+ +-----+ +--|--+ +--|--+
|       |
+-----+ +-----+ +--|--+ +--|--+
|     | |     | |     | |     |
|  I  ---  J  ---  K  ---  L  |
|     | |     | |     | |     |
+-----+ +-----+ +-----+ +-----+```

### In Topic: Collision Masks don't flip?

05 May 2012 - 12:45 AM

Oh yeah, that's what the problem was. I didn't realize image_xscale existed, so in its place I made a variable called enemyFacing. I changed it, and it works perfectly.
Man, so many unnecessary headaches on so many different projects because of one oversight. Thanks for the help.

### In Topic: Collision Masks don't flip?

04 May 2012 - 05:44 PM

I'm pretty sure Game Maker auto-flips masks when you use the actual sprite as the mask, but not when you use a different sprite for the mask. And I'm not sure how my code would cause it to not flip; it's just a simple collision event with the player.

### In Topic: Having trouble understanding arguments

01 May 2012 - 05:00 AM

Wow, it was really that simple. I guess I was just overthinking it. Now that I finally understand arrays, I feel like a huge window has opened up for me.
Thanks, this topic's been a great help, even if it did make me look a little stupid. :V