0 Members and 1 Guest are viewing this topic.
const sf::Input& Input = window.GetInput();/float ResetValue = 1.0f;float XPos = Player.Sprite.GetPosition().x;//Position of the player spritefloat YPos = Player.Sprite.GetPosition().y;if(Input.IsKeyDown(sf::Key::Right) if(test.PixelPerfectTest(Player.Sprite,TestBox))//Testbox is a sprite Player.Sprite.SetPosition(XPos-ResetValue,YPos); else Player.Sprite.SetPosition(XPos+Player.Speed,YPos);
if(Input.IsKeyDown(sf::Key::Right)) { Player.ChangeAnim(2); Player.PlayAnim(); Player.Sprite.SetPosition(XPos+Player.Speed,YPos); GameView.Move(Player.Speed,0); if(test.PixelPerfectTest(Player.Sprite,CBox))//if collision { Player.Sprite.SetPosition(XPos,YPos);//reset the sprite GameView.Move(-Player.Speed,0);//reset the map } return; }