LoginSignup
1
0

C++でポケモンゲームを作成してみた

Posted at

概要

記事を読んでいただきありがとうございます。
c++の勉強を目的にゲームを作成しましたので、
ゲームの質にはこだわっておりません。
メモ書き程度に書いておりますのでご了承下さい。

今回はC++を用いてポケモンバトルゲームを作成いたしました。
ダイヤモンド・パール・プラチナの最初のジムリーダーであるヒョウタと
対戦することができます。

GitHub

https://github.com/futurecreatenow/pokemon_project.git
※画像・音声ファイルは載せておりません。
 コードのみとなります。

ゲームの流れ

➀主人公とジムリーダーが会う
 →それぞれの座標が一致するとバトルが開始されます。
②ズガイドス、イワーク、イシツブテの順に
 私のポケモン(モウカザル)と対戦します。
 →素早さ値が高い方を先行として、
  4つの技の中から一つ選択して相手にダメージを与えます。

イメージ

battle_start.png
battle_waza.png
battle_win.png

コード

以下はメインファイルになります。

#define WIN_MAX_X 1500
#define WIN_MAX_Y 1500
#define WIN_POS_X 0
#define WIN_POS_Y 0

#define POKEMON_CELL 50

enum MEN {
    MEN_00_Title,
    MEN_01_Action,
    MEN_02_Battle_start,
    MEN_03_Battle,
};
int Sce = MEN::MEN_00_Title;
#include "DxLib.h"
#include "Setting.h"
#include "Picture.h"
#include "Poke.h"
#include "Tec.h"
#include "Title.h"
#include "Move.h"
#include "Battle_start.h"
#include "Battle.h"
int WINAPI WinMain(

    _In_ HINSTANCE hInstance,
    _In_opt_ HINSTANCE hPrevInstance,
    _In_ LPSTR IpCmdLine,
    _In_ int nShoCmd) {
    ChangeWindowMode(TRUE);
    DxLib_Init();

    //Window Init
    SetWindowInitPosition(WIN_POS_X, WIN_POS_Y);
    SetWindowText("POKEMON Mul Battle");
    SetGraphMode(WIN_MAX_X, WIN_MAX_Y, 32);
    SetBackgroundColor(255, 255, 255);
    SetDrawScreen(DX_SCREEN_BACK);

    Col.Read();
    Fon.Read();
    Sound.Read();
    Pic.Read();
    while (ScreenFlip() == 0 &&
        ClearDrawScreen() == 0 &&
        ProcessMessage() == 0 &&
        GetKey() == 0 &&
        Key[KEY_INPUT_ESCAPE] == 0)
    {
        switch (Sce)
        {
        case MEN::MEN_00_Title:
            Tit.Out();
            break;
        case MEN::MEN_01_Action:
            Mov.Out();
            break;
        case MEN::MEN_02_Battle_start:
            Battle_sta.Out();
            break;
        case MEN::MEN_03_Battle:
            Bat.Out();
            break;
        }
    }
    DxLib_End(); // DXライブラリ終了処理
    return 0;
}

参考

 youtuber:Jack
 動画タイトル:【ゲームプログラミング,C++】ポケモン赤・緑作ってみた!

ライブラリ

 DXライブラリ
 https://dixq.net/g/

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0