Tuesday, February 6, 2018

Day 5

Today I will be adding some sprites to my game so that it looks sick.

I started off by importing the sprites into game maker and making each sprite it's own direction.


After I imported all the sprites, I centered their origin and then I made macros for each of the sprites.
I learned that a macro is like a global variable but it cannot be changed. So I set all my sprites to a variable so in the long run it is easier to switch between sprites as I don't have to type spr_player_x every time I want to change a sprite.


After I made the macros, I proceeded to actually writing the code that changes the sprites based on your direction. So I went into my move_state() script and added a thing called a switch. I learned switch is a more effective version of using if/else statements when there are usually more than 2 or 3 of them. You used cases to describe the if statements and I added a one for every direction.

After this I made another script and called it get_face()
This script find your face depending on which direction you're facing and then the switch statements process this and change the sprite depending on the direction you are going.




So this is the result:


After this I decided to add a shadow to my character. So I implemented the animation, called it spr_player_shadow and then made a draw event for it. I set the origin to 8, -8 so that it is always below the player. In the draw event I had to state where it would be drawn and then I also had to redraw the player because as soon as a draw event is made, the engine gets rid of its current built in draw event.
This is the code I wrote.

This is how it looks with the shadow:

Today I learned a lot of new things in gamemaker language. I learned how switches and macros work.
Tomorrow I will continue more on my game. This is kind of where I wont be using the tutorial anymore and will try to go my own way.

1 comment:

Animate Lines and Ripple effect

Screenshot from Animate CC Animated GIF (Button does not work) Adobe Flash Player Version