Alice Community  

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

Reply
 
Thread Tools Display Modes
Mouse click do action to random object...
Old
oretharvest
Guest
 
Status:
Posts: n/a
Default Mouse click do action to random object... - 12-18-2009, 07:48 PM

I am working on a project of my own design.
I have a world with 7 holes in the ground.
I have 7 objects in an array that pop up at random and after .25 secons go back underground. (Like a zombie version of Whack-A-Mole)
At this point I am trying to create an event so that when you click on one of the zombies it disappears.

The closest i can come to the action I want is:
When mouse is click on "any object under mouse cursor" do "zombie opacity 0"

I want it to cause whatever zombie I click on to go invisible not just one zombie but no amount of trying to insert my zombieArray in the zombie place or anything else I can think of works. when I try to put "object under mouse cursor" in the "zombie" spot it has an error.

Book doesn't cover action to whatever object you click, only if you click a particular object and that action applies to that object alone, not transferable to any object.
I'm very stuck on this.
   
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-18-2009, 08:18 PM

Something like this?

Make a method, then add an object parameter to that method with the add parameter button in the upper right corner of the scripting area. Then, in your mouse clicked event, call that method and set the parameter's passed value to Expressions>Object Under Mouse Cursor
Attached Files
File Type: a2w Disappear.a2w (1.02 MB, 90 views)


(')>
   
Reply With Quote
Try this
Old
awest
Guest
 
Status:
Posts: n/a
Default Try this - 12-18-2009, 08:52 PM

Create a new event - When mouse is clicked on {zombie}, do set isShowing to false. You will find the isShowing under your properties of your arrayvisualization.

Good Luck
   
Reply With Quote
Thanks so much
Old
oretharvest
Guest
 
Status:
Posts: n/a
Default Thanks so much - 12-18-2009, 09:04 PM

That sure seems like something that could have been covered in this book!
Now I just need to keep from accidentally clicking the ground and exposing my hidden ghouls!!
Now I should be able to make it so that it will only apply on objects that are True, then set the ground and circles and tombstones to False somehow yes?
Attached Files
File Type: a2w WhackAGhoul.a2w (2.05 MB, 27 views)
   
Reply With Quote
Old
Dameria
Senior Member
 
Dameria's Avatar
 
Status: Offline
Posts: 978
Join Date: Sep 2009
Location: United States
Default 12-18-2009, 10:30 PM

Ok, I wanted to work on it a little bit, I added some cool things.

First of all I fixed your problem by making a really long thing saying only run the if/else statement if it is one of the zombie guys from the array (I had to list every object number of that array). But after that I also decided to make a scoring system as well as a number of clicks clicked overall. Check out what I did. (I barely increased the file size for what I did to the game)
Attached Files
File Type: a2w WhackAGhoul1.1.a2w (2.09 MB, 65 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
Thank you
Old
oretharvest
Guest
 
Status:
Posts: n/a
Default Thank you - 12-19-2009, 07:25 PM

That version is great, I love the scoring.
I just finished a basic Logic and Programming class so I am still very new to Alice.
Thanks so much for giving me something to build off of, hope you had fun with it!
   
Reply With Quote
Old
Dameria
Senior Member
 
Dameria's Avatar
 
Status: Offline
Posts: 978
Join Date: Sep 2009
Location: United States
Default 12-19-2009, 08:23 PM

Ya I was going to add a few more things like maybe a hit percentage, like out of how many clicks you did, if it took you 14 clicks to hit all 7 targets, then your percentage would be at 50%, but I decided not to put too much in. I did have fun making it


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
marrydavidson101
Guest
 
Status:
Posts: n/a
Default 03-29-2010, 04:30 AM

keep it up very nice post i wish you best of Luck
   
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 ©2017, Carnegie Mellon University
Alice 2.x 1999-2012, Alice 3.x 2008-2012, Carnegie Mellon University. All rights reserved.