I need a button to charge then shoot

kietzkietz Member Posts: 49
edited November -1 in Working with GS (Mac)
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

Comments

  • iDeveloperziDeveloperz Member Posts: 1,169
    I've only just came back, so I could be wrong.

    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. :\
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    Have a attribute called laser power set it to 0

    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
  • DrGlickertDrGlickert Member Posts: 1,135
    Also, look at the Cannon Physics tutorial in GS. It has a power meter that determines the strength of the shot, you could easily transfer that to the "power" of your shots.
  • kietzkietz Member Posts: 49
    Thanks guys ill look into it. I might just try them all haha

    Thanks for the reply though i hope it comes out nice. After i get it on iphone ill make one for the web too
  • ValanValan Member, BASIC Posts: 410
    If you want a simple delay to charge the gun then use the "After" setting in the rule.

    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
  • kietzkietz Member Posts: 49
    Awesome i got it to work!
    Thanks guys!
  • FranzKellerFranzKeller Member Posts: 517
    rtype!

    bring on the "space shooter" fun

Sign In or Register to comment.