Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Cogliostro on Thu 17/01/2013 02:57:00

Title: Walking in a scrolling room
Post by: Cogliostro on Thu 17/01/2013 02:57:00
Wanted to reduce my game to one type of click, no walk, no talk, just click.  So far it's a pretty good setup.  However, several rooms use scrolling.  In these rooms, I have a hotspot called "hFloor".  When I use the following code:

function hFloor_AnyClick()
{
  player.Walk(mouse.x, mouse.y, eNoBlock, eWalkableAreas);
}

The character walks just fine... until the screen scrolls.  Then he keep walking around in the originally defined room space, and will not continue into the rest of the room.

Help!

- Cogliostro
Title: Re: Walking in a scrolling room
Post by: Cogliostro on Thu 17/01/2013 03:09:41
I think I've solved my own problem.  All I have to do is add the screen offset to the X value.

function hFloor_AnyClick()
{
  player.Walk(mouse.x + GetViewportX(), mouse.y, eNoBlock, eWalkableAreas);
}