my 1st person view ( avata always at center)
allow avata to chenge angle, therefore the background image can rotate and scroll.
my total image is twice as large as the monitor composed with tiles with 200 size
void CApp::OnLoop() {
float ElapsedTime = GetFrameTime();
bool k=false;
if (GetInput().IsKeyDown(sf::Key::Left)) { k=true; Background.Rotate(100 * ElapsedTime);}
if (GetInput().IsKeyDown(sf::Key::Right)) { k=true; Background.Rotate( -100 * ElapsedTime);}
if (GetInput().IsKeyDown(sf::Key::Up)) { k=true; Background.Move(0, 100 * ElapsedTime);}
if (GetInput().IsKeyDown(sf::Key::Down)) { k=true; Background.Move(0, -100 * ElapsedTime);}
float x = Background.GetPosition().x;
float y = Background.GetPosition().y;
float r = Background.GetRotation();
x=W/2+ fmod(x-W/2,200/fabs(sin(r*M_PI/180)));
y=H/2+ fmod(y-H/2,200/fabs(cos(r*M_PI/180)));
Background.SetPosition(x,y);
}
however, when there is an angle, the image is jumpy
when no angle, the program works.
Please help!
Appreciated.