Animations Code - Game Maker
For the Animations I had to code inside of them for them to work constantly within the game and for them to run smoothly and for no errors to occur within the game.
The first lot of code that we need to do was to create variables. We abbreviated them so they were easy to recognize and that they don't become too bulky and hefty. We had to make the game playable and for it to be easier to read.This is the collision code for both vertical and horizontal. The collision code stops the sprites from bugging out and that they will not be an issue with the game. the vertical collision code stops the sprite from phasing through walls when going right or left. on the horizontal collision code stops the sprite from going through platforms above and ceilings which makes the game more playable.Within this code it makes the character face the way the last input was from so if you press right, you will face right but if you press left, you will face left so then it looks more aesthetically pleasing.
The first lot of code that we need to do was to create variables. We abbreviated them so they were easy to recognize and that they don't become too bulky and hefty. We had to make the game playable and for it to be easier to read.This is the collision code for both vertical and horizontal. The collision code stops the sprites from bugging out and that they will not be an issue with the game. the vertical collision code stops the sprite from phasing through walls when going right or left. on the horizontal collision code stops the sprite from going through platforms above and ceilings which makes the game more playable.Within this code it makes the character face the way the last input was from so if you press right, you will face right but if you press left, you will face left so then it looks more aesthetically pleasing.
This code enables the jumping animation to be activated until it hits the max height and then it will change to a fall animation. This makes the sprite look smoother and cleanerThe following code has set both the left and right key to the arrow keys and the jump to the space-bar.
The following code I had difficulty with but I eventually set the jump to 10 and for the fall speed to not bug out the game when infinitely falling.
To love horizontallly we have set it so that if the left and right key are both pressed it is made so that the character will idle and not move on the screen but if the character only presses one button it then become the fastest way to travel. However the vertical it is set so that you can increase speed by the gravity.
This following code is about when you are on the ground either idling or running. Whenever you horizontal movement is greater than 0 it will show the running animation; but if your not moving you will idle
These are the variables for the game. grv - Is gravity for the jump. HSP - is your current horizontal speed. VSP - is your current vertical speed. HspWalk - is the walk speed value VspJump - is the jump speed value. CanJump - is to see if the sprite is touching the ground.





Comments
Post a Comment