Alice Community  

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

Reply
 
Thread Tools Display Modes
One time actions
Old
General Yayap
Guest
 
Status:
Posts: n/a
Default One time actions - 12-13-2008, 10:29 PM

In the game I am trying to make with Alice if you click on the handle of the lever it lowers to the ground and another action happens as a reaction. But then if I click it again it all happens again.

How can I make it so that after the first time I click on something the action is disabled?
   
Reply With Quote
Old
RockyTheConcreteDonkey
Guest
 
Status:
Posts: n/a
Question 12-14-2008, 09:20 AM

I have the same problem with my games as well but I dont think there is a solution that dosent invole setting the 'is showing' to false... Have you tried different key presses; SPACE= command 1, SHIFT= Command 2
   
Reply With Quote
Old
Chris101b
Senior Member
 
Chris101b's Avatar
 
Status: Offline
Posts: 361
Join Date: Jun 2007
Default 12-14-2008, 12:36 PM

Below is a world I made to test this and it works. Basically I told the program this:

That when you click on the switch, 3 things happen.
1. The switch turns
2. The bunny moves up
3. The "Bounding box" of the box becomes visible

The whole bounding box part is the changing variable. In the if then statement I tell the program that If the bounding box is showing for the box, then nothing happens, but if it isnt, it does the 3 things listed above. Notice #3. It makes the bounding box show. By doing this, it can only happen once. To make the bounding box show, just click on the box and go to its properties. Now click on the plus by "Seldom used properties and the third option is the "isBoundingBoxShowing". In the world, the box can be put under the ground so it is unseen. Hope this helps.
Attached Files
File Type: a2w test.a2w (326.7 KB, 32 views)
   
Reply With Quote
Old
General Yayap
Guest
 
Status:
Posts: n/a
Default 12-14-2008, 01:06 PM

Thanks that helps!
   
Reply With Quote
Old
x2495iiii
Super Moderator
 
x2495iiii's Avatar
 
Status: Offline
Posts: 3,508
Join Date: Dec 2008
Location: Somewhere in the Continental U.S.
Default 12-16-2008, 03:30 PM

you could actually do this with any variable, even a number

assign any variable to the object (for clarity)

then, write the method so that when the object is clicked, the variable is checked by an if/else if statement, if the variable has not changed (meaning it hasn't been clicked), then the action is performed and the variable is changed (number could be incremented, boolean could be set to true, whatever's easiest for you). if the variable HAS changed, do nothing. This way, you don't have to change something visibly to make an object inactive.

Another possibility is you could set the objects seldom used property "isFirstClass" to false after the action is performed, making it impossible to be selected by the mouse
   
Reply With Quote
boleen logic
Old
zonedabone
Senior Member
 
zonedabone's Avatar
 
Status: Offline
Posts: 577
Join Date: Nov 2008
Location: In the interwebs
Red face boleen logic - 12-16-2008, 08:46 PM

Make a world level variable. (name it stated or something) Make sure that you check boleen when creating it. set it to false and put your event within a conditional branch that says if (variable) = false then do this. At the end of the event, make it change (variable)'s value to true.

here's what my world looks like:

My first method:
Code:
If [[world.started]=[false]]
     [[switch.handle] turn [right] [.5] revolutions]
     [[ground] set opacity to [0 (0%)]]
     [[world.started] set value to [true]]
Event plane:
Code:
[When mouse is clicked on [switch], do [world.myfirstmethod]
Attached Files
File Type: a2w switch world.a2w (177.1 KB, 30 views)


'Apple Macintosh' - An anagram of 'Complaints Heap'

M.A.C.I.N.T.O.S.H. - Machine Always Crashes, If Not, The Operating System Hangs.

You're *such* a mac person.
   
Reply With Quote
Reply


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