Hi
What I am trying to do is have the character cSpaceman walk to mouse x, mouse y+340
It is a 'scrolling' room and events are activated by a hotspot to throw a projectile straight up after cSpaceman has reached mouse x mouse y +340.
cSpaceman.Walk(mouse.x+GetViewportX(), mouse.y+GetViewportY());
// Was using this but it ignores scrolling room.
cSpaceman.Walk(mouse.x, mouse.y+340, eBlock, eWalkableAreas);
Will you assist me please.
cheers
Slasher, you are correctly using Viewport in the first line. You should use it in similar way in the second line:
cSpaceman.Walk(mouse.x + GetViewportX(), mouse.y + GetViewportY()+ 340, eBlock, eWalkableAreas);
Viewport should be used all time in the scrolling room when you use coordinates relative to screen (e.g. mouse position).
I don't quite understand the situation. What is supposed to mean by mouse.x + 340?
The problem is, when you click on a spot, the screen could have been scrolled beforehand, so if you use the coordinates (mouse.x, mouse.y+340), if you say, click at (100, 100) of the screen, the character will always walk to room coordinates (100, 440), no matter where the current viewport is at. If you want the destination room coordinates to have the same x-coordinates as before, and add 340 to the current y-coordinates, just straight forward make him walk to (mouse.x+GetViewportX(), mouse.y+GetViewportY()+340), though if the character is already close to the bottom edge of the room, the destination could be off-screen. Is this what you want? Otherwise please clarify your problem.
Edit: Ninja'd by Crimson Wizard, but I'll post anyway.
Thank you so much for your help Crimson
It seems to do the trick (nod)
cheers