1. ## Scrolling equations?

If I'm not mistaken when making scrolling equation for on-screen object positioning I should use are:

camerax - objectxInScene
cameray - objectyInScene

Am I right?

2. What game genre ?

In OpenGL is easy to use "virtual" camera:

glTranslatef(camX, camY, 0); // camera position
glScalef(zoomLevel, zoomLevel, zoomLevel); // zoom

3. I think the real formula was
objectxInScene - camerax
objectyInScene - cameray

Lets think it through:
Object is in position 100, 100
Camera is in position 90, 100
So we expect that the object will be shown slightly right from camera location. With above formula it becomes
100-90, 100-100 = 10, 0, which is slightly right

4. I think you need to modify only one axis at a time or your scrolling will be funny. e.g. for scrolling stuff you need to define boundaries, direction and speed, you may have absolute screen boundaries or relative surface boundaries.

5. Of course I'll scroll one dimension at a time! But since my first project is infinite horizontal shooter, it isn't that important. Just wanted to make sure my equations are right.

Also:
Lets think it through:
Object is in position 100, 100
Camera is in position 90, 100
So we expect that the object will be shown slightly right from camera location. With above formula it becomes
100-90, 100-100 = 10, 0, which is slightly right
No, (10,0) is slightly LEFT. (0,0) in games is top left corner.

6. 10 is to Right from point 0, the axis... When object position X increases, it is going right, yeah? If you want it in the middle of screen, you just have to set the camera coordinates properly. For example focused where player is, it would be cameraPosition = PlayerPosition - ScreenSize/2
Code:
```camX:=player.X-clientwidth/2;
camY:=player.Y-clientheight/2;
object[n].Draw(object[n].X-camX, object[n].Y-camY);```
So if player is at 0, 0, and object would be drawn to 0, 0, it would be in the middle of the screen. Or if player.X is something big 1000, it is natural that object is drawn off the screen far to left.

edit: For horizontal shooter you have it simple, and can set camY is always 0. Although some games such as classic Tyrian allows some horizontal scrolling aswell, being vertical scroller mainly.

7. Can anyone recommend a good free Delphi library/SDK for creating scrolling sprite games?

8. Originally Posted by alphawiz
Can anyone recommend a good free Delphi library/SDK for creating scrolling sprite games?
Allegro.pas