YoYo Games Wiki

d3d_draw_block(x1,y1,z1,x2,y2,z2)

From YoYoGames Wiki

Description

This function will draw a block, with a or without a texture, using the current drawing color.

Arguments

  • x1, y1, z1, x2, y2, z2 = Real valued co-ordinates that define the position and size of the block.
  • texid = the id of the texture to draw the block with.
  • hrepeat = How many times the texture should be repeated horizontally.
  • vrepeat = How many times the texture should be repeated vertically.


Example

Suppose the following code is executed:

d3d_draw_block(0,16,16,16,16,0,spr_texture,5,5)

The coordinate values for this block would be (0,16,16,16, 0, 0). The values you define will end up being 2 opposite corners of the block. That same block could have been drawn using the values (0, 0, 0, 16, 16, 16). It would just have defined 2 different opposite corners.

To not use a texture for this primitive, put -1 in place of texid, else provide the id of a texture. Even if you don't use a texture, you must fill in the hrepeat and vrepeat parameters. If you are not using a texture, it does not matter what value you enter, I usually put a 0. If however you are using a texture, set hrepeat to how many times the texture should be repeated along the horizontal edges of faces, and vrepeat to how many times the texture should be repeated along the vertical edges of faces. Repeating a texture that tiles well can be used to cover large areas without losing definition.

Remarks

Requires a registered version of Game Maker.


Content from GMKB, was used to expand this article. The content was contributed by monkey dude.