Scroll function too fast

Started by , Mon 30/04/2007 10:26:11

Previous topic - Next topic

bicilotti

Searching the forum I found this very interesting function. (Here's a link to the post).

Basically it scrolls the screen using an invisible character (DUMMY here)

Code: ags

function MoveViewportBlocking(int x, int y, int speed, int antiglide) {

   int dummy = DUMMY;

   int pc = GetPlayerCharacter();

   character[dummy].room = character[pc].room;
   character[dummy].x = GetViewportX() + system.viewport_width/2;
   character[dummy].y = GetViewportY() + system.viewport_height/2;
   
   SetPlayerCharacter(dummy);
   SetCharacterSpeed(dummy, speed);
   
   antiglide = SetGameOption(OPT_ANTIGLIDE, !!antiglide);

   MoveCharacterDirect(dummy, x+system.viewport_width/2, y+system.viewport_height/2);
   while (character[dummy].walking) Wait(40);
   
   SetPlayerCharacter(pc);
   SetViewport(GetViewportX(), GetViewportY());
   SetGameOption (OPT_ANTIGLIDE, antiglide);
}


I set the parameter "speed" to the minimum but I feel it is still too fast and I don't know if there's a way to slow down the scroll.

Any help?

Lt. Smash

Have you tried using numbers under 0 like -4 for speed.

I think it should be slower then.

bicilotti


Khris

I've updated the code to current script:

Code: ags
function MoveViewportBlocking(int x, int y, int speed, int antiglide) {
  cDummy.ChangeRoom(player.Room, GetViewportX()+System.ViewportWidth/2, GetViewportY()+System.ViewportHeight/2);

  Character*pc=player;
   
  cDummy.SetAsPlayer();
  cDummy.SetWalkSpeed(speed, speed);
   
  antiglide = SetGameOption(OPT_ANTIGLIDE, !!antiglide);

  cDummy.Walk(x+system.viewport_width/2, y+system.viewport_height/2, eAnywhere, eBlock);
   
  pc.SetAsPlayer();
  SetViewport(GetViewportX(), GetViewportY());
  SetGameOption (OPT_ANTIGLIDE, antiglide);
}

SMF spam blocked by CleanTalk