Character face clicked point (SOLVED)

Started by Hans, Fri 19/01/2007 22:56:14

Previous topic - Next topic

Hans

I have a very big hotspot and I want my character to face the point where you clicked on it. Is there a way to use the clicked place's coordinates as the coordinates that have to be faced?

monkey0506

Code: ags
// Any click on hotspot
player.FaceLocation(mouse.x, mouse.y);

Hans

I knew it was simple!
Thank you!

monkey0506

Seeing as you've declared this solved, I presume you actually tested it?

Glad to have been of assistance.

Hans

Yes. I did test it. But I don't even think that that was necessary. Your hint was very "I-am-gonna-work"-looking. ;)
Thank again.

Ashen

This is a clear case of 'READ THE MANUAL'. One thing that's not explicitly in the manual or monkey's post, however, is that that won't work properly for scrolling rooms. Mouse coords are Screen based, FaceLocation is Room based; so for scrolling rooms you'd need to use:
Code: ags

// Any click on hotspot
player.FaceLocation(mouse.x+GetViewportX(), mouse.y+GetViewportY());
I know what you're thinking ... Don't think that.

SMF spam blocked by CleanTalk