Alice Community  

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

Reply
 
Thread Tools Display Modes
Simon Say's
Old
rmcguire
Junior Member
 
Status: Offline
Posts: 6
Join Date: Nov 2011
Default Simon Say's - 11-01-2011, 01:09 PM

I'm trying to make a bomb diffusing game. To diffuse the bomb a pattern will be displayed and the player must repeat the pattern. The game will be very simular to the classic Simon Say's handheld game where the lights flash and the player is suppose to press the button that was lit up. I'm looking for some help with getting the sprites to display a pattern, wait for the user to copy it, recognize if the pattern was correct and give a new one, or recognize a pattern is wrong and repeat it. Any help with this would be greatly appreciated!
   
Reply With Quote
Old
Powerhouse64
Senior Member
 
Powerhouse64's Avatar
 
Status: Offline
Posts: 54
Join Date: Nov 2011
Location: In ur base, movin ur stuffs
Default 11-05-2011, 03:04 PM

I can give you a bit of help with this. If you want the pattern being random, let me know and I can try to give you a bit of info on that, but for checking if the pattern was right, I have a pretty reliable system for checking this.

If/else statements are key for this.
First: create your pattern and display it, then give the user a turn at trying to replicate the pattern
Second: create an if/else that says: if [user clicks on the first object of the pattern] (I'm assuming that the user clicks on objects in a certain order) then [go to the next if/else in the next step] else [display fail/blow up the bomb or whatever you choose]
Third: create your second if/else statement that checks if the second click matches the pattern that goes like this: if [user clicks on second object of the pattern] then [go to next if/else] else [display fail/blow up the bomb or whatever you choose]
Fourth: Wash, Rinse, Repeat until the user reaches the end of the pattern.

Hope this helps clear things up!


Hogwarts: Where everything is made up, and the points don't matter
   
Reply With Quote
Old
rmcguire
Junior Member
 
Status: Offline
Posts: 6
Join Date: Nov 2011
Default 11-05-2011, 03:28 PM

There is a potential to have the patterns display at random. I had every intention of just doing a number of set patterns to make the programming a little easier, but some insite on the random would certainly help.

I'm familiar in what you suggested with the if/else statements have doing a typing game that looks for a specific letter in another programming language. For that I used a list to store the word that was to be typed. For each character that the user typed in would store it in another list and recognize if the word was right. Being fairly new to Alice, I'm wondering if I would have to do the same method/ can do the same method.
   
Reply With Quote
Old
Powerhouse64
Senior Member
 
Powerhouse64's Avatar
 
Status: Offline
Posts: 54
Join Date: Nov 2011
Location: In ur base, movin ur stuffs
Default 11-05-2011, 03:38 PM

Quote:
Originally Posted by rmcguire View Post
There is a potential to have the patterns display at random. I had every intention of just doing a number of set patterns to make the programming a little easier, but some insite on the random would certainly help.

I'm familiar in what you suggested with the if/else statements have doing a typing game that looks for a specific letter in another programming language. For that I used a list to store the word that was to be typed. For each character that the user typed in would store it in another list and recognize if the word was right. Being fairly new to Alice, I'm wondering if I would have to do the same method/ can do the same method.
I'm not really sure what you mean by that, but I'm sure it made total sense to everyone else. Basically what you can do for random patterns is have a CRAPTON of if/else statements asking for a random number and if it is within this range, have this object light up (I'm assuming that objects light up in a pattern for your game) else go check another if/else for another object, and then have Alice create a list for the order of if/else statements chosen, have each data point on that list (being the program for a certain object) correspond to an object. And have Alice create another list for what the user clicks on, then cross-check the data points on those two lists. I know this is a bit confusing, but I am terrible at re-wording my explanations for clarity. If anyone else wants to try to translate what I said, please do so!!!

I hope this helped give you a bit more of an idea behind creating random patterns for a Simon Says game (I did something similar, but unfortunately I've deleted the world and don't have a photographic memory)


Hogwarts: Where everything is made up, and the points don't matter
   
Reply With Quote
Old
rmcguire
Junior Member
 
Status: Offline
Posts: 6
Join Date: Nov 2011
Default 11-05-2011, 07:38 PM

Shown below is the code that I have gotten done so far. The code in the world.play method is where the two lists, clickedButtons, and p1/p2 are being compared to each other. However the comparison isn't working. What am I doing wrong?


Bomb's Code

Created by: Rory McGuire

world

Events

When is clicked on startbutton
Do:
startbutton.start


When is clicked on startbutton
Do:
world.play


When is clicked on anything
Do:
world.buttonflash ( object under mouse cursor )


Methods

world.pattern 1 ( )
No variables
redbutton.flash


world.record clicks ( [Obj] whichButton)
No variables
If world.record
insert whichButton at end of world.buttonsClicked duration = 0 seconds
Else
Do Nothing


world.buttonflash ( [Obj] whichButton)
No variables
world.record clicks whichButton = whichButton
If ( whichButton == redbutton )
redbutton.flash
Else
Do Nothing
If ( whichButton == bluebutton )
bluebutton.flash
Else
Do Nothing
If ( whichButton == yellow button )
yellow button.flash
Else
Do Nothing
If ( whichButton == greenbutton )
greenbutton.flash
Else
Do Nothing


world.play ( )
No variables
Do together
world.pattern 1
world.timer set value to 0
While ( world.buttonsClicked != world.p1 )
increment world.timer by 1 duration = 1 second
If ( world.timer == 3 )
greenbutton.flash
Else
Do Nothing
If ( world.buttonsClicked == world.p1 )
world.timer set value to 0
remove all items from world.buttonsClicked duration = 0 seconds
world.pattern2
Else
Do Nothing


world.pattern2 ( )
No variables
Do together
redbutton.flash
Do in order
Wait 0.25 seconds
bluebutton.flash


redbutton

Methods

redbutton.flash ( )
howFast = 0.12
Do together
Do Nothing
redbutton.Button set color to (1, 0, 0) duration = howFast seconds
redbutton play sound world.beep-29 (0:00.293) duration = Full Length
redbutton.Button set color to (1, 1, 1) duration = howFast seconds
Do together
Do Nothing


bluebutton

Methods

bluebutton.flash ( )
howfast = 0.12
Do together
bluebutton.Button set color to (0, 0, 1) duration = howfast seconds
bluebutton play sound world.beep-28 (0:00.293) duration = Full Length
Do together
bluebutton.Button set color to (1, 1, 1) duration = howfast seconds


yellow button

Methods

yellow button.flash ( )
howfast = 0.12
Do together
yellow button.Button set color to (1, 1, 0) duration = howfast seconds
yellow button play sound world.beep-22 (0:00.267) duration = Full Length
Do together
yellow button.Button set color to (1, 1, 1) duration = howfast seconds


greenbutton

Methods

greenbutton.flash ( )
howfast = 0.12
Do together
greenbutton.Button set color to (0, 1, 0) duration = howfast seconds
greenbutton play sound world.beep-20 (0:00.267) duration = Full Length
Do together
greenbutton.Button set color to (1, 1, 1) duration = howfast seconds


startbutton

Methods

startbutton.start ( )
No variables
world.record set value to true
   
Reply With Quote
Old
Powerhouse64
Senior Member
 
Powerhouse64's Avatar
 
Status: Offline
Posts: 54
Join Date: Nov 2011
Location: In ur base, movin ur stuffs
Default 11-05-2011, 09:22 PM

Could you upload whatever you have so far? That would be a lot more helpful than having someone scan through your code. Personally, I'd rather have it IN Alice to read. So if you want to upload your world, I could help you a lot better that way. And I can't guarantee that I can fix all the problems with your world, but I'll give it my best. I'm glad to help if I can though!


Hogwarts: Where everything is made up, and the points don't matter
   
Reply With Quote
W 0 w
Old
Centuri0n
Member
 
Centuri0n's Avatar
 
Status: Offline
Posts: 44
Join Date: Oct 2011
Location: In a box with free wifi
Talking W 0 w - 11-05-2011, 09:35 PM

That is going to be one long code, nice work so far


Current Project: NEW ERA
Approx. Completion: 15%
Starting date: 7/12/2012
ETA: 8/3/2012

http://sylentknightgamedesign.weebly.com/
   
Reply With Quote
Old
rmcguire
Junior Member
 
Status: Offline
Posts: 6
Join Date: Nov 2011
Default 11-06-2011, 10:35 AM

Yeah sure. Here it is
Attached Files
File Type: a2w Bomb.a2w (385.9 KB, 44 views)
   
Reply With Quote
Old
Powerhouse64
Senior Member
 
Powerhouse64's Avatar
 
Status: Offline
Posts: 54
Join Date: Nov 2011
Location: In ur base, movin ur stuffs
Default 11-06-2011, 10:40 AM

Loading it up right now... I'll get back to you in a few, hopefully!


Hogwarts: Where everything is made up, and the points don't matter
   
Reply With Quote
Old
Powerhouse64
Senior Member
 
Powerhouse64's Avatar
 
Status: Offline
Posts: 54
Join Date: Nov 2011
Location: In ur base, movin ur stuffs
Default 11-06-2011, 10:43 AM

Quick question, were you aware that by pressing the second, third, then fourth button, you are playing the first three notes of the Lavender Town theme song from Pokemon? 'Cause that's exactly what that is! And I'm looking through the program now, but I'm not seeing where that list checking issue is coming up...


Hogwarts: Where everything is made up, and the points don't matter
   
Reply With Quote
Reply

Tags
patterns, simon says

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.