0
생성 불법 플레이어'INT '다음'을 (한 당신은 ';'을 잊었습니까?)
라인 5, const int WIDTH = 1280
그러나 나는 내가 잘못했는지 이해하지 못합니다.플레이어 구조체가 나는 오류를 얻고있다 C2440 오류
내 선언 :
#include <allegro5\allegro.h>
#include <allegro5\allegro_primitives.h>
#include "objects.h"
const int WIDTH = 1280;
const int HEIGHT = 720;
const float GRAVITY = 1.5;
const float FORCE = 1.4;
const float K = 0.25;
enum KEYS{UP, DOWN, LEFT, RIGHT, SPACE};
bool keys[5] = {false, false, false, false, false};
void InitPlayer();
void DrawPlayer();
Player player;
InitPlayer 기능 :
void InitPlayer() {
player.x = 0;
player.y = HEIGHT - 20;
player.vy = 0;
player.vx = 0;
player.fx = 0;
player.jumping = false;
}
플레이어 구조체 :
struct Player {
float x;
float y;
float fx;
float vx;
float vy;
int direction;
bool jumping;
void Jump() {
if(!jumping) {
vy = -15;
jumping = true;
}
}
}