I need a button to charge then shoot
Hey guys,
Im making a game and having a little trouble. I want to have two different types of lasers from two different buttons, both the buttons will make the hero shoot a laser. The first button which is red makes you fire one (Red) laser but the tricky part is the second (Blue) laser.
I want the player to have to charge for one second, then shoot (Blue laser) when you release the button, kinda like a megaman style shot. This will shoot a bigger, more powerful laser and having to charge the shot then release it when you want will make the game challenging and tactical.
So any ideas on how to do this? I have almost everything in place but this is the one big thing i cant get. I appreciate your help guys thanks
Im making a game and having a little trouble. I want to have two different types of lasers from two different buttons, both the buttons will make the hero shoot a laser. The first button which is red makes you fire one (Red) laser but the tricky part is the second (Blue) laser.
I want the player to have to charge for one second, then shoot (Blue laser) when you release the button, kinda like a megaman style shot. This will shoot a bigger, more powerful laser and having to charge the shot then release it when you want will make the game challenging and tactical.
So any ideas on how to do this? I have almost everything in place but this is the one big thing i cant get. I appreciate your help guys thanks
Comments
You need 2 separate rules. One, when touch is pressed. Which you add a timer which changes a 'power' attribute every x seconds. Then another rule, when touch is released. Spawn actor which acceleration is set to 'power'.
I hope that helps. Sorry I can't explain into detail.
In the blue laser button have a rule when touch is pressed every .5 change laser power to laser power+1
Then have rules in the laser when laser power = 0 fire regular non charge laser
Then have a rule when laser power > 1 fire medium charge laser
Then have a rule when laser power> 2 fire high charge laser
You can play around with those numbers till it's how u want, thats the concept though
Thanks for the reply though i hope it comes out nice. After i get it on iphone ill make one for the web too
This can be nested inside another rule that plays a soundFX when the button is pressed.
You could also read the game.Time (or scene.Time, if you have access to the Current Scene properties) between the user pressing the button and releasing the button to determine the strength.
Hope this helps
Thanks guys!
bring on the "space shooter" fun