Alice Community  

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

Reply
 
Thread Tools Display Modes
Get game to end after all objects have been picked up
Old
cammyleenic
Junior Member
 
Status: Offline
Posts: 4
Join Date: May 2012
Default Get game to end after all objects have been picked up - 05-13-2012, 03:52 PM

I have a world and there are 10 stacks of hay each with a method that makes the object disappear after the user gets close.

I want the game to display a message once all stacks of hay have been picked up.
   
Reply With Quote
Old
shodai
Member
 
Status: Offline
Posts: 27
Join Date: Nov 2010
Default 05-13-2012, 05:16 PM

Unfortunately there seems to be no method of ending a alice program. There are a couple of people here on the forums who seem to know some complex approach to adding Java coding to force quit the program.
   
Reply With Quote
Old
cammyleenic
Junior Member
 
Status: Offline
Posts: 4
Join Date: May 2012
Default 05-13-2012, 05:23 PM

Quote:
Originally Posted by shodai View Post
Unfortunately there seems to be no method of ending a alice program. There are a couple of people here on the forums who seem to know some complex approach to adding Java coding to force quit the program.
Can it recognise when all objects are opaque (invisible) if so, then can it display a message?
   
Reply With Quote
Old
shodai
Member
 
Status: Offline
Posts: 27
Join Date: Nov 2010
Default 05-13-2012, 05:42 PM

Sure, you can do this either with a list or each object independently. Either way it is just a series of if statements or one really large if/and statement.
   
Reply With Quote
Old
cammyleenic
Junior Member
 
Status: Offline
Posts: 4
Join Date: May 2012
Default 05-13-2012, 05:58 PM

You can move the camera with the arrow keys but when you ask it to make the object go opacity 0% when camera is 1 metres and you go 1 metre it doesn't disappear.

I've called the event in, etc.

Any suggestions?
   
Reply With Quote
Old
cammyleenic
Junior Member
 
Status: Offline
Posts: 4
Join Date: May 2012
Default 05-17-2012, 03:51 PM

Quote:
Originally Posted by shodai View Post
Sure, you can do this either with a list or each object independently. Either way it is just a series of if statements or one really large if/and statement.
How should the code look?
   
Reply With Quote
Old
TauTrumpsPi
Senior Member
 
TauTrumpsPi's Avatar
 
Status: Offline
Posts: 399
Join Date: Mar 2011
Location: The diamond layer
Default 05-17-2012, 04:47 PM

Quote:
Originally Posted by cammyleenic View Post
How should the code look?
Something like this:

Code:
if(hay1Done == true)
      if(hay2Done == true)
             if(hay3Done == true)
                    if(hay4Done == true)
                           if(etc, etc)
                                 Play victory method


--------------------------------------------------------------------------------------------------------------------------
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
arty-fishL
Senior Member
 
arty-fishL's Avatar
 
Status: Offline
Posts: 1,878
Join Date: Mar 2008
Location: In the corner of your eye
Default 05-17-2012, 05:08 PM

I think a cleaner way of doing this could be to have a number variable set to 0, then when hiding a hay increase the number by one, so you can just check if the number is more than or equal to 10.

Nested statements or nested logic looks quite confusing in Alice, readability is much better with:
Code:
if( number >= 10 ):
    play victory method
I don't know if that is the programmatically sensible thing to do though, I've always been terrible with conforming to those standards.


█░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░█
█░░▓░░░░░░░▓░░░░░░░░░░░▓▓░░▓░░░░░░▓░░░▓░░░░█
█░▓░▓░▓▓▓░▓▓▓░▓░▓░░░░░░▓▒▒░░▒░░▓▓░▓▓▓░▓▒░░░█
█░▓▓▓▒▓▒▒▒░▓▒▒▓▓▓▒▓▓▓░▓▓▓░░▓░░░▓▒▒▓▒▓▒▓▒░░░█
█░▓▒▓▒▓▒░░░▓▓░░▒▓▒░▒▒▒░▓▒▒░▓▓░▓▓▒░▓▒▓▒▓▒░░░█
█░▓▒▓▒░▒░░░░▒▒▓▓▓▒░░░░▓▓▒░░░▒▒░▒▒░░▒░▒▓▓▓░░█
█░░▒░▒░░░░░░░░░▒▒▒░░░░░▒▒░░░░░░░░░░░░░░▒▒▒░█
█░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░█

I have mostly moved on from Alice, but may still respond to messages if important [¬º-°]¬
   
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 ©2024, Carnegie Mellon University
Alice 2.x © 1999-2012, Alice 3.x © 2008-2012, Carnegie Mellon University. All rights reserved.