

We will start by flipping the sprite to the left and right. The number above their heads indicate the current frame of animation they are on. His hyperactive friend on the right is animating at a frameSpeed of 1. The guy on the left is animating at a frameSpeed of 0.10. Try adjusting the frameSpeed value and find something that looks right to you. Depending on your frameSpeed, the animation may not look correct. Open up the Create event code and add the following lines:Ĭopy code Copied to clipboard.

Add the Create, Step, End Step, and Draw events. Set your sprPlayer_Idle sprite as the object sprite. I recommend downloading them and following along. Here is a link to all of the sprites I am using. If you are using the sprites that I am using, that is 16 and 32 respectively. Set the sprite origin to the x center, and y bottom.

Otherwise you won't be able to tell it's animating. Make sure this sprite has multiple frames, and each frame is different. Now that we have our animation_init script ready to go, we are ready to start drawing, that is, once we have a sprite to draw! Create a new sprite, and name it sprPlayer_Idle. This makes it much easier to address button presses later on. These are all booleans, meaning they can either be true or false. left = keyboard_check(vk_left) Īll we are doing here is storing our keyboard inputs into variables. Add the following lines:Ĭopy code Copied to clipboard. We are going to define these arguments as variables, and throw all of it into a script so it can be used on any object.Ĭreate a script and name it animation_init. There is a bit of setup required before we can really use this function effectively. Range from transparent (0) to opaque (1). Y position of where you are drawing the sprite.Ĭolor blending (c_white displays as normal).Īlpha of the sprite. X position of where you are drawing the sprite.

Individual frame of the sprite you are drawing. See the table below for all of the arguments this function requires: Argument Using this function, we can change the scale, angle, color blending, and alpha of the sprite being drawn. This function is primarily used to draw sprites to the screen. Draw_sprite_ext() is an extended version of draw_sprite() and gives us much more control over the sprite we are drawing. Written in October 2017 by Nathan Ranney, the founder of game development studio Gutter Arcade.Ī sprite is an image that is being shown on your screen and it can be a single image, or a series of images that form an animation.įirst, we need to break down what draw_sprite_ext() is, and all of the arguments it uses.
