Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Storygamer on Mon 07/04/2008 02:23:36

Title: Area-scaled cursors
Post by: Storygamer on Mon 07/04/2008 02:23:36
Here's something I've been fiddling with for a while.  You know how in some games (e.g. Black & White) the mouse "cursor" is actually a physical part of the environment and affected by it?  I'd like to do something similar with AGS.  I want to force the cursor to stay within walkable areas, and change size based on the scaling of the area it's in.

I've already come up with one way to do this, but it has some flaws and so I'd like to find an alternative.  The way I found to do this was to make the actual cursor invisible (sprite 0), and create a cursor "character".  In the repeatedly_execute function of the room, the location of the mouse is checked to make sure it's in a walkable area--if not, it is returned to it's previous position (from the last game cycle).  Then the "cursor character" is told to walk towards invisible cursor's location via WalkStraight.

Unfortunately this does cause a few problems.  The cursor character can only move as fast as its speed is set to--and if it's set really high (i.e. 30 or 40), it looks jumpy/choppy on the screen.  If it's set too low and the player moves the mouse quickly, sometimes it doesn't quite go where the player was trying to put it.  This method might still work if I could figure out a way to lower the mouse speed.

So I am wondering--

1) IS there a way to lower the mouse speed?  ...and...
2) Can anyone think of a better way to do what I'm trying to do?
Title: Re: Area-scaled cursors
Post by: Radiant on Mon 07/04/2008 08:51:24
40 is the standard speed, not "really high".
Title: Re: Area-scaled cursors
Post by: Khris on Mon 07/04/2008 10:22:19
Instead of making the mouse character walk there, simply place him at the coords.
  cMouse.x = mouse.x;
  cMouse.y = mouse.y;
Title: Re: Area-scaled cursors
Post by: Storygamer on Mon 07/04/2008 19:04:00
KhrisMUC--hadn't thought of that.  I'll try it out.

Radiant--I was referring to the character movement speed actually, not the game cycle speed.  On my computer at least, when a character has a 40 movement speed, he rockets across the screen.  7 or 8 seems about normal to me.