Tip - how to recognise button sequences. e.g. a code to open a safe.
As mentioned before I'm making some new demos and playing with different game mechanics.
Others might find the following useful for recognising button sequences. e.g. a 4 digit password that unlocks a safe. They'd be many ways to do it and this is one.
Create four index attributes and give them values of 0
game.1st
game.2nd
game.3rd
game.4th
Create your 4 buttons. Name them 1,2,3 and 4 respectively.
Create a rule set in one of the buttons
RULE
When actor recieves touch
NESTED RULE
When game.1st = 0
Change game.first to self.name
OTHERWISE
When game.1st > 0
AND game.2nd = 0
Change game.2nd to self.name
OTHERWISE
When game.1st > 0
AND game.2nd > 0
AND game.3rd =0
Change game.3rd to self.name
OTHERWISE
When game.1st > 0
AND game.2nd > 0
AND game.3rd >0
AND game.4th = 0
Change game.4th to self.name
You can then paste this in to all your buttons.
And then somehwere you'd have the rule to recognise the correct 4 digit code to unlock the safe. Lets say it's 2134
When game.1st = 2
AND game.2nd = 1
AND game.3rd = 3
AND game.4th = 4
… trigger your opening the safe event
And change all the above attributes to 0. You'll probably want to reset them at other times too. Maybe if the player enters the wrong code or if they press a button and then don't press any others for a a few seconds.
Shaz
------------

"...the resulting sonic effect is almost mesmerising." Pocket Gamer
Sound design and music service available: http://tiny.cc/MusicService
www.HoneyTribeStudios.com
Others might find the following useful for recognising button sequences. e.g. a 4 digit password that unlocks a safe. They'd be many ways to do it and this is one.
Create four index attributes and give them values of 0
game.1st
game.2nd
game.3rd
game.4th
Create your 4 buttons. Name them 1,2,3 and 4 respectively.
Create a rule set in one of the buttons
RULE
When actor recieves touch
NESTED RULE
When game.1st = 0
Change game.first to self.name
OTHERWISE
When game.1st > 0
AND game.2nd = 0
Change game.2nd to self.name
OTHERWISE
When game.1st > 0
AND game.2nd > 0
AND game.3rd =0
Change game.3rd to self.name
OTHERWISE
When game.1st > 0
AND game.2nd > 0
AND game.3rd >0
AND game.4th = 0
Change game.4th to self.name
You can then paste this in to all your buttons.
And then somehwere you'd have the rule to recognise the correct 4 digit code to unlock the safe. Lets say it's 2134
When game.1st = 2
AND game.2nd = 1
AND game.3rd = 3
AND game.4th = 4
… trigger your opening the safe event
And change all the above attributes to 0. You'll probably want to reset them at other times too. Maybe if the player enters the wrong code or if they press a button and then don't press any others for a a few seconds.
Shaz
------------

"...the resulting sonic effect is almost mesmerising." Pocket Gamer
Sound design and music service available: http://tiny.cc/MusicService
www.HoneyTribeStudios.com
Comments