answersLogoWhite

0


Best Answer

The draw_sprite() function works as follows:

draw_sprite(name of the sprite, frame of the sprite that you want to draw, x value, y value);

Let's say you have a Sprite named spr_ball, which has 3 frames, and you want to draw it at position (32, 32). Sometimes you don't want to draw a specific frame though. In those cases you just put -1 in the second argument. This will make the function draw the animated version of the sprite, not just a single frame. This is how that code would look:

draw_sprite(spr_ball,-1,32,32);

It's pretty simple.
There is another draw_sprite function that you may want to check out as well. (only if you have the pro version!) The draw_sprite_ext() function has more flexibility than the draw_sprite() function. This is what the draw_sprite_ext() function looks like:

draw_sprite_ext(sprite, frame, x position, y position, width scale, height scale, rotation, color, alpha value);

This line of code looks confusing, but it is an extremely important statement to learn. As you see, the first four arguments work the same as in the draw_sprite() function. width scale and height scale are very simple. If you set the width scaleto 1, then the sprite will draw the same as it would in the normal function. A value of -1 will mirror the sprite, a value of 0.5 would draw the sprite 50% as wide as normal, etc... The same goes for the height scale. The rotation argument speaks for itself. You input a number between 0 and 360 and it will draw the sprite rotated to that degree. Note that a value of 0 points to the right, a value of 90 points upwards, a value of 180 points left and a value of 270 points down. The color argument also speaks for itself. A value of -1 will draw the sprite with no color applied. You can use the following variables in the color argument:
c_red
c_blue
c_black
c_white
c_gray
c_fuchsia
c_yellow
c_dkgray

Now, on to the alpha argument: you input a number between 0 and 1 and it will draw the sprite at [the number you input]x100% opacity. E.g. a value of 1 will draw the sprite completely opaque, a value of 0 will draw the sprite completely transparent, a value of 0.90 will draw the sprite at 90% opacity, a value of 0.1 will draw the sprite at 10% opacity, etc...
I hope that this helped you!

User Avatar

Wiki User

16y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How do you use the draw sprite function in Game Maker?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Basic Math

How do you make a health bar on game maker?

Create a new object with no sprite. Add draw event and go to score tab. Drag 'N Drop 'Draw Health Bar' to the actions column. X2=Desired Height, Y1=0, Y2=Desired 'full' length,y.


How do you draw score or coins on game maker 8 pro?

draw_text(0,0,score); For coins, you'll need to make a variable that stores how many to draw.


How do you draw m and ms?

draw a circle with a M on it


Draw a venn diagram to show the common factors of 36 and 54?

U draw


How do you make a health bar on game maker 8?

Create an object without a sprite and add a draw event. then add a draw health action (in score tab) and add the coordinates and colors you desire. (x1,y1) is the top left corner and (x2,y2) is the bottom right corner.example: (x1:16, y1:16; x2:160, y2:32) will add a 16hx160w health bar near the top left corner. And you can mess around with it to put it anywhere on the screen and make it any size you want. but it will always be a rectangle using the top left corner (x1,y1) and the right bottom corner (x2,y2).Then go to the object you want to put the health on and add a collision event with the object that will affect its health and add a set score action (score tab) to it and add the amount of health you want to add or loose for that object when it collides with a bullet etc.example: for an enemy to loose 5/100 of its health when hit by a bullet add a collision event with a bullet to the enemy object and add a set score action (score tab) and put -5 (Relative) in the windowor a collision event with your character and a power up. put +10 or whatever in the collision on it.

Related questions

How do you stop sprites going over objects in game maker?

I can't quite understand your question, but here's a method for what I think you want: Create a draw event, and tell it to not draw the sprite. If you mean something to do with a collision event, change the objects' depth.


How do you make a health bar on game maker?

Create a new object with no sprite. Add draw event and go to score tab. Drag 'N Drop 'Draw Health Bar' to the actions column. X2=Desired Height, Y1=0, Y2=Desired 'full' length,y.


How can you make text in game maker 8 pro without codes?

Firstly, set up an invisible object or an object without a sprite, then add event "draw". Go to the draw tab and put in the draw text (the one that looks like a blue capital 'a'). Enter your text into the top box, then the co-ordinates in the x and y box respectively.


How do you draw score or coins on game maker 8 pro?

draw_text(0,0,score); For coins, you'll need to make a variable that stores how many to draw.


Why won't windows live movie maker let me use the draw tool?

There is no 'draw' tool on Windows Live Movie Maker.


What virtual game do you draw your own pet?

there is one called kitten maker where you pick the color, size, shape and so on, and it is on girlsgogames


What is the function of draw tube of a compound microscope?

the function of draw tube is a ...............


How do you make a custom charcter on sonic FGX?

It is easy to get the program for it. All you do is search for these things and download them: -Sonic FGX (of course) -Game Maker 7 Then you must start working on your character. It is strongly recommended that you go to the FGX Base and download the original sprites. So then, You must open the sprite, (Press the MAKE A SPRITE button. Its the Red pacman button at the top of your screen. Then you paint on each sprite. and make sure that they are all the same color. And then save it as a .gif file in your Sonic FGX folder. Then, Load it, And you would be playing on it! P.S. When you draw on the sprite, don't make it completely different. Just make the color different. Hope this helped! Bye!


How do you make a Naruto fighter game in game maker?

follow these steps: 1.learn the basics of game maker language 2.figure out how to make a good "platformer engine" or find an engine. 3.if you can't draw sprites go to "sprite database.com" 4. try making a more simple game first 5.once you've figured out game maker, this should make sense: ------------to make AI chase player "right" --------step event ..........if x>objplayer.x+32(or how ever close you want AI to chase) ..................(if this is true) hspeed=6(or how ever fast you want) to go "left'=(change > to < , and change + to -) to make AI jump=(change x to y) this is really all i think you could understand, you've got to figure rest out on your own. making a "fighter" is not a good start for "beginners".


How do you get a Master Chief piviot?

There are 2 ways 1. File, Load Sprite 2. Draw One Yourself


Draw a Z80 processor and explain five of its pin function?

draw the Z80 processor and explain five of its pin function


What is the function of draw tube in the microscope?

Its function is to keep the eyepiece in place