draw_rectangle() (Game Maker)

draw_rectangle()

( Game Maker 6.1, 7 )

draw_rectangle - draw a rectangle in the current drawing color

Description

draw_rectangle(x1,y1,x2,y2,outline)

  • x1 - x-position of top, left corner of rectangle
  • y1 - y-position of top, left corner of rectangle
  • x2 - x-position of bottom, right corner of rectangle
  • y2 - y-position of bottom, right corner of rectangle
  • outline - draw an outline, as true or false

draw_rectangle() will draw a rectangle in the current drawing color. The top left corner of the rectangle is determined by x1 and y1 The bottom left corner is determined by x2 and y2. If you wish for an outline to be drawn, set outline to true, otherwise, use false.

Examples

Example of Use

draw_rectangle(0,0,100,100,false);

The code in this example draw a 100,100 square in the current drawing color at the top, left part of the room.

Hud Background

draw_rectangle() can be used to draw the background of a HUD.

draw_rectangle(view_xview[0],view_yview[0],view_xview[0]+320,view_yview[0]+32,false);

This will draw a 320x32 rectangle in the current drawing color (usually black) which can be used as the background for a HUD.

Common Mistakes

Useful Info

  • The sprite of an object will not be visible when draw_rectangle() is used.

Related Pages

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