Alice Community  

Go Back   Alice Community > Alice 2 > How do I...?

Thread Tools Display Modes
Conditional Collision
Sir Longfellow
Junior Member
Status: Offline
Posts: 1
Join Date: Nov 2011
Default Conditional Collision - 12-11-2011, 09:50 PM

Before I ask my question I'll lay out what I'm trying to do. Basically, what I want to do is have a car drive a given amount of time, in one direction, with various objects in the way. The user of the program will be able to move the car side to side with the arrow keys in order to avoid these obstacles. Once they have driven through the whole "course" then the game will end and ask if they want to play again.

What I want to know how to do is how to make the car stop and the game end when it touches or "collides with" another object. I put in an if statement saying something like "if car is within x distance of object move back .2 meters", but it just passes through.
Reply With Quote
Senior Member
GameKid's Avatar
Status: Offline
Posts: 467
Join Date: May 2011
Location: My magnificent castle
Default 12-11-2011, 11:43 PM

Do mind that in distance to functions, it means the center, not the rim. As for the distance, I reccomend the subject's width. For example, to run into a building, If car distance to building<Building's width, end game.

[COLOR=e4eaf2]Your text here[/COLOR]
Come on, you know you want to try it.
Reply With Quote
possible help
Senior Member
AliceMaster00's Avatar
Status: Offline
Posts: 167
Join Date: Oct 2011
Location: You know that gap between the bottom of your dresser and the floor? Yeah, there.
Smile possible help - 12-12-2011, 12:22 AM

I suggest that you put 'if car is 2 meters of building move back 0.1 meter 0.1 secondds abruptly.' Once you've done that then create an event that says 'While camera is within 2 meters of building is true
During:Camera move back 0.1 meters 0.1 seconds abrubtly.

What a piece of work is a man? How noble in reason, how infinite in faculties, in form and in motion, how express and admirable how like an angel! What apprehension oh how like a god! The beauty of thee world, the paragon of animals, and yet- to me, what is this quintessence o' dust? Man delights, not me. Nor woman either, nor woman either.
Reply With Quote

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

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