PDA

View Full Version : to disable a world event?


BranZR2
03-30-2006, 02:41 PM
When a car hits a cone, i want to disable the car from moving;
therefore, the arrows should no longer move the car. Any suggestions?

the car is moved by the arrow keys which are assigned as worldevent2.

jcaristi
03-31-2006, 10:30 AM
It doesn't seem like you can dynamically create or disable events (I couldn't figure out how to do it, anyway). But if you're willing to perform a magic trick, it can be done anyway:

Create a second car, put it anywhere and make it invisible. Then create a method that's called when the first car hits the cone that makes the invisible car orient to the first car, move to the first car, and then, together, makes the first car invisible and the second car visible. From then on the user's arrow keys will only affect the invisible car and the visible one will just sit there. In true magician style, you could also add a puff of smoke to obscure the visible/invisible transition.

gabe
03-31-2006, 11:32 AM
That's a great workaround to a problem that has come up a few times in the past. As far as I know (as you said), you cannot create/disable events dynamically, so this solution is pretty cool. Especially the puff of smoke bit...magic makes everything better. :cool:

Jeremy
04-27-2006, 07:41 PM
That's a great workaround to a problem that has come up a few times in the past. As far as I know (as you said), you cannot create/disable events dynamically, so this solution is pretty cool. Especially the puff of smoke bit...magic makes everything better. :cool:

Yeah, you can't disable the USE ARROW KEYS TO CONTROL event. All newbies go right to that event and start dreaming about making their next game. I tell my students that in general, that particular event is useless in real games. There's no way to actually modify the "guts" of that event. You have to take it or leave it.

If you look at the flight simulator demo that comes with Alice, that has some good ideas on controlling motion. Then you could use a function to help you neutralize an specific key event.

Lets say I make a function called crashIntoACone which returns true or false (or 1 or 0), then in the key I've programmed to move forward, i would do:

if (crashIntoACone = false)
car move forward

Just an idea...