I get the error:
/var/folders/9k/5q2b1vds4nbbdyvr7t_3zlrh0000gn/T//ccOOqDaa.ltrans0.ltrans.o: In function `playerInput':
/Users/sussymcdonalds/Downloads/ARDUBOY/Untitled-Platformer/player.cpp:16: undefined reference to `player'
/Users/sussymcdonalds/Downloads/ARDUBOY/Untitled-Platformer/player.cpp:20: undefined reference to `player'
/Users/sussymcdonalds/Downloads/ARDUBOY/Untitled-Platformer/player.cpp:20: undefined reference to `player'
/Users/sussymcdonalds/Downloads/ARDUBOY/Untitled-Platformer/player.cpp:20: undefined reference to `player'
/Users/sussymcdonalds/Downloads/ARDUBOY/Untitled-Platformer/player.cpp:20: undefined reference to `player'
/var/folders/9k/5q2b1vds4nbbdyvr7t_3zlrh0000gn/T//ccOOqDaa.ltrans0.ltrans.o:/Users/sussymcdonalds/Downloads/ARDUBOY/Untitled-Platformer/player.cpp:20: more undefined references to `player' follow
collect2: error: ld returned 1 exit status
exit status 1
IntelliSense configuration already up to date. To manually rebuild your IntelliSense configuration run "Cmd+Alt+I"
[Error] Analyzing sketch 'Untitled-Platformer.ino': Exit with code=1
player.h:
#pragma once
#include <stdint.h>
#include <Arduboy2.h>
class Player
{
private:
struct Physics
{
static constexpr float gravity = 0;
static constexpr float friction = 0;
static constexpr float cutOffPoint = 0;
};
struct PlayerProperties
{
float x;
float y;
float xVelocity;
float yVelocity;
static constexpr uint8_t size = 8;
static constexpr float speed = 0.5;
bool isPlayerRight;
};
Physics physics;
PlayerProperties playerProperties;
void playerInput();
void drawPlayer();
public:
void updatePlayer();
Arduboy2 arduboy;
};
extern Player player;
player.cpp:
#include "player.h"
#include "sprites.h"
void Player::updatePlayer()
{
playerInput();
playerProperties.yVelocity += Physics::gravity;
playerProperties.x += playerProperties.xVelocity;
playerProperties.y += playerProperties.yVelocity;
}
void Player::playerInput()
{
playerProperties.isPlayerRight = true;
if (arduboy.pressed(RIGHT_BUTTON))
{
playerProperties.xVelocity += PlayerProperties::speed;
playerProperties.isPlayerRight = true;
}
if (arduboy.pressed(LEFT_BUTTON))
{
playerProperties.xVelocity -= PlayerProperties::speed;
playerProperties.isPlayerRight = false;
}
}
void Player::drawPlayer()
{
Sprites::drawOverwrite(playerProperties.x, playerProperties.y, playerSprite, playerProperties.isPlayerRight);
}
Iâve been shaking my head over this for hours at this point. Everything seems fine however.
Also uhh . . . anyone know a good light theme for VSCode? All the light themes appear waay too bright.