making an image face the mouse

Blitz3D Forums/Blitz3D Beginners Area/making an image face the mouse

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

You should have an image for each direction that the guy looks at. Say, you are using 9 images, up-left up up-right left middle right down-left down-middle and down-right.
You can line them up into a big image and load them with LoadAnimImage. Suppose you have the Graphics mode set to 800x600, you can use this:
fr = (MouseX() / 266) + (MouseY() / 200) * 3
DrawImage image, 400, 300, fr

"fr" is the index number of the frame that should be drawn. The 800x600 screen is divided in 9 parts, 3 over the x-axis and 3 over the y-axis: 800/3=266 and 600/3=200.