View Full Version : How do i create a counter?
Rookie
07-02-2009, 10:21 AM
Hi, i'm doing a climbing game and i've assigned an event that when you click on an icon the person climbs. Nevertheless i want there to be a counter that makes record of everytime the person climbs (or everytime the icon is clicked on) once i have this what i want is to do an if-else command so i can make the person stop clibing after a certain number of clicks. Please help!
AshtonThomas
07-02-2009, 02:48 PM
Here is one way that might work for you:
In the Edit Screen (Right below all the "do in order, count, while for each.."
Click on: "class: MyScene v"
hover over "MyScene"
go to "Edit Properties"
click (top right) "Declare Property"
Set "Value type" to Integer
Give it a name {maybe "counter"}
"initialize" to 0
Click "ok" to finish
THEN*
click on "class: MyScene V" (again)
hover over "MyScene"
go to "Procedures(#)"
click on "Declare Procedure"
name it "increment_counter" or something like that
THEN *
in the object selector tree thingy (don't know all the proper names...)
click on "this (a.k.a. scene)"
select "Properties" tab (below)
drag the "this (a.k.a. scene).counter <== (???)" into the "increment_counter" code area
hover over "Math"
hover over "arithmetic{ stuff }"
hover over "counter"
hover over "this.counter + (???)"
hover over "1"
Ok, so you are going to go through many popout menus and it may be kinda difficult but you can do it
seems like the Alice team is working with a lot of limitations with User Interface and all the available options but this seems to be a good way to do this.
so now you can just call the "this(a.k.a. scene).increment_counter (procedure)
and it should keep track. to test you can just you can call it a few times and then have a person object "say" and put the "counter" as the thing to say
let me know how it goes
happy 4th of july (for those celebrating:)
Rookie
07-03-2009, 09:28 AM
Hey what Alice do you have? cuase i couldn't find the "myscene"
AshtonThomas
07-03-2009, 09:38 AM
I just downloaded the latest beta version
you probably don't have the ability to change the scene yet.
what version are you using?
you need to be able to create a variable/property and then create a method/procedure to increment