GM: d3d draw wall

From GMpedia.org Wiki

Jump to: navigation, search
The correct title of this article is d3d_draw_wall(x1,y1,z1,x2,y2,z2,texid,hrepeat,vrepeat). It appears incorrectly here because of technical restrictions.

d3d_draw_wall()

Type: function
Arguments: x1, y1, z1, x2, y2, z2 = Real valued co-ordinates that define the position and size of the block.

tepid = the id of the texture to draw the block with.

repeat = How many times the texture should be repeated horizontally.

repeat = How many times the texture should be repeated vertically.

Limitations: Registered

This function will draw a wall, with or without a texture, in the current drawing colour. A wall (unless transformed) will always stand perpendicular to the z plane. That is probably best explained with a picture:

As you can see, it draws a flat wall between (x1,y1,z1) and (x2,y2,z2).

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 vrepeat to how many times the texture should be repeated along the horizontal edges of faces, and hrepeat 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.

[edit] Example

Here is a sample code. It would draw 2 walls forming a "+" shape.

// draw the "-" part of the cross.
d3d_draw_wall(x-16, y, 0, x+16, y, 32, texture_wall, 1, 1)
// draw the "|" part of the cross.
d3d_draw_wall(x, y-16, 0, x, y+16, 32, texture_wall, 1, 1)
This article was originally found at the Game Maker Knowledge Base, contributed by monkey dude.
See the talk page for details
Personal tools