Hey everybody, I decided to make a whole game tutorial for GameMaker. Because there's so much stuff you can do in GM, I'll do one thing at a time per tutorial. In this one, I'll be focusing on creating a player and giving him movement!
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Making a Sprite
Ok, so, the first thing we need to do... Make a Player! You can do this by right clicking on sprites on one of the folders. Click "create Sprite" and then click "Edit Sprite". At the top bar, you will see a white rectangle next to the checkmark. Click on it, and make a 32 by 32 sprite. Draw it however you want, just make it facing you.
First step completed!
Step 2: Making Him Move
After clicking "Ok" for the sprite, we will actually make the object now. In another folder, right click "Objects" and click "create Object". Name him "Player", since that will be our player. There will be a box labeled "Sprite" and a small white box near it. Click on that and then click on your player sprite.
Now, click on "Add Event". There, you want to go to "Keyboard" and put in 4 commands, Keyboard "UP, LEFT, RIGHT, and DOWN". Do the same thing but with "Key Released".
Click on the Keyboard Left in your Events. Now, under the "move" menu, see the little green arrows? Click and drag that into your Actions. A popup will popup and click the direction you want the player to move when you press left (left of course). Change the speed to any speed you want. We will do 7 for now. Do the same thing for the other keyboard events, only changing the direction (of course).
For the keyboard release, do the same direction as the event (Key released left is left, Key released right is right etc), but change speed to 0.
Step 3: Putting Him in a Room (Final)
Alright. Now, in the folder, right click the "rooms" folder, and (as you may have guessed) click "create Room". A popup will popup (what else do popups do?) and click on the "objects" tab at the top left. There will be that same white square thing just like the sprites tab, and click on it, and click on your player. Left click a place on the room. Click "Ok" . Now to run it.
At the top of the screen in the menu bar, you'll see a small green triangle facing to the left. Click it, use the arrow keys, and watch your player move!
We'll get into animations, health, enemies, and so much more in future tutorials!