-Enemy.h-
#pragma once
#include "DxLib.h"
#include "Types.h"
#include "Player.h"
class Enemy
{
Point2D e;
bool isBulletEnemyHit;
int e_graph;
public:
Enemy(const Point2D& e_);
int e_x();
int e_y();
void draw();
void move();
bool isInsector(const Player& Pl) const;
Point2D rePoint();
};
-Enemy.cpp-
#include "Enemy.h"
#include "Globals.h"
Enemy::Enemy(const Point2D& e_)
: e(e_), isBulletEnemyHit(false)
{
e_graph = LoadGraph("passer画像/とりんドル.png");
}
void Enemy::draw()
{
DrawGraph(e.x, e.y, e_graph, TRUE);
}
void Enemy::move()
{
//e.x ++;
}
bool Enemy::isInsector(const Player& Pl) const
{
if(e.x >= Pl.bulletPos_x()){
printfDx("fds");
}
return TRUE;
}
Point2D Enemy::rePoint()
{
DrawFormatString(450, 40, GetColor(255, 255, 255), "敵座標(%d, %d)", e.x, e.y);
return e;
}
-PlayScene.cpp-
#include "PlayScene.h"
#include "Globals.h"
PlayScene::PlayScene()//PlaySceneで呼び出されている、PlayScene関数の処理定義
{
player = new Player(Point2D(320, 240));//playerの初期化
enemy = new Enemy(Point2D(200, 200));
mouseCursor = new MouseCursor();
}
PlayScene::~PlayScene()
{
delete player;
delete enemy;
delete mouseCursor;
}
void PlayScene::draw()//PlaySceneで呼び出されているdraw関数の処理定義
{
player->draw();//playerクラスのdraw関数を呼び出す
player->rePoint();
enemy->draw();
enemy->rePoint();
}
void PlayScene::update(MouseCursor *mouseCursor)
{
mouseCursor->move();
player->move(mouseCursor);
player->shot(mouseCursor);
enemy->move();
enemy->isInsector(player);
if( CheckHitKey(KEY_INPUT_Q) ){
currentScene = gameoverScene;
}
}
このプログラムをビルドすると
以下のようなエラーが出て何が原因なのかわかりません。
どなたか教えてください
[c:\users\test\downloads\passer\gameprog\enemy.h(20): error C4430: 型指定子がありません - int と仮定しました。メモ: C++ は int を既定値としてサポートしていません
1>c:\users\test\downloads\passer\gameprog\enemy.h(20): error C2143: 構文エラー : ',' が '&' の前にありません。
1> Enemy.cpp
1>c:\users\test\downloads\passer\gameprog\playscene.cpp(35): error C2664: 'Enemy::isInsector' : 1 番目の引数を 'Player *' から 'const int' に変換できません。(新しい機能 ; ヘルプを参照)
1> この変換が可能なコンテキストはありません。