Power button

jimmyraynorjimmyraynor Member Posts: 22
edited November -1 in Working with GS (Mac)
Hi all,
In the cannon template, you can click anywhere to power up the cannon. How do you create a button to click on to power up the cannon?

Thanks!

Comments

  • AfterBurnettAfterBurnett Member Posts: 3,474
    I haven't looked at the template but I'm guessing it uses the background or another full screen actor to work as the "button". Simply assign the whole "if key is down" rule to another visible button actor. Easy :)
  • jimmyraynorjimmyraynor Member Posts: 22
    Thanks for your response. I'm not sure how that will work though.

    Right now, the rule for the cannon is..."if mouse button is down (anywhere), power up and fire"
    I created a separate button actor, so I want the player to click on the button to power up and fire.

    I need to specify the mouse position to be on the button, but how do I do that?
    Mouse position only gives the option of inside or outside..not on a specific actor.

    What do you mean by, "if key is down" rule.

    Maybe i'm making this more complicated than it should be...
  • 2D-Sprite-Box2D-Sprite-Box Member Posts: 72
    I'd make a boolean attribute, powerUp, set it on the button, if mouse button is down and inside (or touch is pressed) change to true, otherwise change to false, then change the rule for cannon, if powerUp is true, power up and fire
  • jimmyraynorjimmyraynor Member Posts: 22
    Thanks! That worked perfectly, was just what I was looking for.
Sign In or Register to comment.