Smartest way to do this?
BigDave
Member Posts: 2,239
for a memory mini game I want to create random sequences which the player has to re-created with his 4 buttons
Button 1,2,3,4
And a randomly created sequence could look like this
2,1,2,4,3
So i wonder whats the smartest way to create that.
Checking if the play does use the buttons in the correct order.
Comments
Not sure I understand correctly, but I'll try and answer anyway. What you could do is hold the answer in a table, and write the button integer values to a separate table as the player pressed the button. Afterwards, you can use the Table Merge function and then compare the results. If they're the same, then they entered the correct sequence. If not, then they didn't.
My GameSalad Academy Courses! ◦ Check out my quality templates! ◦ Add me on Skype: braydon_sfx
You could obviously do this all in one table, but for clarity I said you could separate it.
My GameSalad Academy Courses! ◦ Check out my quality templates! ◦ Add me on Skype: braydon_sfx
@BigDave these two threads deal with this and give solutions:
http://forums.gamesalad.com/discussion/93237/simon-says-style-game-programming-problems
http://forums.gamesalad.com/discussion/89844/how-do-i-check-a-key-input-sequence-with-midpoint-fails
MESSAGING, X-PLATFORM LEADERBOARDS, OFFLINE-TIMER, ANALYTICS and BACK-END CONTROL for your GameSalad projects
www.APPFORMATIVE.com
But i would need seperate variables for each right?
Seqeunce number 1 = 2
Seqeunce number 2 = 1
Seqeunce number 1 = 2
...
is it possible to have the squence directly as one string
like
2+1+2+4+3
21243
so random function would role x times and connect each result as one string.
I guess im basically searching for something like "text" +"text"
(i also just came up while writing this that I could do 21243 by /1 /10/100/1000/10000)
do I still have a question know?
i dont know
My Apps
https://itunes.apple.com/de/artist/david-zobrist/id733552276
https://play.google.com/store/apps/developer?id=David+Zobrist&hl=de
Thanks guys I should find a soluation now
My Apps
https://itunes.apple.com/de/artist/david-zobrist/id733552276
https://play.google.com/store/apps/developer?id=David+Zobrist&hl=de
Just concatenate the inputs onto a blank text string (attribute) and check that string against the correct answer. So for each button press, the string changes:
[blank]
2
21
212
2124
21243
You can check after each input or just at the end (e.g. when textLength(game.input)=textLength(game.answer)).
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
If your question is how to concatenate (join) the text strings, you would do it like this assuming your button actor has a self.value attribute set to 1, 2, 3, or 4:
When touch is pressed
Change Attribute game.input to game.input..self.value
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
thanks guys works perfectly
with the string solution
My Apps
https://itunes.apple.com/de/artist/david-zobrist/id733552276
https://play.google.com/store/apps/developer?id=David+Zobrist&hl=de