SetViewport how set?

Started by Flyman, Thu 09/02/2012 22:40:15

Previous topic - Next topic

Flyman

Hi,
In my cutscene, I will that the room scrool from right to left, from position (570,51), where  charater stand in position (143,51) where I will display a message "help, help", I've read in manual and prove SetViewport, mmm, but not worl properly! How can set this command? how set the speed of scrolling?

code:

    int xpos = "??"; \\ IS THE START POSITION OF CHARACTER?
while (xpos < "??") { \\THE DESTINATION OF THE SCROLLING?
  SetViewport(xpos, "??"); \\ THE RETURN SET CHARACTER?
  Wait(1);
xpos--; \\ THE "--" TO MOVE THE SCROLLING RIGHT?
}
\\ TO SET THE SPEED OF SCROLLING?
Wait(5);
  DisplayAt (143,51,100, "help, help!");
ReleaseViewport();

Gilbert

Something like this:
Code: ags

int xpos = GetViewportX(); int ypos = GetViewPortY(); //initial position
while (xpos > 50) { //x-coordinate of desired destination.
  SetViewport(xpos, ypos);
  Wait(1);
  xpos--;
}
Wait(5);
DisplayAt (143,51,100, "Help! Help!");
ReleaseViewport();


The 50 in "while (xpos > 50) {" is a random made-up number. You need to test it yourself at which x-position do YOU actually want the ending position to be.

To change the speed of the scrolling, if you want it to scroll slower, change the 1 in Wait(1); to a larger number so that it wastes more frames for scrolling 1 single pixel; if you want it to scroll faster instead, change "xpos--;" to something like "xpos -= 2;" so that the screen shifts more than 1 pixel per frame.

SMF spam blocked by CleanTalk