Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: agsfellow on Tue 15/07/2003 17:42:16

Title: Cursor changing problem in script
Post by: agsfellow on Tue 15/07/2003 17:42:16
The following code changes the cursor depending on which side of the main character the mouse is pointed to.  It works unless I have a wide room; one that scrolls.  Is there any way I could change this code to make it work.  I believe it is happening because either the mouse.x or character.x is using the base 300x200 reference and the other is actually using the dimensions of the background.

if (mouse.x < character.x) {
ChangeCursorGraphic (0, 78);  
}
else {   // right-click, so cycle cursor
ChangeCursorGraphic (0, 2054);
}
Title: Re:Cursor changing problem in script
Post by: Scorpiorus on Tue 15/07/2003 18:20:10
yep, you need to add a viewportX offset to mouse.x position:

if (GetViewportX() + mouse.x < character.x) {
ChangeCursorGraphic (0, 78);
}
else { // right-click, so cycle cursor
ChangeCursorGraphic (0, 2054);
}

~cheers
Title: Re:Cursor changing problem in script
Post by: agsfellow on Tue 15/07/2003 22:45:49
Thanx Scorpiorus!