Hi gang, sorry for not posting last friday (though honestly there wasn’t really much to talk about other than that Ato is still coming along…zzz)
Although it’s not like anyone really reads these because I don’t have 1,000,000+ followers and 50 million likes on my ebaumsworld and I don’t make enough money and I don’t-…yadayadayadayada-…
Escape the evil tomb of Rah! Collect treasures, like magical gold scarabs and the legendary sword of Rah. Avoid the enemies and score big big big cha-ching…????…????…………………????…
It does not contain viruses, it was made in Game Maker 8.1. (click Start to play)
Arrow Keys – Move
Z – Use Scarab, scares mummies and makes them killable
X – Activate Sword
There is only One Level. I think there’s a time limit too
GMA taught me about making something cool…
This game can essentially be considered the final culmination of everything that has been learned from The Game Maker’s Apprentice book.
The biggest thing with this game was learning to take all of the different design elements, like pickups, enemy types, special abilities and combine it all to create a more fuller game experience (even though the experience may be short).
Some of the biggest aspects that I remember the tutorial emphasizing was the grid-based movement system, much like old school RPGs where you’re locked into a grid even though there is movement. Essentially this is achieved (at least in the tutorial way) by initiating a variable, let’s say “canmove=true”. if we’re in a part of our grid that when rounded down makes it a whole number, canmove is set to true, however when it is not, then it is false.
if x mod 32 == 0
___canmove = true
The first if statement makes sure we are in a 32 rounded position, so every 32, 64, 96, etc spot on our grid will always work no matter how big our room is. (modulo essentially is just divide, but instead gives us a remainder value (super useful!))
When canmove is true, we can then have it check for an input, which in our case is one of the directionals.
if canmove == true //(we are still and awaiting to press a movement key)
else //(we are moving and cannot press a button until we hit a grid spot)
___if x mod 32 == 0
___canmove = true
This code might look complex, (though honestly this is a really tu-toriel (I’m sorry) way of doing this) but basically, whenever we are moving, we prevent any inputs from being read and still keep applying speed. However when we are in a rounded position, i’ll take the same code as before and make us then stop moving, allowing us ot read our next input. Obvious I cut the input section short (keyboard_check_pressed) and didn’t wright inputs for left,right and down but I think you get the idea…
I won’t go too much in depth, but there were other mechanics like the lighting system, scarab power, sword ability and (to me the most intriguing one) the mummy AI.
I think the lighting system was using a sprite of a circle, and we ran some fancy code to mask out a hollowed out circle, so essentially we made a cookie cutter template and instead the dough covers our screen and we made a round hole in the center. A pretty decent way to get cartoon platforming transition effects as well.
Scarab and sword power
Not gonna go super in depth here, the scarab when touched, adds +1 to a scarab counter for the global variable.
global.scarabcount += 1;
and if we use one we check to make sure we have one and just remove it from our inventory.
if keyboard_check_pressed(ord(‘z’)) && global.scarabcount > 0
___alarm(0)=300; //activate our scarab ability timer!
The sword is actually very similar, except it tracks gold and is based on a held input state. The only different is I think it swapped a larger circle sprite for the light mask.
Hoo boy, I can’t really remember too well how the mummy AI worked, but I can still give my own insight as to how I think it was coded…
Basically the mummy object has 4 different states, “wander“, “search“, “chase“, “flee“.
When it is in wander state, it will just randomly choose a direction to move when it’s canmove==true. (see how it comes around again?). if it wanted to move into a direction but runs into a wall, it chooses a different direction. Now if we use a special command called distance_to_object(obj_player), we can grab the range from which the mummy and the player are and use this to change it’s state, which if it’s senses we’re nearby, it enters it’s search state.
When it is searching for us, I think it speeds up it’s movement slightly and will generally favor moving in a direction that could be towards us based on randomness. I believe if it happens to roll the right number when it’s canmove is true, then it’ll choose a move direction that would likely move it towards us. Which I think it also uses a direction check to then decide which way to go since it only moves in 4 directions.
Now for the mummy to enter its chase state, we need to use !collision_line(x,y,obj_player.x,obj_player.y,obj_block,0,0), this simulates vision for the AI. Don’t fret too much if this looks super complicated, all it’s trying to do is check if there’s a wall between itself and the player. obviously it wouldn’t make much sense for it to see us through the walls, so we use this function to check for that. Combine this with a distance check to the player, and if it’s close enough and there’s no wall between us and the mummy, the mummy will chase us! Oh noes!! Now it tries to choose directions that will likely move towards us Aaaah!!
So what about the fabled flee state? how does this happen? How do? What do? How is? Why was? Who could? When should? Who what where when how?
So whenever we activate our sword ability, we run some code to tell all mummies to enter flee state and set their flee alarm to a certain value. From the player’s side this is what it might look like…
if keyboard_check_pressed(ord(‘x’)) && global.goldcount > 0
_________RUN LIKE HELL (you get the idea…)
This code snippet just simulates what it might look like (again this is just tutorial level coding and not advanced Einstein rocket science elitist code).
Anyways that was definitely super technical and anime, but I hope maybe this gave you some insight as to how some this very last Game Maker’s Apprentice game was made. As you may know, this was only the stepping stone to bigger and more challenging prospects. I hope that by sharing this, you’ll see that I came from a background where I had absolutely no clue how to program, I didn’t understand how to logically code/script games and through carefully studying tutorials and open source code, it eventually got me to where I am today…
…a guy who still makes games and isn’t making any money
A guy who can make teh vidya gabens.
I will likely continue sharing my old works, abandoned projects, test code, game projects I studied that I learned from…you name it!
Hope you enjoyed the read!