インスタンスが引数リストと一致しません

フォーラム(掲示板)ルール
フォーラム(掲示板)ルールはこちら  ※コードを貼り付ける場合は [code][/code] で囲って下さい。詳しくはこちら
backbone

インスタンスが引数リストと一致しません

#1

投稿記事 by backbone » 8年前

http://bituse.info/game/shot/10
上記のサイトを見ながらSTGを作っているのですが
「コンストラクター"ENEMY::ENEMY"のインスタンスが引数リストと一致しません」と
エラーが出てしまいます。
何度も見直したのですが
治りません。
分かる方いたら教えていただきたいです。

コード:

[enemy.h]
class ENEMY {
private:
 //座標とグラフィックハンドル 
 double x, y;
 int gh[3];
 //画像サイズ 
 int width, height;
 //出現、停止、帰還、発射タイミング 
 int in_time, stop_time, out_time, shot_time;
 //敵の種類 
 int type;
 //弾の種類 
 int stype;
 //移動パターン 
 int m_pattern;
 //ショットパターン 
 int s_pattern;
 //敵が出現してからのカウント 
 int count;
 //敵消滅フラグ 
 bool deadflag;
 //敵クラス消滅フラグ 
 bool endflag;
 //弾構造体 
 E_SHOT shot[ENEMY_SNUM];
 //ショットが撃てるようになったかのフラグ 
 bool sflag;
 //ショットが打てるようになってからのカウント 
 int scount;
public:
 bool All();
 void Move();
 void Shot();
 void Draw();
 ENEMY(char *c_filename, int type, int m_pattern, int x, int y, int in_time, int stop_time, int shot_time, int out_time, char *s_filename, int stype, int s_pattern, int speed);
};

[enemy.cpp]
#include"pch.h"
#include"enemy.h"
ENEMY::ENEMY(char *c_filename, int type, int m_pattern, int x, int y, int in_time,
 int stop_time, int shot_time, int out_time, 
 char *s_filename, int stype, int s_pattern, int speed)
{
 //読み込み 
 LoadDivGraph(c_filename, 3, 1, 3, 27, 25, gh);
 
 //サイズ 
 width = 27;
 height = 25;
 //敵の種類 
 this->type = type;
 //弾の種類 
 this->stype = stype;
 //移動パターンとショットパターン 
 this->m_pattern = m_pattern;
 this->s_pattern = s_pattern;
 //座標セット 
 this->x = x;
 this->y = y;
 //出現、停止、発射、帰還時間セット 
 this->in_time = in_time;
 this->stop_time = stop_time;
 this->shot_time = shot_time;
 this->out_time = out_time;
 //弾画像とサイズ取得 
 int temp = LoadGraph(s_filename);
 int w, h;
 GetGraphSize(temp, &w, &h);
 //弾の初期化 
 for (int i = 0; i < ENEMY_SNUM; ++i)
 {
  shot[i].flag = false;
  shot[i].gh = temp;
  shot[i].width = w;
  shot[i].height = h;
  shot[i].pattern = s_pattern;
  shot[i].speed = speed;
  shot[i].x = x;
  shot[i].y = y;
 }

 count = 0;
 scount = 0;
 deadflag = false;
 endflag = false;
 sflag = false;
}

void ENEMY::Move()
{
 //出てきてから止まる時間までの間なら下に移動 
 if (in_time < g_count && g_count < stop_time) 
 {
  y += 2;
  //帰還時間を過ぎたら戻る。 
 }
 else if (g_count > out_time)
 {
  y -= 2;
  if (y < -40)
  {
   endflag = true;
  }
 }
}
void ENEMY::Shot()
{
 //発射タイミングになったら、フラグを立てる 
 if (shot_time == g_count) 
 {
  sflag = true;
 }
 //フラグ立ってるときだけ 
 if (sflag) {
  switch (s_pattern) {
  case 0:
   //10回に一回発射。40までなので5発発射。 
   if (scount % 10 == 0 && scount <= 40) 
   {
    for (int i = 0; i < ENEMY_SNUM; ++i) 
    {
     //フラグが立ってない弾を探して、座標等をセット 
     if (shot[i].flag == false) 
     {
      shot[i].flag = true;
      shot[i].x = x;
      shot[i].y = y;
      break;
     }
    }
   }
   break;
  }
  //フラグが立ってる弾の数 
  int s = 0;
  //フラグ立ってる弾だけ、弾の移動を行う 
  for (int i = 0; i < ENEMY_SNUM; ++i) 
  {
   if (shot[i].flag) 
   {
    shot[i].y += shot[i].speed;
    //弾が画面をはみ出たらフラグを戻す。 
    if (shot[i].x < -20 || shot[i].x>420 || shot[i].y < -20 || shot[i].y>500) 
    {
     shot[i].flag = false;
     continue;
    }
    ++s;
   }
  }
  //sがゼロということは発射中の弾がない。 
  //かつdeadflagがTRUEということはこの敵のクラスは消滅させてもよい 
  if (s == 0 && deadflag) 
  {
   //敵クラス消滅フラグをTRUEにする 
   endflag = true;
  }
  ++scount;
 }
}

void ENEMY::Draw()
{
 int temp;
 //弾から最初に描画 
 for (int i = 0; i < ENEMY_SNUM; ++i)
 {
  if (shot[i].flag)
  {
   DrawGraph(shot[i].x, shot[i].y, shot[i].gh, true);
  }
 }
 if (!endflag)
 {
  temp = count % 40 / 10;
  if (temp == 3)
   temp = 1;
  DrawGraph(x, y, gh[temp], TRUE);
 }
}
bool ENEMY::All()
{
 Move();
 Shot();
 Draw();
 ++count;
 return endflag;
}

[control.h]
#include "player.h" 
#include"back.h"
#include"enemy.h"
class CONTROL{
private:
 //プレイヤークラス
 PLAYER *player;
 
 //背景クラス
 BACK *back;
 //エネミークラス
 ENEMY *enemy;
public:
 CONTROL();
 void All();
};

[control.cpp]
#include "pch.h"
#include "control.h"
CONTROL::CONTROL()
{
 //プレイヤークラスの生成
 player = new PLAYER;
   //背景クラスの生成
 back = new BACK;
   //エネミークラスの生成
enemy = new ENEMY("DATA/BG/enemy.png", 0, 50, -40, 120, 180, 181, 360, "DATA/BG/enemyshot1.png", 0, 4); 
//ここでエラーが出ます
}
void CONTROL::All()
{
 //描画領域を指定
 SetDrawArea(MARGIN, MARGIN, MARGIN + 380, MARGIN + 460);
 //背景クラスのAll関数実行
 back->ALL();
 //プレイヤークラスのAll関数実行
 player->All();
 //エネミークラスのAll関数実行
 if (enemy != NULL)
 {
  if (enemy->All())
  {
   delete enemy;
   enemy = NULL;
  }
 }
 ++g_count;
}


アバター
usao
記事: 1889
登録日時: 12年前
連絡を取る:

Re: インスタンスが引数リストと一致しません

#2

投稿記事 by usao » 8年前

引数の個数が足りないのでは.

backbone

Re: インスタンスが引数リストと一致しません

#3

投稿記事 by backbone » 8年前

解決しました
ありがとうございます!

閉鎖

“C言語何でも質問掲示板” へ戻る