How do I make my Character Shoot?

mfildeymfildey Member Posts: 8
edited November -1 in Working with GS (Mac)
Hello. Let me start by saying that I am a beginner in the world of game development. I am making a platformer style game and I was just wondering how do I make a character shoot a bullet, at the press of a button, that will kill a antagonist. Does any one know how I can do this?

Comments

  • mfildeymfildey Member Posts: 8
    Thanks so much!
  • mfildeymfildey Member Posts: 8
    Is there any way that i could tap a place on the screen and make the character shoot there?
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    Hi mfildey, yes that's possible. Put an actor over your background, and then put:

    When touch is pressed
    then your Spawn Behaviour, Position set Relative to scene. THen in the position x put game.Touches.Touch 1.X and in the y put game.Touches.Touch 1.Y. These can be found in the Expression editor by Devices>Touches>Touch 1 then x or y, if you didn't know.

    A couple of other things, firstly, make sure your behaviour, move or accelerate, whatever, is in your Prototype actor to be spawned, if it's not already.

    And also, more importantly, if you have any other actors to be touched on top of your background actor, they will spawn the bullets as well. So to stop this if you need to, make a game boolean attribute called NoFire, for instance. Added to the When Touch is pressed Rule, put when game.Nofire is true, making sure All conditions are valid is selected. Just before this, put a change attribute Beh. change game.NoFire to true, and in the other touched actors that you don't want to spawn, add to its rules a change attribute game.NoFire to false.

    Think that'll work out; the spawning on touching the overall background certainly will. hope that of help to you.

    :-)

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

Sign In or Register to comment.