Walking in a scrolling room

Started by Cogliostro, Thu 17/01/2013 02:57:00

Previous topic - Next topic

Cogliostro

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
"First things first, but not necessarily in that order." - Dr. Who

Cogliostro

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






"First things first, but not necessarily in that order." - Dr. Who

SMF spam blocked by CleanTalk