thanks. is there a way to say have another clip have all the possible door arrangements of a room to be layered on top of each room so each room can look better while having the rooms have collision?
@Hamzah_Alani
So nice !!!
thanks for sharing your toughs and methods !!!
@gamer_boi
Youâre working on a grid system and itâs likely you breaked apart your clips so collision (hittest) wont be efficient. Itâs probably better to use your character position to know where you are
Yes, it is possible, and yes, the rooms were broken apart in the last file! You can remove the break apart line of code by deleting line 14 of the load script inside of the rooms clip, but you donât need to.
The path objects arenât broken apart, however, which makes it easier to find the possible door arrangements of a room (not to mention an XY array I used that has all of the door locations marked, ârooms.level1.paths
â).
Since there is a path object between every room, you wonât even need to keep track of the room locations after theyâre broken apart.
I agree, the characterâs position will play a major role in determining whether or not
Note
The first room isnât broken, only the clones are, so it could be your starting point as well. You could also find the location of the last room easily, and add an end there, or if you want, we can calculate the distances between all the rooms and the beginning to find the farthest one based on the X and Y values.
Note about broken apart clips
Itâs important to mention that if youâd ever want to change the size of the rooms clip, after the clip is broken apart, you will find that the path objects inside of the clip didnât change size.
For this reason, if you want to change the size of the rooms, youâll have to go inside of the actual rooms clip and change the size from there rather than from the projectâs timeline.
Thereâs no need to detect the room, if you were to snap the rooms to grid based on their width, then you can have a create a wall clip thatâs snapped on the same grid based on the x and y of the player, and rooms.level1.paths array should return the x and y values of all âdoors,â so if you were to also snap a clip based on the width of the grid divided by two, based in the playerâs x and y as well, and check if the rooms.level1.paths array has the x and y of that clip, then check if the player is touching that clip (make sure to give it a reasonable width+height), then youâd know whether or not the player is inside of a path.
My Project11-24-2022_22-15-42.wick (4.4 KB)
(^ note that this project is a bit buggy+rushed, itâs only an example of how to detect rooms for collision)