Which type of Game maker do you use?

Monday, January 27, 2014

How To Have Bullets

Hi gamers! So You're here about bullets? Tsk, tsk, tsk you're a violent person. Alright well this is the post for you. Just make sure you only shoot in the game.
*I feel like listing the steps in this post*

1.) You need 2 sprites and 2 objects for the player & the bullet. I will use a square sprite and call it obj_guy.















2.) Go to obj_guy's object and select the "create event"
3.) Go to the control tab and right-click Set Variable
4.) fill this in.
Variable: ammo
    Value: 10 (this is your amount)
                    click ok
5.) Now go to the events and click "key press - right"
6.) Go to controls tab click test variable.  fill in
  Variable: ammo
      Value: 0
Operation: equal to
         Click ok
7.) Click...
Start of block
exit this event
end of block
ELSE
Set variable (Variable: ammo Value: -1) (RELATIVE)
create moving instance fill in
   Object: (your bullet object)
           X: 0
           Y: 0
    Speed: (how fast you're bullet shoots)
Direction: (this depends which direction you will shoot)

NOTE: Gamemaker directions
  right: 0
     up: 90
    left: 180
down: 270

By the end your screen should look like this:



















Now I'm assuming you want to pick up ammo somehow so...
1.)make a sprite for your ammo box
2.)make an object. use that sprite.
3.)Now go to obj_guy's window
4.)Use collision with ammo box
5.)Set variable ammo +(however much ammo the box has)(RELATIVE)
6.)destroy the instance(Other)

There you go you violent fellow gamer. See ya!


A few FAQS (well...not really asked, but these are questions I imagine a few of violent gamers asks)

Q: Why can I only shoot once?
A: Make sure you press relative with the shooting

Q: Is there a way I can see the amount of ammo left?
A: Yep! what you need to do is make a <no sprite> object. Make a draw event. go to draw variable.
1.)At the top pick obj_guy
Self
Other
Object: obj_guy <= this one
2.)Type the ammo variable
3.)select the X and Y
4.)pick relative if you want your ammo above your head.


Happy gaming!

No comments:

Post a Comment