The draw_sprite() function works as follows:
draw_sprite(name of the sprite, frame of the sprite that you want to draw, x value, y value);
Let's say you have a Sprite named spr_ball, which has 3 frames, and you want to draw it at position (32, 32). Sometimes you don't want to draw a specific frame though. In those cases you just put -1 in the second argument. This will make the function draw the animated version of the sprite, not just a single frame. This is how that code would look:
draw_sprite(spr_ball,-1,32,32);
It's pretty simple.
There is another draw_sprite function that you may want to check out as well. (only if you have the pro version!) The draw_sprite_ext() function has more flexibility than the draw_sprite() function. This is what the draw_sprite_ext() function looks like:
draw_sprite_ext(sprite, frame, x position, y position, width scale, height scale, rotation, color, alpha value);
This line of code looks confusing, but it is an extremely important statement to learn. As you see, the first four arguments work the same as in the draw_sprite() function. width scale and height scale are very simple. If you set the width scaleto 1, then the sprite will draw the same as it would in the normal function. A value of -1 will mirror the sprite, a value of 0.5 would draw the sprite 50% as wide as normal, etc... The same goes for the height scale. The rotation argument speaks for itself. You input a number between 0 and 360 and it will draw the sprite rotated to that degree. Note that a value of 0 points to the right, a value of 90 points upwards, a value of 180 points left and a value of 270 points down. The color argument also speaks for itself. A value of -1 will draw the sprite with no color applied. You can use the following variables in the color argument:
c_red
c_blue
c_black
c_white
c_gray
c_fuchsia
c_yellow
c_dkgray
Now, on to the alpha argument: you input a number between 0 and 1 and it will draw the sprite at [the number you input]x100% opacity. E.g. a value of 1 will draw the sprite completely opaque, a value of 0 will draw the sprite completely transparent, a value of 0.90 will draw the sprite at 90% opacity, a value of 0.1 will draw the sprite at 10% opacity, etc...
I hope that this helped you!
Copyright © 2026 eLLeNow.com All Rights Reserved.