fix to player velocity
This commit is contained in:
+1
-1
@@ -11,7 +11,7 @@ int main() {
|
|||||||
sf::RenderWindow window(sf::VideoMode({WIDTH, HEIGHT}), "SFML window", sf::Style::Default);
|
sf::RenderWindow window(sf::VideoMode({WIDTH, HEIGHT}), "SFML window", sf::Style::Default);
|
||||||
window.setFramerateLimit(60);
|
window.setFramerateLimit(60);
|
||||||
|
|
||||||
Player player { { 16.0f, 16.0f}, { 40, 40}, 1.0f, 20.0f, 2.0f, 2.5 };
|
Player player { { 16.0f, 16.0f}, { 40, 40}, 1.0f, 20.0f, 2.0f, 4 };
|
||||||
player.rect.setFillColor(sf::Color::Black);
|
player.rect.setFillColor(sf::Color::Black);
|
||||||
player.rect.setOutlineColor(sf::Color::White);
|
player.rect.setOutlineColor(sf::Color::White);
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -16,7 +16,7 @@ void Player::handle_movment() {
|
|||||||
if(sf::Keyboard::isKeyPressed(sf::Keyboard::Key::D)) {
|
if(sf::Keyboard::isKeyPressed(sf::Keyboard::Key::D)) {
|
||||||
rect.move({m_velocity.x, 0});
|
rect.move({m_velocity.x, 0});
|
||||||
} if(sf::Keyboard::isKeyPressed(sf::Keyboard::Key::A)) {
|
} if(sf::Keyboard::isKeyPressed(sf::Keyboard::Key::A)) {
|
||||||
rect.move({m_velocity.x, 0});
|
rect.move({-m_velocity.x, 0});
|
||||||
}
|
}
|
||||||
// if(sf::Keyboard::isKeyPressed(sf::Keyboard::Key::W)) {
|
// if(sf::Keyboard::isKeyPressed(sf::Keyboard::Key::W)) {
|
||||||
// rect.move({0, -2.5});
|
// rect.move({0, -2.5});
|
||||||
|
|||||||
Reference in New Issue
Block a user