getting started in gamemaker studio 2.x the general steps ...staff · c. create game objects from...

18
Getting Started in GameMaker Studio 2.x GameMaker Studio is a game engine that can be used to create games for multiple platforms. There are two sides to GameMaker which represent two ways to create games. The two sides are the GUI development side and the Scripting side. Both can be used together or each can be used separately. The general steps to create a game are: A. Get Game Assets. This includes graphics, sounds, and music. Graphics will be used for Sprites and for Backgrounds. Typically, Sprite graphics are smaller in size than backgrounds and normally have a transparent background. B. Create Game elements from Game Assets. The basic game objects will be Sprites, Backgrounds, and sounds/music. C. Create Game Objects from Game Elements. D. Add functionality to the Game Objects through mapping Events with Actions and/or adding scripting code. The first step is to get the game assets. This includes the images that will represent Game Sprites and the images used to create Game Backgrounds. GameMaker can use both static and animated images. Static images are single image files while Animated Sprite images include a set of images that are animated in a loop. Normally, image files are identified by their type. Animated images can be either GIF files or PNG files (the last three letters of the file name identify the file type). You can find both static and animated sprite files on the Internet. In this case, you will download a set of files linked to this lecture. 1. Download the sample files for lecture 1 (see link on page or in canvas). 2. Unzip the downloaded folder and save the files in a location you can use for import into GameMaker. 3. Start GameMaker. When you start GameMaker you see the initial start screen:

Upload: others

Post on 27-May-2020

12 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Getting Started in GameMaker Studio 2.x The general steps ...staff · C. Create Game Objects from Game Elements. D. Add functionality to the Game Objects through mapping Events with

Getting Started in GameMaker Studio 2.x

GameMaker Studio is a game engine that can be used to create games for multiple platforms. There are two sides to

GameMaker which represent two ways to create games. The two sides are the GUI development side and the Scripting

side. Both can be used together or each can be used separately.

The general steps to create a game are:

A. Get Game Assets. This includes graphics, sounds, and music. Graphics will be used for Sprites and for

Backgrounds. Typically, Sprite graphics are smaller in size than backgrounds and normally have a transparent

background.

B. Create Game elements from Game Assets. The basic game objects will be Sprites, Backgrounds, and

sounds/music.

C. Create Game Objects from Game Elements.

D. Add functionality to the Game Objects through mapping Events with Actions and/or adding scripting code.

The first step is to get the game assets. This includes the images that will represent Game Sprites and the images used to

create Game Backgrounds. GameMaker can use both static and animated images. Static images are single image files

while Animated Sprite images include a set of images that are animated in a loop. Normally, image files are identified by

their type. Animated images can be either GIF files or PNG files (the last three letters of the file name identify the file

type).

You can find both static and animated sprite files on the Internet. In this case, you will download a set of files linked to

this lecture.

1. Download the sample files for lecture 1 (see link on page or in canvas).

2. Unzip the downloaded folder and save the files in a location you can use for import into GameMaker.

3. Start GameMaker. When you start GameMaker you see the initial start screen:

Page 2: Getting Started in GameMaker Studio 2.x The general steps ...staff · C. Create Game Objects from Game Elements. D. Add functionality to the Game Objects through mapping Events with

This allows you to create a new project, open an existing project, or import a project from another version.

4. Click the New button to create a new project. You see an option for Drag and Drop or GameMaker Language.

The difference is that using Drag and Drop is a bit easier when starting since you can always add scripts to a Drag

and Drop project.

5. Click the Drag and Drop option. You will be asked for the name of your project.

6. Enter a project name such as testone. GameMaker will create a folder with this name in which it stores all of the

project files.

Page 3: Getting Started in GameMaker Studio 2.x The general steps ...staff · C. Create Game Objects from Game Elements. D. Add functionality to the Game Objects through mapping Events with

You see the starting window. Along the right side of the window are areas for your game resources. One of

these that is highlighted is Rooms. This represents the game area within which games are played. Rooms will

contain game objects and other elements.

7. Double click Room0 so you can see the room editor.

Page 4: Getting Started in GameMaker Studio 2.x The general steps ...staff · C. Create Game Objects from Game Elements. D. Add functionality to the Game Objects through mapping Events with

The room editor has various windows and buttons. Along the left are the Layers windows. A Layer is at what “level” a

room object will be place in the room. Layers can stack on top of each other. The two default layers are instances and

backgrounds.

In order to add a background to the room you must import an image as a sprite.

8. Right click the Sprite area. You see the create menu:

Page 5: Getting Started in GameMaker Studio 2.x The general steps ...staff · C. Create Game Objects from Game Elements. D. Add functionality to the Game Objects through mapping Events with

9. Choose Create Sprite From Image(s).

10. Locate the images you downloaded from the web site and choose Background1.jpg and click Open. You will see

the Sprite Editor with this sprite.

11. Rename this sprite background and note the spite size (width/height).

Page 6: Getting Started in GameMaker Studio 2.x The general steps ...staff · C. Create Game Objects from Game Elements. D. Add functionality to the Game Objects through mapping Events with

12. In the Layers area of the room click the Background layer.

13. In the background layer properties click the button next to the No Sprite area and choose the background sprite.

Set the room size property to 576.

Page 7: Getting Started in GameMaker Studio 2.x The general steps ...staff · C. Create Game Objects from Game Elements. D. Add functionality to the Game Objects through mapping Events with

14. Right click on the Sprite area and use the Create Sprite from Image to create a sprite from the Pumpkin image

and the Star image.

When done you will see three sprites:

Page 8: Getting Started in GameMaker Studio 2.x The general steps ...staff · C. Create Game Objects from Game Elements. D. Add functionality to the Game Objects through mapping Events with

You cannot use a Sprite directly in a room unless you use it as a background. In order to use these sprites you will have

to create game objects and add the sprite to the game object.

15. Right click the Object area and choose Create Object. You see the Object windows:

16. Name the object Pumpkinobj and click the button (…) next to the No Sprite button.

17. Select the Pumpkin sprite.

Page 9: Getting Started in GameMaker Studio 2.x The general steps ...staff · C. Create Game Objects from Game Elements. D. Add functionality to the Game Objects through mapping Events with

18. Use the same steps to create a star game object named starobj and using the star sprite.

When done you will see the two game objects in the resources area:

19. Make sure the room editor is open (if not double click the Room 0 object).

20. Click the Instances layer for the room.

21. Drag your game objects from the Resources area and drop them directly on the background. If you cannot do

this then make sure that the Instances layer is selected. You room now looks like:

Page 10: Getting Started in GameMaker Studio 2.x The general steps ...staff · C. Create Game Objects from Game Elements. D. Add functionality to the Game Objects through mapping Events with
Page 11: Getting Started in GameMaker Studio 2.x The general steps ...staff · C. Create Game Objects from Game Elements. D. Add functionality to the Game Objects through mapping Events with

22. Double click the pumpkinobj object. You see the object editor window open.

You are going to add an Event that your object will listen for and define an action to take when the event happens.

Page 12: Getting Started in GameMaker Studio 2.x The general steps ...staff · C. Create Game Objects from Game Elements. D. Add functionality to the Game Objects through mapping Events with

23. Click the Add Event button, choose Key Down, and choose Left:

You see the Action window open to the right:

Page 13: Getting Started in GameMaker Studio 2.x The general steps ...staff · C. Create Game Objects from Game Elements. D. Add functionality to the Game Objects through mapping Events with

The actions are a set of icons that can be dragged into the Key Press Left area.

24. In the Toolbox area type the word Speed. This displays all the actions that relate to movement speed. There

should be an icon under the Movement section.

25. Drag this into the blank area to the left of the icon list.

Page 14: Getting Started in GameMaker Studio 2.x The general steps ...staff · C. Create Game Objects from Game Elements. D. Add functionality to the Game Objects through mapping Events with

The Set Speed action is relative to the Direction the object is heading. That is, the speed will send the object in the

direction specified by the Direction action.

26. Enter the value 5 for the speed. You will next set the direction. In GameMaker a direction is a degree angle with

zero being to the right and 180 being to the left and 90 being straight up.

27. Click and search on Direction. You see a set of direction icons. Move the mouse over these icons until you see

the one for Fixed.

Page 15: Getting Started in GameMaker Studio 2.x The general steps ...staff · C. Create Game Objects from Game Elements. D. Add functionality to the Game Objects through mapping Events with

28. Drag this direction icon next to speed.

29. Click the left facing arrow to set the direction.

Page 16: Getting Started in GameMaker Studio 2.x The general steps ...staff · C. Create Game Objects from Game Elements. D. Add functionality to the Game Objects through mapping Events with

You have now told GameMaker that each time the left mouse button is pressed the object will move to the left at 5

pixels a second.

30. Repeat these same steps but first choose the Event Key Press Right. Make sure the speed is the same (5) but

click the right facing arrow rather than the left:

Page 17: Getting Started in GameMaker Studio 2.x The general steps ...staff · C. Create Game Objects from Game Elements. D. Add functionality to the Game Objects through mapping Events with

You now have a game that allows the player to move the pumpkin left and right. The problem is that when the left and

right keys are released the pumpkin will keep moving. Pressing a key and releasing a key are two different events.

31. Select the Event Key Up/ Any and add the action Speed = 0

Page 18: Getting Started in GameMaker Studio 2.x The general steps ...staff · C. Create Game Objects from Game Elements. D. Add functionality to the Game Objects through mapping Events with

32. Click the File menu and choose Save Project.

33. Click the Run button to run your game.

GameMaker will build and run your game. You should be able to move the pumpkin left/right with the keyboard.

Note: To run the sample, open the linked zip file, drag the two contained files to your desktop, and run the EXE file.