Alice Community  

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

Reply
 
Thread Tools Display Modes
need help please...
Old
xxx
Guest
 
Status:
Posts: n/a
Default need help please... - 01-13-2010, 07:20 PM

i want to make a game where the every time a person is pressed, the person turns invisible and when the mouse is clicked on an animal its size its reduced. i know how to do it separately for each object but is there some way i can make the method for one person for everybody else? i think it had something to do with a variable or a parameter or am i completely off the mark?
   
Reply With Quote
Old
Dameria
Senior Member
 
Dameria's Avatar
 
Status: Offline
Posts: 978
Join Date: Sep 2009
Location: United States
Default 01-13-2010, 07:48 PM

You would need to make a method where you do "When mouse is clicked on..." and then for the object leave it on "everything", but for the action, make a separate method and make an object parameter (make sure you click the "object" bubble when making the parameter). Then in the "do..." place of the event, put in the method you just made, and for the parameter you go down to "expressions" and then "object under mouse cursor". Then in the actual method, put multiple if/else statements. This is where you list all of the things you want to change.

You can use the parameter at the top of your method as a variable, just drop it down to where you want it to go in your code
For example, if you want it to be when you click a person he turns invisible, you make an if/else in the method that says "if (parameter) == person, then make person opacity = 0", or something like that. And then if you want a certain object to get bigger when clicked on, you make an if/else "if (parameter) == otherObject, then make otherObject resize 1/2". You can make as many if/else statements for as many objects as you want in this method, while only having one event to call on them.

If you still do not understand, I will make an example world for you to see. If you do understand please tell me.


Check out my best projects so far and please comment:

Tic-Tac-Toe 2.0 ................... http://www.alice.org/community/showthread.php?t=3548
Alice Paint ........................... http://www.alice.org/community/showthread.php?p=23408
Real-Time Clock .................. http://www.alice.org/community/showthread.php?p=12725
Maze Game ......................... http://www.alice.org/community/showthread.php?t=4301
   
Reply With Quote
Old
xxx
Guest
 
Status:
Posts: n/a
Default 01-13-2010, 07:58 PM

i sort of understand but i would appreciate if you show me an example world. i really appreciate all the help. thank you!!
   
Reply With Quote
Old
Dameria
Senior Member
 
Dameria's Avatar
 
Status: Offline
Posts: 978
Join Date: Sep 2009
Location: United States
Default 01-13-2010, 08:15 PM

ok heres an example world, please tell me if you still do not understand how I did a certain thing:
Attached Files
File Type: a2w MultipleObjectClickExample.a2w (1.13 MB, 7 views)


Check out my best projects so far and please comment:

Tic-Tac-Toe 2.0 ................... http://www.alice.org/community/showthread.php?t=3548
Alice Paint ........................... http://www.alice.org/community/showthread.php?p=23408
Real-Time Clock .................. http://www.alice.org/community/showthread.php?p=12725
Maze Game ......................... http://www.alice.org/community/showthread.php?t=4301
   
Reply With Quote
Old
xxx
Guest
 
Status:
Posts: n/a
Default 01-13-2010, 08:55 PM

how did u put objectsclickedon==bunny? i got to tat part but i can select my objects on the second drop down menu. it only gives me numbers and the expression.
   
Reply With Quote
Old
Dameria
Senior Member
 
Dameria's Avatar
 
Status: Offline
Posts: 978
Join Date: Sep 2009
Location: United States
Default 01-13-2010, 09:16 PM

the objectsClickedOn is the parameter at the top of the method, you just drop it down from there, and then you do == and then pick a number (lets say 1). But then you drag an object from the object list on the left and drop it in where it says 1, so instead of objectsClickedOn == 1, it would be objectsClickedOn == bunny.


Check out my best projects so far and please comment:

Tic-Tac-Toe 2.0 ................... http://www.alice.org/community/showthread.php?t=3548
Alice Paint ........................... http://www.alice.org/community/showthread.php?p=23408
Real-Time Clock .................. http://www.alice.org/community/showthread.php?p=12725
Maze Game ......................... http://www.alice.org/community/showthread.php?t=4301
   
Reply With Quote
Old
xxx
Guest
 
Status:
Posts: n/a
Default 01-13-2010, 09:27 PM

when i drag down the object i get a drop down menu i have never seen before tat said something like bikekid2 opacity and the other option is bikekid 2 specular highlight exponent.
   
Reply With Quote
Old
dubastot
Senior Member
 
dubastot's Avatar
 
Status: Offline
Posts: 661
Join Date: Apr 2009
Location: Two Steps From Hell
Default 01-13-2010, 09:47 PM

I think what Dameria is saying you should drag the cvariabel down to your methods window and select the == sign.
   
Reply With Quote
Old
xxx
Guest
 
Status:
Posts: n/a
Default 01-13-2010, 09:54 PM

tat is what i did and i got those 2 options.
   
Reply With Quote
Old
xxx
Guest
 
Status:
Posts: n/a
Default 01-14-2010, 04:21 PM

is there a way that while your video is playing that the objects can be deleted?like not turn invisible but outright deleted? thx a bunch!
   
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.