Creature in the room, player is kicked out. Creature in the room and player in closet...the player is okay

My students are working on this CoSpace. The question the students have is regarding Room #1. My students would like the code to make the player/camera to be kicked out to scene #8 when the creature enters and remains in the room. If the player is hiding in the closet, the player is safe. If the creature leaves the room, the player is okay as well.


Here is the link to the CoSpace: CoSpaces Edu :: Doors of the Haunted Hotel

1 Like

Hey @TechWarriors , I made a little mockup. Couple notes: First, Awsome game they made! Give them my compliments.

Second I restructured the run parralel. Before they had an always loop running in it to update the money counter, but this made it so the code would stop there since it can never run past the always loop (and therefore neither the run parralel block as a whole). Instead I put this loop into a “run seperately” block, this will just keep this thing running forever while continueing with the rest of the code.

Then I also removed alot of the events from the run parallel block since these only need to activate once in the code, putting them before the run parralel is generally better practice.
I also removed the “camereAfter” they use after exiting the closet, instead I just set the main camera to the position and orientation they had for the cameraAfter and switch back to that.

Then to make the system work I did two things:
One I made a isSafe variable thats a boolean (simple true/false switch), then set the boolean to true when player enters closet, and false when leaves.
And number two, I made an event that references a “Cuboid” this is actually the wall they use for the monster (I dont use the group ambsuh here because groups dont work with in contact events), that when in contact with the camera IF player is NOT safe, then send to scene 8.

Fun fact, you dont actually need the isSafe variable here; Since we have switched camera’s and only set the in contact event for the original camera. So even without this variable the code would work; However using this variable you could make the player safe whenever you want it let’s say having a special item for instance.

Hope to have helped, and wish them good luck with the game, very curious how it turns out!

(Footnote, I made the monster move immediately by setting their if statement to simply “True” for testing purposes, they will have to set it back to the random prequisite they had originally)


Hey Luc! Thank you so much for your assistance with this. The two students who are working on this project are having an amazing time doing it. They will be so excited to hear such a nice compliment.


Madonna Davis
Davis Tech Warriors

1 Like

Hi Luc!
My student was able to Remix your Remix and his very grateful for your help with this!

You are awesome!!!

Davis TechWarriors

1 Like