Hiya. Name's Alan. I'm brand new to these forums.
Right. Now that I've gotten a chance to play around with AGS for a bit and am comfortable with the basics, I'm trying to do something a little bit more ambitious--A chalkboard that the player can draw on.
Problem is, I can't figure out how to get the exact location of the mouse--something that's rather important for drawing.
Is there a way to get the mouse coordinates in relation to the background, or in relation to an object (either would work)?
Mouse coordinates are stored in mouse.x and mouse.y. You can test and compare them easiliy with an IF statement-
if (mouse.y == oDoor.y) {//do code}
AGS mostly handles mouse coordinates and scrolling rooms internally, but if you need "true room coordinates", you need to add the viewport to the mouse coordinates.
As ghost said, coordinates are stored in mouse.x and mouse.y.
Using them to draw on a chalk board isn't too hard.
Just need to use a hotspot, and a new sprite.
the code would look something like this:
function HOTSPOT1_AnyClick()
{
***Create 'sprite001' at 'mouse.x' and 'mouse.y'
}
Not sure what the command will be to create a new sprite, but that's the basic shell of what it might be.
Please note that it is pseudo-code.
Ghost is right about the mouse thing, and it sounds like you know what the drawing part will require.
To expand upon suicidal's comments, you should look up DrawingSurface and DynamicSprite in the manual. But I'm not even sure if you need them....
~Trent