Make a TDS (Top Down Shooter) With GML on Game Maker
Airfare Daily Deals eCigarettes Eyeglasses Hotels Jewelry Online Backup Online Dating Online Printing Online Tickets Skin Care Textbook Rentals Vitamins Web Hosting Weddings
Find thousands of shopping-related forums
SEARCH

Make a TDS (Top Down Shooter) With GML on Game Maker

You will now learn how to make an awesome video game with Game Maker. This works on any version of game maker. It is unbelievably easy. This is a great guide for people intermediate Game Maker developers, if you are a beginner with game maker, there is a link to a previous article for beginners near the beginning of this article.

Reading this article and the one linked in it before you read this one will be very helpful if you have just started with GML. To start, create a new sprite and name it spr_main. Click edit sprite, click create a new sprite, leave the width and height at 32, click OK. Open image 0, and zoom in by either clicking the magnifying glass with a plus on it at the top of the new sprite window, or holding ctrl while pressing =. Select draw an ellipse by either pressing I or clicking on the circle/ellipse on the left of the new sprite window. You can change what color the inside of the circle will be by right clicking any color on the color panel. Now create a circle/ellipse by clicking and holding your mouse on the top left corner of the square you have zoomed in on and dragging it to the bottom right corner of it and letting go. Click the check mark on this screen and the next, click center and click OK.

Create an object, name it obj_main. Make its sprite spr_main. Click add event and make a step event. Drag and drop an execute code button. Type in if keyboard_check(vk_left) and place_empty(x-5,y) x -= 5. I highly suggest not copying and pasting because typing it yourself will make GML a lot easier in the future. Next type if keyboard_check(vk_right) and place_empty(x+5,y) x += 5. After you've done this type if keyboard_check(vk_up) and place_empty(x,y-5) y -= 5. For the last movement code type, if keyboard_check(vk_down) and place_empty(x,y+5) y += 5. Click the check mark then click OK. Remember to save the game.

Create a sprite, name it spr_wall. Edit the sprite, click create a new sprite, leave the width and height at 32. Open image 0. Select the paint bucket or press F and fill in the square with any color you want. Click check on this screen and the next, click center, then click OK.

Create an object, name it obj_wall. Select the sprite spr_wall. Choose solid click ok, save the game. Create a sprite and name it spr_bullet. Click edit sprite, click the create a new sprite button on the top of the window. Change the width to 8 and the height to 2. Open image 0 and zoom in 14 times. Left click on the color yellow, press F or select the paint bucket and left click on the middle of the rectangle. Click check, click it on the next screen and do NOT click center. Click OK. Create an object, name it obj_bullet. Select its sprite to be spr_bullet. Click add event, choose create. Drag and drop an execute code button and type

image_angle = point_direction(x,y,mouse_x,mouse_y);

move_towards_point(mouse_x,mouse_y,10); 

This is telling game maker to make the image of the sprite to point in the direction of the mouse when it is created. It is also telling it to move towards the mouse at the point it is when obj_bullet is created at a speed of 10 pixels per second. Click the check mark then OK.

Open obj_main, click add event and select create. Drag and drop the execute code button. Type in can_shoot = true;. This willl make the variable can_shoot possible, this will be explained more later in this article. Click the check mark.

Click add event, choose mouse, go down to global mouse, select global left button. Drag & drop an execute code button. Type in

if can_shoot = true{

instance_create(x,y,obj_bullet);

can_shoot = false;

alarm[0] = 10;

}

This is telling game maker if the variable can_shoot is active, create the object obj_bullet and to make the variable can_shoot inactive. Click the check mark, click add event, click alarm, select alarm[0]. Drag and drop an execute code button, type in 

can_shoot = true.

Click the check mark, then OK. Create a room and outline it with walls put obj_main anywhere within these walls.

You are now finished; you may run the game and have fun with it. 

Need an answer?
Get insightful answers from community-recommended
experts
in Computer Programming & Languages on Knoji.
Would you recommend this author as an expert in Computer Programming & Languages?
You have 0 recommendations remaining to grant today.
Comments (0)
ARTICLE DETAILS
RELATED ARTICLES
ARTICLE KEYWORDS