SetViewport problem

Started by BorisZ, Fri 17/09/2004 20:16:20

Previous topic - Next topic

BorisZ

I am experimenting with third and first person combination and I have encountered an problem with first perspective view: If I use SetViewport on large (x-axis only) background by x and y mouse coordinates,  room doesn't scroll to full width - it comes on about 2/3 (maybe less) of background, untill cursor comes to end of the screen. And what I would like is to scroll to full width, off course. I have tried with invisible character to scroll by too, but that was problematic because of flickering etc.
Any sugestions?

Ashen feels lazy

How are you making it scroll? If you're using something like:
  SetViewport (mouse.x, GetViewportY());
the problem is that mouse.x never gets above 320 (unless you're using 800 x 600), so that's the furthest right you can scroll.

Try something like:
in rep_ex of 1st person room
if (mouse.x <= 20) { //if mouse is near left of screen
  SetViewport (GetViewportX() - 10, GetViewportY()); // scroll left 10 pixels. Change this for quicker or slower scrolling.
}
else if (mouse.x >= 300) { //if mouse is near right of screen
  SetViewport (GetViewportX() + 10, GetViewportY()); // scroll right 10 pixels. Change this for quicker or slower scrolling.
}
If you're using 800x600 resolution, you'll need to change (mouse.x >= 300) to (mouse.x >= 380).

BorisZ


SMF spam blocked by CleanTalk