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, 11: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, 27 views)

Last edited by AllaboutGT; 12-12-2011 at 12:01 AM.
   
Reply With Quote
Old
davidghemer
Member
 
Status: Offline
Posts: 38
Join Date: Nov 2011
Default 12-12-2011, 05: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, 07: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, 02: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, 58 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, 02: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, 07: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
Old
AllaboutGT
Guest
 
Status:
Posts: n/a
Default 12-13-2011, 02:58 PM

Quote:
Originally Posted by TauTrumpsPi View Post
No problem. There are multiple ways to do it, I just picked the easiest
LOL thanks ....now im having trouble with the ninja disappearing after all the trays have appeared haha

how to i make actions happen after all the trays have appeared?

Like if all trays show ninja will (set opacity to 0%)
and lunch lady say "yay"

Or like just make actions happen after.

DO i use the while loop?
   
Reply With Quote
Old
samanthat
Junior Member
 
Status: Offline
Posts: 1
Join Date: Dec 2011
Location: New Jersey
Default 12-13-2011, 09:13 PM

hey im guessing you would have to set its opacity to invisible once the fith tray has been clicked on

Last edited by samanthat; 12-13-2011 at 09:18 PM.
   
Reply With Quote
Old
AllaboutGT
Guest
 
Status:
Posts: n/a
Default 12-13-2011, 10:50 PM

yea, i already tried that and a few other stuff...nothing worked yet, but thanks anyways
   
Reply With Quote
Possible help
Old
AliceMaster00
Senior Member
 
AliceMaster00's Avatar
 
Status: Offline
Posts: 167
Join Date: Oct 2011
Location: You know that gap between the bottom of your dresser and the floor? Yeah, there.
Smile Possible help - 12-14-2011, 10:31 AM

If counter = 5
Do Together
tray 5 set opacity to 100%
evil ninja is Showing to false
move up 50 meters
lunchlady say horray!


What a piece of work is a man? How noble in reason, how infinite in faculties, in form and in motion, how express and admirable how like an angel! What apprehension oh how like a god! The beauty of thee world, the paragon of animals, and yet- to me, what is this quintessence o' dust? Man delights, not me. Nor woman either, nor woman either.
   
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 ©2019, Carnegie Mellon University
Alice 2.x 1999-2012, Alice 3.x 2008-2012, Carnegie Mellon University. All rights reserved.