Cursor changing problem in script

Started by agsfellow, Tue 15/07/2003 17:42:16

Previous topic - Next topic

agsfellow

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);
}

Scorpiorus

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


SMF spam blocked by CleanTalk