[過去ログ] ズブの初心者がゲーム作れるまで勉強するスレ (990レス)
前次1-
抽出解除 必死チェッカー(本家) (べ) 自ID レス栞 あぼーん

このスレッドは過去ログ倉庫に格納されています。
次スレ検索 歴削→次スレ 栞削→次スレ 過去ログメニュー
リロード規制です。10分ほどで解除するので、他のブラウザへ避難してください。
921: 名前は開発中のものです。 [] 2006/03/25(土) 08:26:50 ID:xoont0lh(1/8) AAS
#define MAX 50 //敵の数最大
#define    cspeed    8 //自機移動速度
#define EBULLET_MAX    50 //敵弾数最大

#include "DxLib.h"

//プロトタイプ宣言
void    Boot_Initialize();
void    Play_Initialize();
void    Stage_Initialize();
void    Enemy_Fire(int cnt);

//変数宣言
struct stEnemy
{
    int enable;
    int x;
    int y;
};
stEnemy Enemies[MAX];
/*
922: 名前は開発中のものです。 [] 2006/03/25(土) 08:27:31 ID:xoont0lh(2/8) AAS
*/
int bl[EBULLET_MAX][4]; //敵の弾

int cx=0, cy=0;
int bx=0, by=0, benable=0;

int ndir=0, dir=0;
int tspeed=0, Teki_Rest=0;

int Score=0, HighScore=0;
int Dead=0, invasion=0;
int Stage_Num=0;

int    HGJiki=0;
int    HGTeki=0;

int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
                 LPSTR lpCmdLine, int nCmdShow )
{
    if( DxLib_Init() == -1 )    // DXライブラリ初期化処理
    {
         return -1;                // エラーが起きたら直ちに終了
    }
/*
923: 名前は開発中のものです。 [] 2006/03/25(土) 08:28:25 ID:xoont0lh(3/8) AAS
*/
    //初期化
    Boot_Initialize();
    Play_Initialize();

    //裏画面
    SetDrawScreen( DX_SCREEN_BACK ) ;

    //*Start
    while (1)
    {
        ClsDrawScreen() ;
        WaitTimer( 1 ) ;

        //自機
        if( CheckHitKey( KEY_INPUT_LEFT ) == 1 )
        {
            cx=cx-cspeed;
            if (cx<0) cx=0;
        }
/*
924: 名前は開発中のものです。 [] 2006/03/25(土) 08:29:18 ID:xoont0lh(4/8) AAS
*/
        if( CheckHitKey( KEY_INPUT_RIGHT ) == 1 )
        {
            cx=cx+cspeed;
            if (cx>639-32) cx=639-32;
        }

        if( CheckHitKey( KEY_INPUT_LCONTROL ) == 1 )
        {
            if (benable == 0) {
                benable=1;
                bx=cx+16;
                by=cy;
            }
        }
        DrawGraph( cx , cy , HGJiki , FALSE ) ;

        //自機弾
        if (benable == 1) {
            by=by-8;
            if (by<0) benable=0;
            DrawLine(bx, by, bx, by-16, GetColor(255,255,255));
        }
/*
925: 名前は開発中のものです。 [] 2006/03/25(土) 08:31:10 ID:xoont0lh(5/8) AAS
*/
        //敵機
        ndir=dir;
        for (int cnt=0 ; cnt<MAX ; cnt++)
        {
            if (Enemies[cnt].enable == 1)
            {
                DrawGraph( Enemies[cnt].x, Enemies[cnt].y, HGTeki , FALSE ) ;

                Enemies[cnt].x = Enemies[cnt].x+dir;
                if (Enemies[cnt].x <= 0) ndir = tspeed;
                if (Enemies[cnt].x >= 602) ndir = -tspeed;

                //あたり判定
                if (benable && (Enemies[cnt].x < bx) && ((Enemies[cnt].x + 32) > bx) && (Enemies[cnt].y < by) && ((Enemies[cnt].y+32) > by) )
                {
                    Enemies[cnt].enable = 0;
                    Score = Score + 10;
                    Teki_Rest = Teki_Rest - 1;
/*
929
(1): 名前は開発中のものです。 [] 2006/03/25(土) 15:57:33 ID:xoont0lh(6/8) AAS
C++/DXライブラリ 構造体を利用
外部リンク:blog.goo.ne.jp

ソースをうpできる場所を確保してきました
長いものはこちらにうpします
932: 名前は開発中のものです。 [] 2006/03/25(土) 20:58:41 ID:xoont0lh(7/8) AAS
中途半端なのでうpしてしまいますね
*/
                    Enemy_Fire(cnt);
                }

                //敵が接地したか
                if (Enemies[cnt].y > 448) invasion = 1;
            }
        }

        if (dir != ndir) {
            for (int cnt=0 ; cnt<MAX ; cnt++)
            {
                Enemies[cnt].y = Enemies[cnt].y + 4;
            }
        }
        dir = ndir;
/*
933
(2): 名前は開発中のものです。 [] 2006/03/25(土) 20:59:11 ID:xoont0lh(8/8) AAS
        //敵弾
        for (int cnt=0 ; cnt<EBULLET_MAX ; cnt++)
        {
            if (bl[cnt][0] == 1)
            {
                bl[cnt][3] = bl[cnt][3] + 8; //移動
                DrawLine(bl[cnt][2], bl[cnt][3], bl[cnt][2], bl[cnt][3] + 16, GetColor(255,255,255)); //描画
                if (bl[cnt][3] > 480) bl[cnt][0] = 0; //画面外なら使用終了
                if ((bl[cnt][2] > cx) && (bl[cnt][2] < cx + 32) && (bl[cnt][3] > cy) && (bl[cnt][3] < cy+32)) Dead = 1; //自機との当たり判定
            }
        }

        DrawFormatString( 200, 0, GetColor(255,255,255), "Score : %d", Score);

        if (Score > HighScore) HighScore = Score;
        DrawFormatString( 0, 0, GetColor(255,255,255), "High-Score : %d", HighScore);

        // 裏画面の内容を表画面に反映させる
        ScreenFlip() ;
前次1-
スレ情報 赤レス抽出 画像レス抽出 歴の未読スレ AAサムネイル

ぬこの手 ぬこTOP 0.045s