Alice Community

Alice Community (http://www.alice.org/community/index.php)
-   Questions and Comments (http://www.alice.org/community/forumdisplay.php?f=9)
-   -   Collision ON/OFF (http://www.alice.org/community/showthread.php?t=11276)

chrytobug 08-25-2015 08:01 PM

Collision ON/OFF
 
I am creating a first person game set in a museum. There are various themed rooms the player moves around in during the game. I have set up a simple collision detection using a list of objects enabled by a While world is running event. If I want the camera to move to another room at the completion of the level, do I have to turn the collision detection off, move the camera, then turn the collision detection back on again or can Alice execute the camera move without the necessity of the collisionON/OFF option.

Thanks for taking time to answer my question.
Chrytobug

CodeMan 08-26-2015 05:07 AM

I did this before in one of my FPS's, its pretty simple.
If there is something that can stop your while loop just turn that off and the collision goes off, and then turn it back on and the collision comes back on.

Also I would suggest using lists for each room and just turning on the room you are in.

Best of luck and if you need any more help I could post a demo or something :)

-RavenOfCode

MrMoke 08-26-2015 07:45 AM

Codeman is correct. The simple solution is to create a Boolean on/off switch, and then insert an if/else statement into your while loop that checks it for true/false before scanning the list.

chrytobug 08-27-2015 10:38 PM

Oh good! It sounds like I am on the right track. I created lists of objects for each level/room in the game, the collision detection checks a level number variable that indicates what level the player is on. If the player is one level 1, the method selects the level 1 objects list to use in collision detection. The collision detection is set up with a Boolean variable collisionOn. If the variable is true, then the collision detection checks the level and uses those objects to "bounce"off of. When the player moves to the next level, the moveToLevel method turns off the collision detection, then turns it back on when the camera is in the new location/room.

Thanks for answering my question! I hope to share my work when I complete my game next week. :)

chrytobug


All times are GMT -5. The time now is 11:36 AM.

Copyright ©2020, Carnegie Mellon University
Alice 2.x 1999-2012, Alice 3.x 2008-2012, Carnegie Mellon University. All rights reserved.