draw_sprite() (Game Maker)


(Game Maker 6.1, 7)

draw_sprite - draw a sprite.


draw_sprite ( sprite, subimg, x, y )

  • sprite - sprite to be drawn
  • subimg - subimage of sprite to be drawn
  • x - x-position to draw sprite
  • y - y-position to draw sprite

draw_sprite() will draw a sprite. Note that when this function is used, the instance's own sprite will not be drawn. The sprite that is drawn by draw_sprite() does not have to be the sprite used by the object which executes it.


Example of Use


This code in this example will draw the sprite spr_inventory_sword at point 16,16 in the room.

Drawing Two Sprites

Since draw_sprite() causes an object's own sprite not to be drawn, you may want to use it twice to draw the object's sprite as well as another sprite.

// In the draw event of an object
if(speed > 4)

This code in this example will draw the main sprite of an instance as well as make a dust sprite appear at it's last position. Using sprite_index and image_index will draw the current instance's current sprite at its current subimage.

Related Pages

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution 2.5 License.