Moving My Mounted Machine Gun

bransen111bransen111 Member Posts: 26
edited November -1 in Working with GS (Mac)
Hi my game is gonna be kinda a tower defense where the actor sits on top f a tower with a mounted machine gun and kills things. I was wondering how first i could make the machine gun pivot up and down with a joystick. Second i was wondering as my machine gun was going up and down how do i keep the bullets from spawning still at the end of the gun. Thanks for all the help guys

Comments

  • XilombieGamesXilombieGames Member Posts: 6
    Hmmm...
    I'm not sure but for the first, try making the gun two times as long so that the middle of the picture is where you want the pivot to be.
    Then Find a joystick (maybe use codemonkey's), add two hidden actors, one above the joystick and one below it and make it change an attribute when the joystick touches the hidden actors:
    'When (joystick actor name) overlaps or collides with actor (top actor)
    change attribute (whatever your attribute name is) to up'
    and
    'When (joystick actor name) overlaps or collides with actor (bottom actor actor)
    change attribute (whatever your attribute name is) to down'

    then add this to your gun actor:
    'When attribute (whatever your attribute name is) contains down,
    rotate clockwise speed {enter speed here}'
    and
    'When attribute (whatever your attribute name is) contains up,
    rotate counter-clockwise
    speed {enter speed here}'

    Sous chefs please correct me if there's an easier way

    For the second you can try checking the cannon physics template (in fact you can just copy and paste the cannon to codemonkeys template and just change the controlled character to the cannon).
Sign In or Register to comment.