motorollin
Member
- Joined
- Jul 31, 2007
- Messages
- 163
I'm writing my first ever game for the GP2X using the official SDK. I used the Lazy Foo scrolling tutorial to get my sprite moving around a scrolling background. I'm now trying to add an enemy to the game, but when I specify the x and y co-ordinates for the sprite, these co-ordinates are relative to the camera, not the background. So the following code places the enemy in the top left of the camera, not in the top left of the playfield.
CODE
Enemy::Enemy()
{
x=0;
y=0;
xVel=0;
yVel=0;
}
As the player moves around and the screen scrolls, the enemy stays in the top left corner instead of scrolling off the screen. So my question is this: how can I specify co-ordinates for the enemy relative to the whole game instead of relative to the camera?
TIA
CODE
Enemy::Enemy()
{
x=0;
y=0;
xVel=0;
yVel=0;
}
As the player moves around and the screen scrolls, the enemy stays in the top left corner instead of scrolling off the screen. So my question is this: how can I specify co-ordinates for the enemy relative to the whole game instead of relative to the camera?
TIA