Understanding how to make a character shoot on GameMaker will allow you to create a much wider range of games. Since the initial release of GameMaker in 1999, various features, such as the creation of instances and variables, have been added. Games created in GameMaker then can be exported to the Internet or saved as a standalone file. By downloading a few resources and setting up various instances, a user can program their character to shoot projectiles.
Download the Platform Engine and Bullet Sprite (See Resources). Save each resource to the GameMaker program folder located on your computer.
Open GameMaker. Allow the program to load fully and then click "File" located in the top left corner of the screen. A menu will appear. Scroll down and select "New Project" from the list of options. A new project will open.
Click the ball labeled "Create an Object" located in the main navigation menu. A window will appear. Locate the highlighted area labeled "Sprite." Click "New." The "Sprite Properties" menu will open. Click "Load Sprite" to open Windows Explorer and navigate to the bullet sprite you downloaded in step one. Select it, then click "Open." Close the "Sprite Properties" menu. You will be redirected back to the "Object Properties" menu.
Click "Add Event" located in the blank "Event" field. A set of options will appear. Click "Create." A light bulb will appear in the events window. Select the "Control" tab located on the right side of the "Object Properties" window. A set of options will appear. Click and drag "Set Variable" into the blank "Actions" field. The "Set Variables" window will open.
Type "Facing" into the blank "Variable" text field and leave the "Value" set at "0." Click "OK." Once again click and drag "Set Variable" into the "Actions" field. Type "Facing" into the blank "Variable" text field and set the "Value" to "180" then click "OK."
Click "Add Event" located in the "Events" window. A list of options will appear. Click "Key Press" to open a drop down menu. Scroll down and select "Space." Click "Main1" tab located on the right side of the "Object Properties" window. Click and drag "Create Object With Motion" into the blank "Actions" field. The "Create Motion" window will open.
Type "15" into the blank "Speed" text field. Type "Facing" into the blank "Direction" text field. Press "OK." You will now be redirected to the "Object Properties" window. Click "Ok." Your character will now be able to shoot projectiles.
Things You'll Need
You must have GameMaker version 6 or higher to make a character shoot.
Save your progress often to prevent the loss of progress in the event GameMaker crashes.