Shooting - Touch

larin555larin555 Member Posts: 14
edited November -1 in Working with GS (Mac)
Hello!

I'd like to know how I could make my character shoot a bullet in the direction I click (or touch) and create a crack(for instance) on the (let's say a wall).

Example : If I touch somewhere on a wall to shoot, the bullet will go whereever I touched and create a crack actor where the bullet went.

My character can move from left to right and jump.

Thanks a lot!

Comments

  • RattleheadRattlehead Member Posts: 485
    There are quite a few out there if you search for them (search is the little magnifying glass in the top right of the site) but this is one of the most recent that even has a project you can download.

    http://gamesalad.com/game/play/83629

    You'll just need to also spawn a crack actor (LOL!) at the X/Y co-ordinates where the player touches (this demo points in the direction but the bullet continues on but should give you everything you need to figure it out).

    Good luck.
  • larin555larin555 Member Posts: 14
    Thanks a lot!

    But now I'm wondering how to make the gun follow the Main character actor.
    I have tried to do it with the "follow actor" wiki, but I can't make it work.

    Thank you!
  • forkliftforklift Member Posts: 386
    if the gun is a separate actor than the main character, you'll need to do 3 things (not complicated)

    1. create two game level attributes called playerx and playery

    2. in the main character actor, constrain game.playerx to self.position.x and do the same for player Y, only use Y instead of X.

    3. In the gun actor, constrain self.position.X to game.playerX and do the same for Y, using the Y value.
  • larin555larin555 Member Posts: 14
    Hey Thanks!

    That's what I was looking for.

    Also, I used firemaplegames's Platformer tutorial to make my character move.
    Everything's fine except the player don't stop moving. When I press "RIGHT", he goes right but if the RIGHT key is up, he still going right.

    Any ideas of what I did wrong?

    Thank you!
  • GLGAMESGLGAMES SingaporeMember Posts: 988
    you need to add a rule on key is up then stop moving. at least thats the general concept i have with my fire button which only fires on press and stops when not pressed.
  • yoenoeszyoenoesz Member Posts: 42
    hey... im searching every topic but i cant find the answer on my question..

    i have a shoot button and an actor with gun image..
    what i want is to press the shoot button and let the gun shoot.. how can i make this ?

    thnx
  • SkyMapleSkyMaple Member Posts: 817
    create a boolean attribute in the game and call it "fire".

    In the button-

    Rule; If touch is pressed-
    change attribute "fire" to "true"
    Otherwise
    change attribute "fire" to "false"

    Im not sure how you have the gun fire but if you have it spawn the bullet actor use

    In the gun-

    rule; if attribute "fire" is "true"
    Spawn actor "bullet"
  • yoenoeszyoenoesz Member Posts: 42
    hey skymaple,

    i tried what you said but did not help..

    Look:
    I want to pres the Shoot button, and then the gun would animate and shoot..
    how can i make the shoot button tells the gun to shoot..?

    thnx
Sign In or Register to comment.