Game Maker Platform Shooter
Making top 2D games with the GameMaker: Studio game engine is easy. No code or programming required. Jun 22, 2010 A short game maker tutorial on how to make your player shoot in platform games. Platformer Basics [Article]. This tutorial assumes you have basic knowledge of Game Maker. Beginners find it hard to realize that a platform game is not an.
Platformer Basics [Article] Posted on: May 4, 2014 at 7:49 pm, Assumptions: This tutorial assumes you have basic knowledge of Game Maker: Studio. You should know how events and actions work at a very basic level, understand very simple GML code and that you know how to make sprites and objects and organize them in rooms. Making a platformer seems to be an incredibly common stumbling block in the career of many a budding game designer. They want to start ‘simple’ they tell themselves. So they task themselves with putting together a ‘basic’ platform game only to run headfirst into a lot of problems. Beginners find it hard to realize that a platform game is not an inherently ‘simple’ thing. And using the built in gravity and collision tools like solid can sometimes be flimsy and hard to work with.
This tutorial hopes to show you how to put the basics of a platform engine together in pure GML code, without pulling your hair out and using only about 40 lines of code. Game Maker does make platformers easily, but it’s perhaps not as intuitively easy as many would guess. The basic set up So let’s start with the essentials. We’re going to need a room, two sprites and two objects. Name the sprites “ spr_player” and “ spr_wall” and the objects “ obj_player” and “ obj_wall“. Link the sprites to the objects and make sure to center the origin coordinates on your player and wall sprites. Now we have all of the pieces, how do we start to build the logic for our platformer?
Well we need to start out by establishing a few variables (numbers) in our player object, that we can use to decide how quickly to move, how high to jump, how powerful gravity will be and so on. Calibre Removing Page Numbers From Pdf. So go ahead and open up obj_player and add the create event.
The only action we need for this event is the good old “ Execute a piece of code” action found in the control tab of actions, under code. It’s this little icon: Now you can insert the following code. ///Initialize Variables grav = 0.2; hsp = 0; vsp = 0; jumpspeed = 7; movespeed = 4; (Using three slashes for a comment instead of two changes the name of the action in the object editor which can be useful for tracking what the code does.) Now instead of using ‘gravity’, ‘hspeed’ and ‘vspeed’ which are built in GM variables you can see we’ve opted to use our own made up variables for these effects called ‘grav’, ‘hsp’ and so on. This is because we’re going to implement gravity and movement by ourselves so that we keep complete control over what’s going on in the game. All we’re doing here is setting up some numbers for our code in the step event to use. Player Inputs Now that we have these variables ready, go ahead and add the step event to obj_player and create another ‘execute code’ action. This is where the rest of the code will go and is what will be executed by the player object on every single frame.
The first thing we need to do is get the player’s inputs at the start of the frame. This is to ask the question “What keys are currently being pressed?”. //Get the player's input key_right = keyboard_check ( vk_right ); key_left = - keyboard_check ( vk_left ); key_jump = keyboard_check_pressed ( vk_space ); So we’re doing more of the same really. Filling up variables with numbers.
“ keyboard_check” will return a 1 or a 0 depending on if the key in brackets is being pressed. You can substitute vk_right, vk_left and so on with ord(“A”) and ord (“D”) or whatever other keyboard letters you want to use. We do this in the step event because the state of our keys changes on every frame. So we need to know at the start of every frame what buttons are being pressed. Key left is set up to return either -1 or 0 instead of 1 or 0 by putting a negative sign infront of keyboard_check.
Install Software Of Bluetooth. This is so that we can add key_right and key_left together and end up with either 1 for right, -1 for left, or 0 for neutral/both keys. Which is exactly what we do next.
Your first game! Part 2: Shooting Stuff Posted on: March 10, 2015 at 1:01 am, Part 2 Drifting to a stop So now you hopefully have a spaceship that can drift endlessly through space.
Poignant perhaps, but it’s time to add some more. Before we get into firing projectiles we’re going to make a quick change to our player, to make him slowly decrease in speed over time. This is just done as a subtle aid to the player who otherwise has no way of slowing down other than to perform a 180 and press forwards, which while also trying to shoot things can be difficult if you have no friction at all! Doing this will also allow us to understand one of the most important object Events in GameMaker.