Alice Community  

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

Reply
 
Thread Tools Display Modes
NEED HELP: making one action happen at a time when mouse click on something
Old
AllaboutGT
Guest
 
Status:
Posts: n/a
Default NEED HELP: making one action happen at a time when mouse click on something - 12-11-2011, 10:59 PM

hello all i am doing a project making a game: "save the lunch lady"

Basically everytime i click on the object (a ninja) one tray is suppose to appear at a time. click again another tray appears, until 5 trays total have appeared.

I cant give a condition where one tray will appear when i click on the object once! I've tried everything and nothing is working. Everytime i click on the object (a ninja) either all 5 trays appear one right after the other, or just im just able to get the first tray to appear.

How do i get the tray to appear one at a time, each time I click of the same object!?!?

so annoyed been doing this for days and finished everything else just cant get this last step! and the teacher cant figure it out too! she just tells me to keep trying, but the project will be due soon and i cant find help from anyone

Pls help thanks!
Attached Files
File Type: a2w final 2trail.a2w (1.55 MB, 28 views)

Last edited by AllaboutGT; 12-11-2011 at 11:01 PM.
   
Reply With Quote
Old
davidghemer
Member
 
Status: Offline
Posts: 38
Join Date: Nov 2011
Default 12-12-2011, 04:12 AM

Quote:
Originally Posted by AllaboutGT View Post
hello all i am doing a project making a game: "save the lunch lady"

Basically everytime i click on the object (a ninja) one tray is suppose to appear at a time. click again another tray appears, until 5 trays total have appeared.

I cant give a condition where one tray will appear when i click on the object once! I've tried everything and nothing is working. Everytime i click on the object (a ninja) either all 5 trays appear one right after the other, or just im just able to get the first tray to appear.

How do i get the tray to appear one at a time, each time I click of the same object!?!?

so annoyed been doing this for days and finished everything else just cant get this last step! and the teacher cant figure it out too! she just tells me to keep trying, but the project will be due soon and i cant find help from anyone

Pls help thanks!
what you need is a counter variable to keep track of how many times you've clicked on the ninja. Then in your checkIfNinja function you need to add some extra checks. Something like

if counter == 1 then
set opacity of first tray to 100%

if counter == 2 then
set opacity of second tray to 100%

etc

Also you could simplify the event to use

When mouse is clicked on Ninja (instead of anything)

This will in turn simplify your checkIfNinja function (since you will no longer need to check, you just need to increment the counter and show the next tray)


For video tutorials on programming in Alice 2.2 check out my YouTube channel

http://www.youtube.com/user/drdave785

Also check out my Programming in Alice blog at

http://programminginalice.com
   
Reply With Quote
Old
AllaboutGT
Guest
 
Status:
Posts: n/a
Default 12-12-2011, 06:13 AM

Quote:
Originally Posted by davidghemer View Post
what you need is a counter variable to keep track of how many times you've clicked on the ninja. Then in your checkIfNinja function you need to add some extra checks. Something like

if counter == 1 then
set opacity of first tray to 100%

if counter == 2 then
set opacity of second tray to 100%

etc

Also you could simplify the event to use

When mouse is clicked on Ninja (instead of anything)

This will in turn simplify your checkIfNinja function (since you will no longer need to check, you just need to increment the counter and show the next tray)
Thanks a lot cool! I'll try to figure it out but i really don't know what a counter variable is...

and originally i had it set to "When mouse is clicked on "Ninja" (instead of anything)

But when i asked the teacher for help she said: i had it wrong and it should be set on "anything"

I said i don't understand and she attempted for a minute to help me more, but i don't think she knew what she was doing too... and then she just said keep trying.

   
Reply With Quote
Old
TauTrumpsPi
Senior Member
 
TauTrumpsPi's Avatar
 
Status: Offline
Posts: 399
Join Date: Mar 2011
Location: The diamond layer
Default 12-12-2011, 01:28 PM

Here, this is a fixed version. You just needed to use an if/else to check if the previous tray is already opaque
Attached Files
File Type: a2w final 2trail (fixed).a2w (1.58 MB, 61 views)


--------------------------------------------------------------------------------------------------------------------------
I have plenty of common sense. I just choose to ignore it.
-Calvin and Hobbes

Wondering about my Avatar?
http://en.wikipedia.org/wiki/Tardigrade

Wondering about my username?
http://www.youtube.com/watch?v=jG7vhMMXagQ
   
Reply With Quote
Old
AllaboutGT
Guest
 
Status:
Posts: n/a
Default 12-13-2011, 01:11 AM

Quote:
Originally Posted by TauTrumpsPi View Post
Here, this is a fixed version. You just needed to use an if/else to check if the previous tray is already opaque
Wow you are a genius!!! Thank you so much! u don't understand how much time i kept spending trying to figure this out! and everyone i asked did not know at all too!


thank you so much!!!!
at least now i understand what to do too!
   
Reply With Quote
Old
TauTrumpsPi
Senior Member
 
TauTrumpsPi's Avatar
 
Status: Offline
Posts: 399
Join Date: Mar 2011
Location: The diamond layer
Default 12-13-2011, 06:31 AM

No problem. There are multiple ways to do it, I just picked the easiest


--------------------------------------------------------------------------------------------------------------------------
I have plenty of common sense. I just choose to ignore it.
-Calvin and Hobbes

Wondering about my Avatar?
http://en.wikipedia.org/wiki/Tardigrade

Wondering about my username?
http://www.youtube.com/watch?v=jG7vhMMXagQ
   
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.