Step One - Draw Sprite and Draw Sprite Ext
Right click on the scripts folder in the left side of the Game Maker window and select create new script. Name the new script d3d_draw_sprite. Now, either copy and paste or type in the following GML source code,
var sprite, subimage, x_coord, y_coord;
sprite = argument0;
subimage = argument1;
x_coord = argument2;
y_coord = argument3;
d3d_set_hidden(false);
d3d_set_lighting(false);
d3d_set_projection_ortho(0,0,view_wview[view_current],view_hview[view_current],0);
draw_sprite(sprite, subimage, x_coord, y_coord);
d3d_set_hidden(true);
d3d_set_lighting(true);
This script will take the exact same arguments that the default draw_sprite function takes, drawing a sprite at the given coordinates.
After saving the new script, create another one called d3d_draw_sprite_ext and insert this code into the editor,
var sprite, subimage, x_coord, y_coord, x_scale, y_scale, rotation, color, alpha;
sprite = argument0;
subimage = argument1;
x_coord = argument2;
y_coord = argument2;
x_scale = argument3;
y_scale = argument4;
rotation = argument5;
color = argument6;
alpha = argument7;
d3d_set_hidden(false);
d3d_set_lighting(false);
d3d_set_projection_ortho(0,0,view_wview[view_current],view_hview[view_current],0);
draw_sprite_ext(sprite, subimage, x_coord, y_coord, x_scale, y_scale, rotation, color, alpha)
d3d_set_hidden(true);
d3d_set_lighting(true);
This script is the same as draw_sprite_ext and takes the same arguments. Draw_Sprite_Ext gives more options and control over the drawing of an individual sprite. Don't forget to save this script as well.
Step Two - Draw Text
The final script to create is called d3d_draw_text. It takes the same arguments as Game Maker's draw_text built in function. After creating a new script using that name, place this source code into the new script,
var x_coord, y_coord, str;
x_coord = argument0;
y_coord = argument1;
str = argument2;
d3d_set_hidden(false);
d3d_set_lighting(false);
d3d_set_projection_ortho(0,0,view_wview[view_current],view_hview[view_current],0);
draw_text(x_coord, y_coord, str);
d3d_set_hidden(true);
d3d_set_lighting(true);
Save the script and that's it!
Conclusion
With the proper scripts the Game Maker engine can determine when and how to draw 2D images and text and when to render 3D objects. All that is required is the calling of newly created scripts, d3d_draw_sprite for regular sprites, d3d_draw_sprite_ext for extended spriting options, and d3d_draw_text for drawing text on screen.
NOTE:
It is typical in the Game Maker community to ask for credit, however these scripts are provided absolutely free and require no credit what so ever.
Published by James Cloud
I like to program and do basically anything that has to do with technology and computers. View profile
- Review: Monopoly City Streets - the Largest Game of Monopoly in the WorldMonopoly City Streets is the newest creation from Google and Hasbro that allows people to play the classic Monopoly game with Google Maps.
Building a Video Game Development Team - Part OnePart 1 of a couple of guides on building a video game development team and keeping them.
How to Create a Simple Computer GameIn this tutorial I will teach you how to create a simple game using software called the Game Maker. It is free program created by YoYogames and the greatest part of it is that n...- Video Game Maker THQ Announces Darksiders: Wrath of War THQ announces a new game for release in 2008
Settlers of Catan GameSettlers of Catan is a brilliant but slightly-under-the-radar board game. However, it is intuitive and allows for the best of every player to come out in full force...
- Free Game Maker Software
- Software Review: Game Maker
- Game Maker: Every Programmer's Dream
- A Review of Game Maker
- Want to Make Your Own Computer Games? a Game Maker 7 Review
- Game Maker Mplay Example
- How to Get Video Game Tester Jobs




