Alice Community  

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

Reply
 
Thread Tools Display Modes
How do i create a counter?
Old
Rookie
Guest
 
Status:
Posts: n/a
Default How do i create a counter? - 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!
   
Reply With Quote
How to Create a Counter (Beta Version)
Old
AshtonThomas
Guest
 
Status:
Posts: n/a
Default How to Create a Counter (Beta Version) - 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

Last edited by AshtonThomas; 07-03-2009 at 09:41 AM. Reason: changed title to reference beta version
   
Reply With Quote
Old
Rookie
Guest
 
Status:
Posts: n/a
Default 07-03-2009, 09:28 AM

Hey what Alice do you have? cuase i couldn't find the "myscene"
   
Reply With Quote
Old
AshtonThomas
Guest
 
Status:
Posts: n/a
Default 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
   
Reply With Quote
Reply

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 ©2021, Carnegie Mellon University
Alice 2.x 1999-2012, Alice 3.x 2008-2012, Carnegie Mellon University. All rights reserved.