Welcome back to the project to make a silly farewell gift for a former employee while simultaneously trying to actually be productive. I don’t think anyone is more surprised than me that we’ve made it to day 3 and I’ve actually posted each day! So progress today was both really freaking great and terrible!
My internet was basically dead the entire time I came home from work. So my plans to use the wiki guide to provide you with text examples of all my code are straight up not happening for now. I’ve only got time to post this before my little bit of relax time before bed. If you have steam I’ll be providing a link to the game as it stands each night! So you get to see how it evolves each day.
Lets get to work.
This so far is what we’ve got going in terms of assets. I want to take a moment and say that I really feel that it should be spelled “assetts” and it drives me insane each time I screw up. I pronounce it “asset-ts” with separate t sounds. I’m digressing though.
We have the sprite for walls, sprite for happy happy, the sprite for happy when slapped, the background, and then object files for both the wall and the happy happy. Finally we have the playzone known as the “Room” and further titled “happyroom”.
I will be going through each ‘important’ part in a bit further detail so that you can understand why they are so important. Depending on how tired I get while typing or how awesome cube world looks (Liz is playing it) will dictate the level of detail you end up with. Don’t judge! I am a very unmotivated man lately.
Lets go over the sprites firstly. These are the backbone of objects because without them your objects would be invisible. Sometimes you’ll want invisible objects! You’ll see what I mean when we get to scoring later. You’ll notice I haven’t added the scorebox yet. I haven’t even added in the scoring mechanism. The lack of a snowball object also hints that we have not added the “combat” portion yet.
So what are we looking at here? The Name is simply the name that the file will be known as universally across your project. Anytime you reference “spr_wall” you will be referencing this specific file. This is all case sensitive so I highly highly highly suggest that you name everything lowercase and save yourself an immense amount of anal anguish (colloquially known as butthurt).
I’m going to not tell you what Load Sprite or Edit Sprite do because you are an adult and I respect you. The Width and Height are automatically determined by the input object and I’ll be damned if I know what subimages are yet. We’ll learn about those some other time because we are on a busy schedule and damn it that’s just how we roll!
The Origin is important for snapping and I usually just set that sucker to the center unless I’m feeling classy.
You’ll notice that the squares are interlocking (or appear to be because I’m awesome with polygons) and each one is centered on its center at a point on the 32 by 32 pixel squares that make up the “playfield” of the game. I’ve zoomed in for maximum awesome but in the actual game the distance from edge to edge on both the squares in game and the “Wall” is 32 by 32. There are 20 squares across which adds up to “640” which is entirely wonderful since our game is 640 by 640.
We’ll come back to this later when I show the final product of todays work.
Collision checking is pretty awesome and I’m going to need Happy’s help showing you just what it is. I’m sure most of you already know and are juggling fireballs of badass while you skim passed this to the parts that interest you.
But for the rest of us lets give it a looksee. Holy crap looksee is a word? Alright lets take a moment to let that sink in.
So we’ve got the details of the image. Then the helpful option of Show collision – this is important and you should do this. You already knew that though. You can zoom in and out to get a better idea of the mask you’ve built with the magnifiers and that’s incredibly crucial when dealing with tiny ass bullet sprites.
The General section is super OP and we won’t be discussing that today. If you have a complex model that will require dynamic (and multiple) masks on a single sprite that will be your jam. I’ve touched it before and ended worlds.
You may wish to avoid it for your first baby project.
The Bounding Box section is also a playground of buttons and numbers you can happily play with. Frankly I’ve left it on automatic most times and had no problems. If I get to a section where suddenly automatic punches me in the scrotum I’ll report it and discuss this in more detail.
Shape is important. You’ll notice that I chose “Ellipse” over “Precise”. The reason for this is I tried precise first and Happy was so damn hard to hit when he started moving that I hulked out internally and closed the game. We don’t want people closing the game. We want them slapping away and declaring that “god damn it I’m going to get the high score this time!” Or perhaps they’ll whip out cheat engine…I might consider that a win for design.
The ellipse works so well that I feel like he is a man who was designed for it. Totally Vitruvian man up in here.
Lets move down to the Background.
Well that was – um – exciting? Alright moving on to objects.
We’ve got the Name which was already covered above. For the sprite we’ve selected “spr_happyhappy” because that’s the sprite I want to use for this object. If I want to change the art for this sprite at any time (and indeed this did happen today) I can just edit the sprite in the sprites section and it will automatically be corrected here. Don’t forget hit boxes when altering sprites!
Visible means the object will be visible by the player. You will want to uncheck this for things like walls or other behind the scenes mechanical objects. The walls that you saw in the example above are not visible and as such you just see Happy bounce off of nothingness.
Solid means that the object will trigger bounce calls whenever the call is looking for a “solid” object. Anything that is marked as not Solid will usually just be passed through when an object “contacts” it. I rarely have a reason in my current projects to turn this off but it certainly has its uses. When I add the scorebox it will not be solid. Then again I won’t be adding in any bounce scripts for it either. The one place this could screw you is if you have a bounce check that looks for “all solid objects” but we are getting ahead of ourselves.
Persistent means that when you have multiple rooms in a game that the object will appear in the same place it is now in that new room. For now we don’t need this because we only have one room!
Use Physics means that your object will be using the physics engine in Gamemaker. We are not using this because it is a bit too hardcore for a project like this. Cool stuff though.
Depth is basically like layers from photoshop as best as I understand it. If you are using this you either know what you are doing or don’t realize you could probably do the same thing with more fun and more dynamic script options. Or maybe you are just like – deep – ya know?
I suppose we should get back to the room and show that before we move onto the scripting for today!
Look at that beautiful thing! Everything comes together! We’ve got the wall object which is visible in the editor (but won’t be in the game as you’ll see later), Happy sitting in the center ready to kick ass and take names, the background and the snow wall holding up the rear. It’s pretty solid and gives us an idea of how a photoshop file can be converted one layer at a time into an actual functional game environment.
This was something I didn’t get before and now that I do it feels really good. You should try it and if that doesn’t work I’m sure “ways to feel really good” will net you a few dozen great ideas if you Google it (especially with safe search off).
But what of the scripts?! What have I done today? As mentioned earlier I have used the very helpful script functions in game instead of written because of time constraints and my internet being Comcastic*!
This is the scripting for Happy. I actually have 0 scripts for the wall on the wall object because I can’t stand having things relating to the “important” object spread around. But if you have to move things there are very simple copy and paste tools in this that we can go over sometime.
Time for some explanations!
Create is a simple script event that means “When this file loads these commands will fire off!” I’ve got a move command going off the moment the game loads and I’m setting an “alarm” which is basically just a timer. It is setting the alarm to 30 which is how many frames until the alarm goes off. You will see the word steps all over the god damn place in this program. Steps just mean frames and whoever called them steps should be speared.
I’m sure there is some really smart reason for them being called steps but it confused the ever loving shit out of me.
The move function is pretty simple.
Applies to is simply asking what we want to be telling to move its sweet ass. The options are Self which means the object this command is added to, Other which is a dynamic variable meaning the object this object is interacting with, and finally Object: which lets you choose what you want to get jiggy.
Directions are pretty self explanatory. You click which ways you want that shit to move or even if you don’t want it moving at all.
Speed is the speed you want it to go. You can make this a number or have it part of a variable (which I WILL be doing in the next couple of days for reasons I’ll explain tomorrow or tonight we’ll see).
Relative means that instead of the speed being x it will be x + z where z was the speed before this script began. Setting this to relative would be stupid because the game just started so z would be 0.
…and breath! I’m getting tired! This is what you have to stop with for today! Tomorrow we’ll go over alarms, mouse clicks, and what to do when your snowman flips the fuck out and flies out of the screen off into the nether.
You can click here to get a copy of the current build of the game! I decided to just not rename it and presume that incredibly unfinished products can be called 1.0 releases. Works in other places I may or not be working at \0/!
[ Table of Contents]