mirror of
https://github.com/Kapendev/parin.git
synced 2025-05-09 20:28:57 +03:00
Small coin example change.
This commit is contained in:
parent
7a801a02bc
commit
5f7972d438
1 changed files with 4 additions and 12 deletions
|
@ -27,18 +27,10 @@ void ready() {
|
||||||
bool update(float dt) {
|
bool update(float dt) {
|
||||||
// Move the player.
|
// Move the player.
|
||||||
auto playerDirection = Vec2();
|
auto playerDirection = Vec2();
|
||||||
if (Keyboard.left.isDown || 'a'.isDown) {
|
if (Keyboard.left.isDown || 'a'.isDown) playerDirection.x = -1;
|
||||||
playerDirection.x = -1;
|
if (Keyboard.right.isDown || 'd'.isDown) playerDirection.x = 1;
|
||||||
}
|
if (Keyboard.up.isDown || 'w'.isDown) playerDirection.y = -1;
|
||||||
if (Keyboard.right.isDown || 'd'.isDown) {
|
if (Keyboard.down.isDown || 's'.isDown) playerDirection.y = 1;
|
||||||
playerDirection.x = 1;
|
|
||||||
}
|
|
||||||
if (Keyboard.up.isDown || 'w'.isDown) {
|
|
||||||
playerDirection.y = -1;
|
|
||||||
}
|
|
||||||
if (Keyboard.down.isDown || 's'.isDown) {
|
|
||||||
playerDirection.y = 1;
|
|
||||||
}
|
|
||||||
player.position += playerDirection * playerSpeed * Vec2(dt);
|
player.position += playerDirection * playerSpeed * Vec2(dt);
|
||||||
|
|
||||||
// Check if the player is touching some coins and remove those coins.
|
// Check if the player is touching some coins and remove those coins.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue