Alice Community  

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

Reply
 
Thread Tools Display Modes
end game
Old
claymca
Guest
 
Status:
Posts: n/a
Default end game - 12-10-2009, 01:07 AM

Need help. Final project for class. Have a game where two players choose to remove either 1,2, or 4 cubes from the screen. Need to figure out how to end the game when the player with the final choice has 4 or less cubes on the screen and have the message You win pop up.
Attached Files
File Type: a2w p3.a2w (1.28 MB, 1 views)
   
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-10-2009, 06:43 AM

You could use a number variable which keeps track of how many cubes are in play by setting it's value to the number of starting cubes, then subtracting 1, 2, or 4 as they are taken away. Then, add an event called "when a variable changes" and use the number variable as the variable. Inside the event, check to see if the number variable is 4 or less with an if statement.


(')>
   
Reply With Quote
Old
claymca
Guest
 
Status:
Posts: n/a
Default 12-10-2009, 02:13 PM

Thanks for the suggestion but i am now more lost than I was before. I still can't get the game to end when there are 4 or less cubes left on the screen. I have a world variable as a list for the initial number of cubes say 30. i need the game to end when this list is down to 4 or less and announce which player is the winner.
   
Reply With Quote
Old
dubastot
Senior Member
 
dubastot's Avatar
 
Status: Offline
Posts: 661
Join Date: Apr 2009
Location: Two Steps From Hell
Default 12-10-2009, 04:38 PM

Have an if method where you drag and drop your number variable into the if slot and select the <= option. Set that number to four. eg: number variable<=4

Now all you have to do is make an event for what happens when that happens. Make sure you put your if statesman in a infinity loop.

if number variable <= 4
you win opacity set to 100%
else
do nothing
   
Reply With Quote
Old
claymca
Guest
 
Status:
Posts: n/a
Default 12-10-2009, 10:26 PM

No dice still won't work. No message and no end game.
   
Reply With Quote
Old
dubastot
Senior Member
 
dubastot's Avatar
 
Status: Offline
Posts: 661
Join Date: Apr 2009
Location: Two Steps From Hell
Default 12-10-2009, 10:35 PM

COuld you post you world so I can take a closer look?
   
Reply With Quote
Old
claymca
Guest
 
Status:
Posts: n/a
Default 12-10-2009, 11:31 PM

world attached.
Attached Files
File Type: a2w p3.a2w (1.31 MB, 2 views)
   
Reply With Quote
Old
claymca
Guest
 
Status:
Posts: n/a
Default 12-11-2009, 05:30 PM

Okay have gotten somewhere. the end game still is not working completely. Need to get the game to end with the final cube still visible and need to create a function to determine exactly which player is the winner.
Attached Files
File Type: a2w p3mca.a2w (1.31 MB, 1 views)
   
Reply With Quote
Old
claymca
Guest
 
Status:
Posts: n/a
Default 12-11-2009, 06:45 PM

Anybody?
   
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-11-2009, 07:05 PM

So just to clarify, you need the world to say you win or you lose when there are 4 or less cubes left, right?

And using the number variable didn't work? If the number variable properly tracks the number of cubes in play, and if you event checks it to see if it's less than 4, it should work.


(')>
   
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.