Change Weapons/Animations

stanimationstanimation Member Posts: 406
edited November -1 in Working with GS (Mac)
Hey All, I'm trying to figure out how to have a icon/button that, when tapped, changes weapons on the player, and button, and subsequently changes the animations of the player. Any thoughts would be appreciated.

Thanks!

Comments

  • jonmulcahyjonmulcahy Member, Sous Chef Posts: 10,408
    attributes attributes attributes! :)

    a simple example:

    create an attribute called Weapons

    create a button that when touched, changes the value of weapons:
    - when actor receives touch change attribute game.Weapons = (game.Weapons+1)%2
    where 2 is how many weapon choices you want.

    on the button you can have rules like this:
    when attribute game.Weapons = 0
    change image misslebutton.png

    when attribute game.Weapons = 1
    change image lazerButton.png

    on your player you'd need two sets of rules, animation and weapon. for animation it's easy:
    when attribute game.Weapons = 0
    animate (put specific images here)

    when attribute game.Weapons = 1
    animate (put different specific images here)

    for weapons it's slightly different, but still pretty straight forward. You'll have a few rules based on each weapon type. so, if you had a laser and a missle, and using the keyboard Spacebar as the trigger:

    when attribute game.Weapons = 0 AND button space is down
    spawn actor lazer

    when attribute game.Weapons = 1 AND button space is down
    spawn actor missle

    something like that anyways. if you want to give a little more details, like the kinds of weapons and how you plan on activating the shooting we could get more specific.
  • stanimationstanimation Member Posts: 406
    Awesome thanks! I think I get it? I will try this when I get time this evening. Work gets in the way of fun stuff :P
Sign In or Register to comment.