Moving the screen

Started by Nabeel, Sat 30/06/2007 05:08:29

Previous topic - Next topic

Nabeel

Umm...I wanted to ask, how can you let the player move the whole screen?
Like in 6 Days Assasin when we were to shoot the Sniper...

TerranRich

Haven't played 6DA in a long time...do you mean scrolling backgrounds? If so, just make the background larger than the room size (320x200 for example). You'll need some scripting for using the mouse to move the screen, however.
Status: Trying to come up with some ideas...

R4L

Quote from: TerranRich on Sat 30/06/2007 06:22:12
You'll need some scripting for using the mouse to move the screen, however.

You'll need to use Viewport commands. Look in the manual for more info on them.

Lt. Smash

#3
you could create hotspots but better would to check if the mouse is left/right or up/down.

you may use this code(not tested but should work):

Code: ags

game rep execute:

if(player.Room==Scrollroom)
{
  if(mouse.x<20) //or room rep execute from here
  {
    SetViewport(GetViewportX()-1,0); //increase -1 for faster scrolling
  }

  else if(mouse.x>300)
  { 
    SetViewport(GetViewportX()+1,0); //increase +1 for faster scrolling
  }
  
  else if(mouse.y<20)
  {
    SetViewport(0,GetViewportY()-1); //increase -1 for faster scrolling
  }

  else if(mouse.y>180)
  {
    SetViewport(0,GetViewportY()+1); //increase +1 for faster scrolling
  }
}


EDIT: fixed typo

SMF spam blocked by CleanTalk