Designing Games with GameMaker
Drawing basic shapes
A number of functions exist for drawing basic shapes, like blocks and walls. Note that these shapes also work correctly with backface culling on.
d3d_draw_block(x1,y1,z1,x2,y2,z2,texid,hrepeat,vrepeat) Draws a block in the current color with the indicated opposite corners using the indicated texture. Use -1 to not use a texture. hrepeat indicates how often the texture must be repeated along the horizontal edge of each face. vrepeat does the same for the vertical edge.
d3d_draw_cylinder(x1,y1,z1,x2,y2,z2,texid,hrepeat,vrepeat,closed,steps) Draws a vertical cylinder in the current color in the indicated bounding box using the indicated texture. Use -1 to not use a texture. hrepeat indicates how often the texture must be repeated along the horizontal edge of each face. vrepeat does the same for the vertical edge. closed indicates whether to close the top and bottom of the cylinder. steps indicates how many rotational steps must be taken. A typical value is 24.
d3d_draw_cone(x1,y1,z1,x2,y2,z2,texid,hrepeat,vrepeat,closed,steps) Draws a vertical cone in the current color in the indicated bounding box using the indicated texture. Use -1 to not use a texture. hrepeat indicates how often the texture must be repeated along the horizontal edge of each face. vrepeat does the same for the vertical edge. closed indicates whether to close the top and bottom of the cylinder. steps indicates how many rotational steps must be taken. A typical value is 24.
d3d_draw_ellipsoid(x1,y1,z1,x2,y2,z2,texid,hrepeat,vrepeat,steps) Draws an ellipsoid in the current color in the indicated bounding box using the indicated texture. Use -1 to not use a texture. hrepeat indicates how often the texture must be repeated along the horizontal edge of each face. vrepeat does the same for the vertical edge. steps indicates how many rotational steps must be taken. A typical value is 24.
d3d_draw_wall(x1,y1,z1,x2,y2,z2,texid,hrepeat,vrepeat) Draws a vertical wall in the current color with the given corners using the indicated texture. Use -1 to not use a texture. hrepeat indicates how often the texture must be repeated along the horizontal edge of each face. vrepeat does the same for the vertical edge.
d3d_draw_floor(x1,y1,z1,x2,y2,z2,texid,hrepeat,vrepeat) Draws a (slanted) floor in the current color with the given corners using the indicated texture. Use -1 to not use a texture. hrepeat indicates how often the texture must be repeated along the horizontal edge of each face. vrepeat does the same for the vertical edge.
The following piece of code draws two blocks:
{ var ttt; ttt = background_get_texture(back); d3d_draw_block(20,20,20,80,40,200,ttt,1,1); d3d_draw_block(200,300,-10,240,340,100,ttt,1,1); }
Alternative versions
You can also read this manual on one single long page (± 1.5 mb)
Also available in:
Download helpfile
Also available in:
Download helpfile