Day 73 (Last Post... maybe)

Today is the last day of school and possibly my last post.

At the beginning of the semester I started being independent, which means that I get marked on whatever I do and I have to blog every day about it. I started watching tutorials and such on how to program in GML and I got kinda good at it. I then started the tutorial on how to make my first game which was a space invaders type game where you shoot balloons with a plane. After I finished that game I went on to working on a platformer. I encountered a lot of bugs and problems that I had to fix and the struggle was real. The game took about 50 classes to make and I also polished it to the best of my ability. After that I started working on this top-down game and I didn't get to finish it, but I might work on it over the summer.

To anyone who reads this I would like to say some advice. You should have a decent understanding of the GML language before you start making games, and don't just copy YouTube videos because that just copying someone else's work and not yours. It is OK to borrow someone else code but not everything in the code.

I had fun this semester and I hope I can continue next year and be an independent.

Day 72

Today I restarted my level.

My outside of school friend gave me an idea of a game.  It is kinda like a huge battle field game with guns (kinda like a 2d version of planetside 2) So I started on the map. I made it very huge 16k x 16k tiles in length. I didn't get very much done in class because I tried to tile the ground but it's kind of hard to do on 16k x 16k.

Here is my progress

So ya tomorrow is the last day of school so I will write up a bit on what i've learnt this entire semester.

Day 71

Today I fixed my cursor problem and worked on other things.

I actually found out that Howard fixed my cursor while I was gone because Kody had told him that I needed help with that. The code that he put was cursor_sprite=spr_sword_cursor; it was that easy of a fix, but I thank Howard because he fixed it.

After that I started working on adding trees. I used the trees from my previous level but this time instead of making individual tiles I made a parent object for the tree and inside I set it so that its depth = -y which makes it so that you can go behind and in front if the tree depending on your Y position. So for example if your y is 5 and the tree Y is 4, your y becomes -5 and the tree y becomes -4 which means you would go under that part of the tree. This is a very simple mechanism especially for top-down games.

Next class I will be working on some other stuff.

Day 70

Today I finally fixed my problem for the enemy death. I found out I forgot to add this code inside the enemy animation code...

if hp > 0
{
//code here
}
And it worked! Here is the result:
I tried to record in higher fps with a different GIF recording tool called "Giffing Tool", but you have to pay to remove the watermark so i'll only use it in emergencies if you want to see all the frames without cutting any.

At the end I worked on a new level. I made the room size 2000x2000 and I put grass everywhere, one golbin, and a few chicken herds in random places. I loaded up the level and my mouse cursor wouldn't appear and I placed it in the room.

Tomorrow I will work on fixing the mouse cursor because it's probably an easy fix such as the camera not being centered.

Day 69

Turns out I didn't actually fix it... It still does it sometimes and it is bugging really hard. I was looking through my code and couldn't find anything to fix it. So I moved on to something else.

While I was looking through reddit/gamemaker I found this post that showed a tutorial of how to make a chicken herd Here. I followed the tutorial (and no, I didn't just copy and paste the code, I followed the tutorial and read the code and I understand how it works) and it worked! I now have a chicken herd.

Tomorrow I will be working on something else.

Day 68

Today I finally fixed my problem of the goblin animation.

Most of the class today I was helping out Kody Brooks with his programming in GML but I still got some work done.

I removed my death state because it didn't really make sense. And I added this code inside of the current states:
if hp <= 0
{
    state = scr_enemy_static
}

What this does is that it changes to the static state (or idle state) then inside of the static state I put this:

if hp <= 0
{
    sprite_index = spr_goblin_death;
    image_speed = 0.3;
}

I made the actual sprite switch inside of the idle state, And it worked!

Tomorrow I will be working more on the goblin AI.

Day 67

Today I worked more on my enemy death.

I tried changing some things inside the goblin but I could never figure out why the death animation only activates when I'm touching the goblin. I made a new event inside of the goblin called "Animation End" and made it so that when the death animation of the goblin ends, to destroy the instance of the goblin. But that still didn't work.

I tried to do everything this class but I can't figure out why it doesn't play the animation,

Tomorrow I will try more things or post online for help.

Day 66

Today I worked on the death animation of my Goblin enemy.

I added a new state and called is scr_enemy_death() and inside I added:

enemyspeed = 0;
sprite_index = spr_goblin_death;

if image_index = 9
{
    image_speed = 0;
    alarm[2] = 60;
}

This code changes the current sprite of the enemy to the death sprite. But when he changes it just freezes for some reason and I can't figure out why. 

Next class I will try to figure this out.

Day 65

Today I didn't do much because I helped out Zack for most of the class inside of scratch (because scratch is like the basics of progamming). But what I did today was that I fixed some parts of the enemy AI.

I edited his code because he would keep running into a wall sometimes until it was his turn to turn into the other side. So I added a code that made it so that when he is 5 pixels away from the wall and he's walking in that direction, that he would automatically do a 180 degree turn and walk that way until the direction changes again.

(I can't really add a GIF because it's a random chance that this happens)

Tomorrow I will work on some other things inside of my game.

Day 64

Today I made it so that you can kill the goblin (finally).

I started off the class thinking of how I can make the attack work, and I came up with the idea to make a separate object that gets created when you attack and does the damage (a hitbox). I made the object and called it obj_hitbox and I made the sprite a red box. Inside I made Step event and said

if place_meeting(x, y, obj_goblin)

                                                     {

                                                            goblin.hp -= global.weapondamage;
                                                            alarm[0] = 1;

                                                      }

Pretty much what this code does is that checks if the object (obj_hitbox) is colliding with the goblin (obj_goblin) and if so, then remove the weapondamage's amount from goblin's hp, then in 1 frame run the code that is inside alarm 0 which is instance_destory(), this code destroys the object (obj_hitbox).

I tested it and it worked but there was one problem, the hitbox kept getting created inside the same place no matter in which direction you were attacking. So I came up with the idea that I would make multiple hitboxes for every direction that I'm attacking.

So i started by duplicating the current attack sprites (up, down, left, right)
and then deleting all the frames only the one that actually attacks. Then I would make a red square over the hitbox then delete the rest of the player.

Like This




I did this to all the directions of attacking and then I made different hitbox objects for all the directions with the same code. Then in my attacking code I added instance_create(x,y,obj_hitbox_<direction>).

This is the result
The red hitbox just shows the hitbox of my attack but I can make it non visible whenever I want to

Tomorrow I will work on some bug fixes on the goblin and maybe my player.



Day 63

Today I worked on the attacking more. I finally fixed the attacking because I found the problem was that I made the image_index (which tells which frame of the sprite to use) for my spr_player (which has all the frames for up, down, left, right, inside of it) also somehow apply to my attack animation which was individually up,down,left,right. So I had to rewrite both the normal movement and the attack by adding individual sprites for every direction.

And I got my attacking to work :) (the GIF doesn't show the full attack animation, trust me it looks better in real life)

Then after this I worked on making it that so when the player stops moving, the sprite will stop moving and be set to the idle sprite. It wasn't that hard i just had to make 4 different individual sprites and set them to one frame that is the idle image for that direction. Then I had to make a variable that checks if the player is currently moving by saying if the horizontal speed or vertical speed is greater than 0 then moving equals true. Then I made it so that when moving equals to false, then set the object to the idle sprite in the current direction its facing.

Here is the result of the coding

At the end of class I thought of an amazing idea. I said that the player should face in the direction of the mouse and attack in that direction. So I had to change what the variable "dir" comes up as. And using the point_direction(x1,y1,x2,y2) made it so that it finds the X and Y of the mouse. Then I made it change depending on where the mouse is on a 360 degrees scale

if(dir > 45 && dir <= 135){ // Up }else if(dir > 135 && dir <= 225){ // Left }else if(dir > 225 && dir <= 315){ // Down }else if(dir > 315 || dir <= 45){ // Right }

This is the basic format of the code and I did the same thing with the attack.

Here is the result

Whew that was a lot of writing but it pays off XD

Tomorrow I will work on actually doing damage when the sword hits the enemy/goblin.


Day 62

Today I worked on the character attack animation for my player. I took it from the RPG set that I got online.

I put it in my game by adding a new variable called "attacking" that comes up either true or false depending on whether you're attacking or not. Then in my obj_player's step event I made a new script and called it "attacking" and inside i made it so that if i'm currently attacking to set it to "true".

It took a while to write all the code (most of the class)

When i finally finished i tried it out, it attacked in the right direction, BUT it would keep glitching out and not doing the complete animation for the attack.

Sorry I don't have any images or pictures because I ran out of time during class (i'm writing this from home)

Tomorrow I will try to fix the attack.

Day 61

Today I worked on my top down game.

I got new sprites for my player using this website
http://gaurav.munjal.us/Universal-LPC-Spritesheet-Character-Generator/


Then I implemented them into the game

Then I tried to add my attack into the game but barely got any progress because I couldn't figure out how to make it stay with the player.

Tomorrow I will try to implement the damage by the player.

Day 60

Today I found a way to get my game from last class back. I looked into the files and found out the game wasn't deleted, it just couldn't load it. So, i copied all the files except the one that loads the project and it worked!! I got my game back.

The objective of this game is to get 50,000 points by shooting a moving tower. Here is some gameplay

End screen

So ya that's all folks.

Tomorrow I will actually get back to my game.

Day 59

Today I worked on something not as serious. I tried to make a version of Wesley's scratch game on his site http://wesleybegg2016.blogspot.ca/. It was about where you have to shoot down the twin towers like in 9/11 but i tried to make it better. I spent the class doing things like adding sprites, movement, and shooting. It was pretty easy to make it only took me like half an hour to make. BUT, I didn't do something that Mr. Bilesky always tells me to do, I didn't save. Game maker crashed for some reason and I didn't get to save the game. :( So now I wasted an entire class for nothing.

Tomorrow I will try to get back to my game and work.

Day 58

Today I worked on a sprite for my attack animation. I finished it but I still don't think it looks that good.

This is my hard work XD

I can't do better than that for an attack animation. 
I actually spent almost the entire class trying to make it to the best of my ability.

At the beginning of the class I watched some tutorial videos on how to make a proper functioning attack with hitbox. 


Tomorrow I will try to implement attacking into the game.

Day 57

Today I fixed my problem.

I was right last class, the problem was because I didn't center my sprite in my game.

Now it looks good.

The rest of the class I was looking at some tutorials of how to fix some bugs such as: the enemy idle path being the same every time I play the game. So to fix this I had to put randomize(); at the beginning of the code. It's that easy to fix and make everything random :).


Tomorrow I will try to add an attack to the game.

Day 56

Today I found some sprites for my goblin.

I went on opengameart and found some good sprites for my goblin.

I started implementing them into my game. But there is a problem, whenever my sprite flips, it flips completely.

Looking at it now it's probably because I didn't center the goblin sprite.

Tomorrow I will work on more AI mechanics and try to fix the flip.

Day 55

Today I had a lot of fun.

I made a new enemy with no specific sprite yet but I want him to be a goblin. So I started working on the enemy AI. I made these things called "states" which tell at what state the enemy is currently in. I currently have 3 states: static, follow, and attack. Static state is the state where he just walks around randomly and doing nothing else. Follow state is the state where when the player get close enough and the enemy can see him, the enemy then starts to follow the player. If the enemy gets near enough to the player, he changes to his attack state where he starts attacking the player and doing damage.

Oh I forgot to mention i made a health-bar :) I made it by making the red part get shorter the lower my hp is. 

Tomorrow I will work on something else I haven't quite figured out yet.

Day 53

Today Mr. Bilesky suggested that I keep working on my old game to "polish" it up because there is not much time left to start a new game. So i started to work on polishing up my game by adding things like scores etc. I started by removing Resets from the game and adding 1 to deaths every time I reset the game. Then I replaced resets with score. I gave each piece of item in the game a certain score that it adds.

Jump = 100
Walljump = 250
Speed = 500
Jump = 500
Killing Enemy = 1000

Then I made it so that the higher combo I have the more score I get per action by multiplying the score by combo. ex. If I kill an enemy add (1000) * (global.combo) so if the combo is 5 it would add 5000 to my score.

Then I thought "would it broken if the player could just keep resetting the room and the score doesn't change" so I wanted to fix that. I made a controller object and gave it a variable called "previousscore" and made it so that when I go to the next level that previousscore = score so that it saves the score at the beginning of the level. Then I made it when room start that the score would go back to previousscore when the room started.

So when someone resets it goes back to the score it was when the room started.

Tomorrow I will work on "polishing" up more things.

Day 52

Today I worked on my new game. I added a few new things such as a smooth camera movement. I took this code from one of Shaun Spalding's game called "life is short". I didn't want to code it myself and he made the code free to use. I understand how his code works, the movement slows down the closer it gets to the cursor.
As you can see, I also added a mini sprite to the game the I found online. I haven't fully got him to work yet by changing his direction etc.

Tomorrow I will work on my sprite and movement to make sure it works properly.

Day 51

Today Mr. Bilesky showed me to Ty. I showed him my game and what it can do. He taught me some new things to do. He told me how to change my game to make it a bit easier by changing the amount of time it jumps off, so you have a faster reaction time at wall jumps. He then showed me around on his game and what he did with his game. His game looks cool, it has good graphics that he made himself. His game is a 2D platformer. He hadn't done much story wise, he just has a hub where he tests out everything.

Tomorrow I will work on my new game and get some things set up.

Day 50

Today I looked around to try and maybe start a new engine.
I looked at engines like unity and unreal.
Unity has a lot of cool games with it such as games like: Rust (a PvP survival game) Assassins creed Identity etc.

After that I said I wasn't gonna start a new engine because I still haven't done anything "amazing" with game maker and there is so much more i can do.

So i started planning for a new game. My classmates: Quinn and Zack helped me plan.

Here is what I have so far:

New Game Ideas

Top Down Medieval Game

Enemies:
Goblins
Orcs
Dragon

Wild Animals:
Sheep (Wool for crafting)
Cows (Food when killed)
Horse (ridable when tamed)
Wolf (tamable) (hostile when not tamed)
Dire Wolves (only appear during winter, hostile)
Chickens (eggs)
Bears (hostile, untamable)

Seasons:
Spring
Summer
Fall
Winter

I think once this game is done it will look good. This game will take a long time to make but it will be worth the time to make.

I will do more planning tomorrow and maybe start a bit if I finished all ideas.

Day 49

Today I finally finished my game.

I checked to see on Reddit but no one responded so I had an idea to just make the font lower and the space between the levels smaller so i could fit all the levels in, and this is what i got.

Then I just worked on some minor changes like sound combo bugs etc.

Then i added a new piece of text to the final level.
:)

Tomorrow I might start a new engine to work on.

Day 48

Today I pretty much finished my game.

At the beginning of class i did something i probably should've done a while ago. I made the obj_player draw all of the combos, resets, and deaths, instead of the certain objects to draw it. That way the texts only appear when my obj_player is in the room and never anywhere else (for example main menu which was there for a while but i was just too lazy to get rid of). Then I worked a bit on the last level of the game. I added a text saying "The End" and a text underneath saying "Press 'R' to restart" and I made that true.
I still couldn't figure out how to make scrolling text for the level select menu so I asked around on reddit.

 https://www.reddit.com/r/gamemaker/comments/4jmfa1/how_do_i_make_scrolling_text_in_a_menu/
I still haven't got an answer and its the end of class.

Tomorrow if I get an answer I will try to put that in my game.

Day 47

Today I finished my last level. I finished the last part of my level today. I added a high jump after the last part from yesterday and the enemy.
After that i started looking online for how to make scrolling text and i found this.

I wanted to implement it into my level select screen and I couldn't figure out how.

Tomorrow I will implement scrolling into my level select menu so I can fit more levels.

Day 46

Today I worked on a new powerup and a new level.

I started off on the level by working on a new jump power. It works the same as the speed powerup but instead it inscreases the jump speed from 7 to 10. I made the sprite for the powerup to mario jumping.
Then i tried many things to test the level but its very hard because of the new jump powerup. So i only got halfway done today.
This is the new level

Tomorrow I will work on finishing the level and continuing the next part that leads to the end.

Day 45

Today I worked on the mute button.
I finally got a response on Reddit and someone told me to check out all the audio commands in Game Maker so I did. And apparently there is a command called audio_master_gain(); which you can set the gain for ALL the sounds (master). So i put that into my game code to set the master gain to 0 when i press the mute button, and it worked! Then I wanted to put the code inside the step event so I could have it so that when you press "M"  OR you press the left mouse button it would mute/unmute. So I made a variable called mouse_left and set its value to mouse_check_button_released(mb_left); and then I made a variable called key_m and set its value to keyboard_check_pressed(ord("M")); Then I added an "if" statement and said that if key_m or mouse_left return true then execute audio_master_gain(); and change the sprite to the muted sprite.

Tomorrow I might start finishing up my game by adding a new last level, working on sprites, and an end screen.

Day 44

Today I worked on a new pause menu. I made the pause menu interactive so that you can exit to main menu and restart and continue the level.

The code was almost the exact same as the main menu and level select menus I only had to add a new variable called "pause" where the code would only activate if i press pause. And then I made a new script called scr_pause where I added the cases for the arrays that will activate. 

In the last bit of class I tried to find out how to add arrays but I still couldn't figure out how. So i asked around on reddit to see if anyone had the answer for my question, but i haven't gotten a response yet.

Tomorrow I will see if anyone responds on reddit.

Day 43

Today was a shortened block and I couldn't do as much work today. Today I wanted to add multiple values to one variable but I couldn't figure out how to. So i googled it and I found something called an array. An array is a way that you can add multiple values to one variable. The syntax kinda looks like this

array[2] = 0;
array[1] = 0;
array[0] = 0;


This is defining the array variable with a certain number or value. You can then pull out that certain value of that number like this.

Switch(array){

case 1
 {
//code here
 }
}

case 1 pull out the value from array[1] case 2 pulls out array[2] etc. if you know what i mean.
I used this for the tutorial:
http://docs.yoyogames.com/source/dadiospice/002_reference/001_gml%20language%20overview/401_06_arrays.html

I wanted to add all my sounds into one variable called audio. So that when I press the mute button i can use audio_sound_gain(audio,0,0) so that the volume goes to 0.

Tomorrow I will find a way to work with arrays in my game and mute the sound.

Day 42

Today I worked on a lot of stuff. I started off the day by working on a new level.


I didn't have time to add it to the level select menu but it's fun :). It took a lot of time to test the level closely to make it work. I got my friends to test it out for me too. After that i tried to work on a new thing that mutes the game like a little speaker at the bottom of the game.

I tried doing many things but the game would just keep crashing every time i tried it. I think I know whats wrong and I will try to fix it next day.

I also worked on new slopes that i added to my level.


This week I learned a lot of things. I learned how to make the sound play only once when the variable equals that ammount I also learned how to add new slope sizes into the game, i learned how to add a new speed powerup. This week was fun.

Next day I will work on fixing the audio mute and some other problems.

Day 41

Today I worked on a new power up that adds speed whenever i pick it up. My movement speed goes from 0.3 to 0.5. I made the sprite of the powerup Sonic because, you know, Sonic is fast....
I did a lot of coding to make this work. I added a new variable called speed_powerup and made it so that when i pick it up my movement speed increases to 0.5 and plays a distorted version of the sonic theme until I die, reset or go to the next level.

I tried to change the player sprite too to sonic once i pick it up but I couldn't figure it out.

Tomorrow I will work on a new level.

Day 40

Today I did some cool things. I changed the sprite for the current red block enemy and set image_speed to 0.3

I think it looks very cool imo compared to the normal red block because they share the same things (only way to kill is to jump on them). After this I added more sound effects to the game. I counted a total of 6 possible combos on the last level so I had to make sound effects for combos:4, 5, and 6. 

This game become an MLG parody of my original game. Quinn suggested I should make the game "MLG" and add all these "weed" sound effects for the laughs lol. (The humor of this generation is very weird and strange so don't be confused)

Then Zack suggested I should add another goomba to that part of Level seven so I could have a total of 7 combos. And then I added another sound effect for the 7th combo. 

Tomorrow I will add a new powerup to the game.

Day 39

I got a reply on my Reddit post about on how to do the code that I've been trying to fix for the past 2 days. And the code that he sent me worked. I just need to edit it so that it works for all my powerups.

OK so I made some changes to the code and added it to the rest of my objects (powerups, and enemies) and it works. 

I made a controller object to which i assigned all the code to try to make it consistent throughout all levels but it still wouldn't work.

Then I made a draw event in the controller object and made it so that it writes Combo: (combo amount) so it is easier to tell how much you have.
Class is coming to an end, and today I learned how to make a sound play only once when you have that amount in a variable thanks to the person who helped me out on Reddit.

Tomorrow I will be working on something new. I might change the sprite for the enemy and maybe make it a goomba (lol). 

Day 38

Today was very unproductive. I couldn't figure out how to fix my sound problem. I spent the entire class trying to troubleshoot. I tried making an Alarm event (timer) to reset it etc. but that couldn't fix it either. I asked online for help https://www.reddit.com/r/gamemaker/comments/4h003g/help_with_sounds/

But i'm still waiting for an answer and class is nearing its end. I'm trying to do everything i can to fix this problem and I don't know what else to work on while I wait.

Once I fix it, it will be very good experience for me and I will know how to fix it from now on.

Tomorrow I will work on a new level until I can fix this problem completely.

Day 37

Today I added some cool sound effects to the game. I added some sound effects when you pick up powerups and kill enemys, and they work. The sounds and camera shake add some juicy effects to the game. I tried to make it so that if i have a certain combo play this sound (you get combo from killing enemies or picking up powerups). But the sound would play continuously whenever its stuck at 3 combo. I know why this happens i just don't know how to fix it.

Tomorrow I will try to fix this problem of mine.

Day 36

Today I worked on some cool effects to the game. I started off by adding a resets counter at the top of the screen beside the death count. this counts how many time you reset the game so you can't just keep resetting when you're about to die.

Then I added something that isn't so serious, I turned all the jump sprites into illuminati sprites which was a joke that Quinn told me to do.

In the last bit of class I worked on a camera shake whenever I touch the powerups or kill an Enemy.

I used this video to help me: https://www.youtube.com/watch?v=TIA9-dPGiUM

Tomorrow I might add more effects or add more sprites depending on how I feel.

Day 35

Today I worked on a new level for my game. It took a while to make this and i was moving very slow because i had to keep testing it every 2 seconds to make sure it worked. But I finally finished it.

I combined the jump and walljump powerups together in this level. This level was more of a test than an actual level for my game so i might not add it in the final version. 

After i finished that I changed my sprite masks because the collision was too far apart and if i made it percise, it would be very buggy.

Tomorrow I will work on something new or I might work on my sprites (i said this 100 times by now and I haven't worked on it yet) 

Day 34

Today at the beginning of the class I worked on making the movement be continuous when moving to the next room. Before when i went into a new room my player would stop moving and I would have to press the move key again. I used keyboard_check_direct(); instead of keyboard_check(); and it worked, i got continuous movement when moving to the next level.

Like this

Then after that I worked on making a pause menu for my game. I made a controller object (which is an object that has no sprite but does something), made it persistent so I only have to put it in one room and it's always persistent, then i made the code:

Create Event:

Step Event:

Draw Event:

In the create event i made the variable called "pause" and i set it to 0 (false), then in the step event i made the code that activates the pause menu (if i press the escape button pause the game) using the step event is best because it's the fastest event, it's always run continuously. Then in the draw event i draw the pause menu and what shows when pause is active.

This is the pause screen for now

Tomorrow i will work on making my sprites or something else.

Day 33

Today I worked on a new powerup and a new level. The new powerup adds an extra wall jump i pick it up.
 This is the new level (Level Six)

Here is how the powerup works

This will be very cool later on. I will combine my powerups together and make the levels super hard.

I also added Level six to the Level Select menu.

Then on the last bit of class I added RESET button. If you press "R" it restarts the level and doesn't add to your death count. This is very useful especially if you mess up and fall down or get stuck somewhere.
Reset by pressing "R"

Tomorrow I will either work on sprites if feel like it or i might work on new levels and new enemys etc.