Alice Community

Alice Community (
-   How do I...? (
-   -   Keeping Track (

XSesshomaruX 02-23-2006 07:37 PM

Keeping Track
Well, like i've mentioned before, i'm making a game with every day people and everyday Giant Fire hydrants:D The reall problem is, when you shoot someone or something, the revolver reacts by turning backwards and forwards. Is there anyway that every time like someone is clicked on can there be a way to keep track of points?:confused:

chuck 02-27-2006 04:29 PM

Whay about an an event handler?
I'm not sure of your programing experience, so please don't be insulted if the following seems obvious, but I hope it helps.

In event driven programming a true event consists of an event trigger and an event handler. An event trigger is the condition that causes an event to occur. An event handler is a method that runs whenever the trigger occurs. Events can often take the place of complicated or convoluted logic in a program.

I suggest you combine an Alice event that checks for the trigger with an Alice method to handle what happens when the trigger occurs. In your particular case, you could:

1. Set up a method to do whatever you want to do when the mouse is clicked on a particular object. To keep score, you could set up a variable as a property of an object, or as a property of the world itself. When the method runs, the score varibale could be incremented or otherwise changed.

2. Set up an event of the form:
When the mouse is clicked on (something) do (method name)

Put the object in place of (something) and the method described
above in place of (method name).

The method coud do one thing, do several things, or call other methods from within itself, which would be the proper way to layer software modules.

You could also set up an event of the form:

When something is true

to cause whatever actions you desire when the score variable reaches a certain value.For example:

When (score > 100) becomes true, do (world.victory)

Chuck Herbert

All times are GMT -5. The time now is 01:58 AM.

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