AGK for Pascal
ContentsIndexHome
PreviousUpNext
TAgkScene.SetViewOffset Method (TAgkPoint)

Offset the screen viewport relative to the world, for example a view offset of 0,20 will move the screen down by 20 pixels showing any sprite that was previously positioned just off the bottom of the screen. This can be useful for scrolling games where you want to move the view across a level.

Syntax
Pascal
class procedure SetViewOffset(const P: TAgkPoint); overload;
Parameters 
Description 
const P: TAgkPoint 
The offset for the view 

The view offset will remain active for subsequent scenes. 

Using this method will automatically disable the four physics walls surrounding the screen. 

You can also fix sprites to the screen so that they move along with it by using TAgkSprite.FixedToScreen

The view offset values position the top left corner of the view in the world, while ViewZoom determines how much of the world the view can see.

Copyright (c) 2012. All rights reserved.