advancedkasce.blogg.se

Game maker studio 2 documentation
Game maker studio 2 documentation







game maker studio 2 documentation

If the object is in the room when the game starts, this code will run once when the game starts.Ī Step event, on the other hand, will run every step of the game, which for us should be 60 times every second. For example, a Create event will run only once, right when the object is created. We will be using an event to make our player move around the screen.Įvents are blocks of code attached to objects that run when that event happens. This is going to be pretty simple code, so don’t worry. The next step is to finally get into some code to make our character move around on the screen. That’s because we haven’t given them anything to do, so they just stand where we’ve placed them. Now, you may notice that they don’t do anything. Hopefully, your player object shows up like the above screenshot. After a few moments, a window will pop up. Let’s make sure it all worked and press F5. Now your player object is in your room, and therefore part of the game. Now that our object has a gorgeous new stand in graphic to display, go to the room tab, then drag and drop obj_player from the resource tree into the room. Click where it currently says ‘No Sprite’ and select spr_player. Return to our player object by double-clicking its name in the resource tree. Now, we can attach the sprite to our character object, and put that object into our room. » MORE: Triplebyte Review: Is Triplebyte Right for You? The origin cursor will disappear and a grey box will show up on your sprite. Above your sprite’s preview, click Preview Mask. The Bounding Box is what lets the game engine know what your sprite is touching, known as Collision Detection. The only other thing to change is the Bounding Box, or Collision Mask. But, for now, let’s keep it at the bottom center. You can change this manually by clicking on the preview. You’ll also see the small crosshairs move on the sprite.

game maker studio 2 documentation

I’ve found that to be the best place when making a top-down game.Ĭhange the dropdown menu right above the preview of the sprite from top left to bottom center. And if you rotate your player, they will rotate around this point.įor now, let’s put the Origin at the player’s feet.

game maker studio 2 documentation

The Origin is the exact point that the game considers your player to be. Once you’ve finished, return to the main workspace.īefore attaching the sprite to our player, we will want to change a couple more options: the first is the sprite’s Origin. I used this opportunity to really flex my creative muscles, but you can make whatever you’d like. Just remember that for now, it will be appearing on a black background, so don’t make it black. Later, we can come back and draw some animated sprites that resemble more than a box.īut to get into making our prototype, we just need something that tells us where our player is and how big they are. Now, let’s draw something simple to represent our character. This will open up the sprite in a new sprite editor tab. Now that it’s the right size, let’s draw on it. Click the small box with four arrows under Image Size and set the width and height to 64×64 pixels under Scale Image. To navigate the workspace, use the scroll wheel to scroll or the middle mouse button to move around. objects, or that we just put in our scene to look pretty. Sprites don’t do anything, they are just pictures that are sometimes animated that we attach to things that have code, i.e. Sprites are the game dev word for images. Right-click the Sprites section of the Resource Tree, then click Create Sprite. Let’s make a new Sprite and then add it to the player object. That’s because it doesn’t have a Sprite yet. Right now, unfortunately, our player object looks like nothing. It’s also useful if you want to name two different things the same name, like obj_player (for the object) and spr_player (for the sprite). It can become tricky to remember what’s what, so this helps with organization. We do this because we will often have to mention the names of things in our code. That way, they know if what they are using is an object or something else. For example, many people will name their objects obj_somthing or Osomething. It’s a really good idea to name things in a way that will tell you what they are.









Game maker studio 2 documentation