Login | Register

Decide which sub image

September 9, 2006, 18:09 by Calle
[loading]
-->
<b>Question:</b> Hey, I am having a bit of a problem. I am working on a driving videogame, (thirdperson) and you click with mouse to bring the car to the spot. I have registered and can make the car rotate, but the top-down veiw is on a bit of an angle so you can see the side.

Because of this, I have to have a different sprite per angle. I have dramn them already, I have 12 angles. I have tried drag and drop and found a way, but it takes a long time to do and is hard to debug. Can someone help me?

Topic title: "Make It Sense Direction"

<b>Answer:</b> I suppose you got all of the twelve images as sub-images in one single sprite? That would be best. Then all you need to do is to figure out what is the closest, and you got to figure it out from the direction, which is the only value you got. Here is some quite simple math that I hope you will understand, it will go in step event:

image_single = direction/360*12;

Comments

Loading comments... [loading]
.
Users logged in:

game maker articles, game maker examples, game maker tutorials, gmtutorials, game maker questions and answers, game maker crash course, how to create games