関係ありそうなプログラムを・・・
プレイヤー関係↓
/* player.cpp */
#include "DxLib.h"
#include "ExternGV.h"
void PlayerControl(){
if(Key[KEY_INPUT_LEFT]==1){
Player.x-=4.0f;
if(Player.x<10)
Player.x=10;
}
if(Key[KEY_INPUT_RIGHT]==1){
Player.x+=4.0f;
if(Player.x>578)
Player.x=578;
}
if(Key[KEY_INPUT_UP]==1){
Player.y-=4.0f;
if(Player.y<10)
Player.y=10;
}
if(Key[KEY_INPUT_DOWN]==1){
Player.y+=4.0f;
if(Player.y>324)
Player.y=324;
}
DrawGraph((int)Player.x,(int)Player.y,img_player,TRUE);
DrawCircle ( Player.x+35 , Player.y+28 , 2 , GetColor(255,0,0) ) ;//中心点を描画
}
void PlayerShotCalc(){
int j,i;
if(Key[KEY_INPUT_Z]==1 && counter%4==0){
int positionx[7]={0,-5,-5,-10,-10,-15,-15},positiony[7]={0,-20,20,-30,30,-40,40};
for(i=0;i<ShotLevel;i++){
for(j=0;j<PLAYER_MAX_SHOT1;j++){
if(PlayerShot[j][i].flag==0){
PlayerShot[j][i].flag=1;
PlayerShot[j][i].x=Player.x+(double)positionx[i];
PlayerShot[j][i].y=Player.y+(double)positiony[i];
if(CheckSoundMem(sound_player_shot[0])==0) //現在ショット音が再生されていなければ
PlaySoundMem(sound_player_shot[0],DX_PLAYTYPE_BACK); //ショット音を再生する
break;
}
}
}
}
int sab[7]={0,-1,1,-2,2,-3,3};
for(i=0;i<PLAYER_MAX_SHOT2;i++){
for(j=0;j<PLAYER_MAX_SHOT1;j++){
if(PlayerShot[j][i].flag==1)
PlayerShot[j][i].x+=15;
PlayerShot[j][i].y+=(double)sab[i];
if(PlayerShot[j][i].x>660)
PlayerShot[j][i].flag=0;
if(PlayerShot[j][i].y>520)
PlayerShot[j][i].flag=0;
if(PlayerShot[j][i].y<-40)
PlayerShot[j][i].flag=0;
}
}
if(Key[KEY_INPUT_X]==1 && counter%4==0){
PlayerShot2[j][i].flag=1;
PlayerShot2[j][i].x=Player.x;
PlayerShot2[j][i].y=Player.y;
}
if(Key[KEY_INPUT_X]==0)
PlayerShot2[j][i].flag=0;
if(Key[KEY_INPUT_C]==1 && counter%4==0){
PlayerShot3.flag=1;
}
if(Key[KEY_INPUT_C]==0)
PlayerShot3.flag=0;
}
void PlayerShotDisp(){
DrawGraph((int)Player.x+8,(int)Player.y-25,img_player_shot[3],TRUE);
DrawGraph((int)Player.x+8,(int)Player.y+55,img_player_shot[3],TRUE);
int j,i;
for(j=0;j<PLAYER_MAX_SHOT1;j++){
for(i=0;i<PLAYER_MAX_SHOT2;i++){
if(PlayerShot[j][i].flag==1){
switch(i){
case 0:
DrawGraph((int)PlayerShot[j][i].x+30,(int)PlayerShot[j][i].y+7,img_player_shot[0],TRUE);
break;
default:
DrawGraph((int)PlayerShot[j][i].x+30,(int)PlayerShot[j][i].y+15,img_player_shot[1],TRUE);
break;
}
}
}
}
if(PlayerShot2[j][i].flag==1){
DrawGraph((int)Player.x+16,Player.y-25,img_player_shot[2],TRUE);
DrawGraph((int)Player.x+16,Player.y+55,img_player_shot[2],TRUE);
}
DrawRotaGraph2 ( Player.x+35 , Player.y+28 , 8 , 76 , 1.0 , (double)Player.count*0.05 , img_player_shot[3] , TRUE ) ;//回転描画
DrawRotaGraph2 ( Player.x+35 , Player.y+28 , 8 , -60 , 1.0 , (double)Player.count*0.05 , img_player_shot[3] , TRUE ) ;//回転描画
DrawRotaGraph2 ( Player.x+35 , Player.y+28 , 76 , 8 , 1.0 , (double)Player.count*0.05 , img_player_shot[8] , TRUE ) ;//回転描画
DrawRotaGraph2 ( Player.x+35 , Player.y+28 , -60 , 8 , 1.0 , (double)Player.count*0.05 , img_player_shot[8] , TRUE ) ;//回転描画
if(PlayerShot3.flag==1){
DrawRotaGraph2 ( Player.x+35 , Player.y+28 , 8 , 164 , 1.0 , (double)Player.count*0.05 , img_player_shot[4] , TRUE ) ;
DrawRotaGraph2 ( Player.x+35 , Player.y+28 , 8 , -68 , 1.0 , (double)Player.count*0.05 , img_player_shot[5] , TRUE ) ;
DrawRotaGraph2 ( Player.x+35 , Player.y+28 , 164 , 8 , 1.0 , (double)Player.count*0.05 , img_player_shot[6] , TRUE ) ;
DrawRotaGraph2 ( Player.x+35 , Player.y+28 , -68 , 8 , 1.0 , (double)Player.count*0.05 , img_player_shot[7] , TRUE ) ;
}
Player.count++;
}
背景関係↓
/* background.cpp */
#include "DxLib.h"
#include "ExternGV.h"
void Background(){
BackGround[1].x=BackGround[1].x-2.0;
BackGround[2].x=BackGround[2].x-2.0;
if (BackGround[1].x+320<-320){
BackGround[1].x=BackGround[2].x+640;
}
if (BackGround[2].x+320<-320){
BackGround[2].x=BackGround[1].x+640;
}
DrawGraph(BackGround[1].x,0,img_background[0],FALSE);
DrawGraph(BackGround[2].x,0,img_background[1],FALSE);
}
void BackGround2(){
DrawGraph(0,0,img_waku[0],TRUE);
}
敵関係↓
/* enemy.cpp */
#include "DxLib.h"
#include "ExternGV.h"
#include <math.h>
#define PI 3.141593
void EnemyPattern1(int i){
enemy[i].x-=3.0f;
}
void EnemyPattern2(int i){
if(enemy[i].counter<50)
enemy[i].x-=4.0f;
if(enemy[i].counter>100)
enemy[i].x+=4.0f;
}
void EnemyPattern3(int i){
enemy[i].y+=sin(PI*enemy[i].counter/40.0f)*5.0f;
enemy[i].x-=3.0f;
}
void EnemyPattern4(int i){
if(enemy[i].counter<100)
enemy[i].x-=3.0f;
if(enemy[i].counter>=100){
enemy[i].y+=sin(PI*(enemy[i].counter-100.0f)/160.0f)*2.5f;
enemy[i].x-=sin(PI*(enemy[i].counter-20.0f )/160.0f)*2.5f;
}
}
void EnemyControl(){
for(int i=0;i<100;i++)
if(enemy[i].flag==1){
if(enemy[i].pattern==1)
EnemyPattern1(i);
if(enemy[i].pattern==2)
EnemyPattern2(i);
if(enemy[i].pattern==3)
EnemyPattern3(i);
if(enemy[i].pattern==4)
EnemyPattern4(i);
}
}
void EnemyCalcDisp(){
int i;
for(i=0;i<100;i++)
if(enemy[i].flag==0)
break;
switch(counter){
case 50:
enemy[i].flag=1;
enemy[i].counter=0;
enemy[i].pattern=1;
enemy[i].size=0.5f;
enemy[i].x=650.0;
enemy[i].y=120.0;
break;
case 200:
enemy[i].pattern=2;
enemy[i].flag=1;
enemy[i].counter=0;
enemy[i].size=0.5f;
enemy[i].x=650.0;
enemy[i].y=160.0;
break;
case 350:
enemy[i].pattern=3;
enemy[i].flag=1;
enemy[i].counter=0;
enemy[i].size=0.5f;
enemy[i].x=650.0;
enemy[i].y=200.0;
break;
case 500:
enemy[i].pattern=4;
enemy[i].flag=1;
enemy[i].counter=0;
enemy[i].size=0.5f;
enemy[i].x=650.0;
enemy[i].y=120.0;
break;
default:
break;
}
for(i=0;i<100;i++){
if(enemy[i].flag==1){
enemy[i].counter++;
int enemy_img[2]={0,1};
DrawRotaGraph( (int)enemy[i].x , (int)enemy[i].y , enemy[i].size , 0.0f , img_enemy1[enemy_img[counter%32/16]] , TRUE ) ;
if(enemy[i].x<0.0-MONSTER1_X_SIZE/2.0*enemy[i].size || enemy[i].x>651.0+MONSTER1_X_SIZE/2.0*enemy[i].size ||
enemy[i].y<0.0-MONSTER1_Y_SIZE/2.0*enemy[i].size || enemy[i].y>644.0-MONSTER1_Y_SIZE/2.0*enemy[i].size)
enemy[i].flag=0;
}
}
}
fps関係↓
/* fps.cpp */
#include "DxLib.h"
#include "ExternGV.h"
void FpsTimeFanction(){
static int FpsTime[2]={0,},FpsTime_i=0;
static double Fps=0.0;
if(FpsTime_i== 0)
FpsTime[0]=GetNowCount();
if(FpsTime_i==49){
FpsTime[1]=GetNowCount();
Fps = 1000.0f / ((FpsTime[1] - FpsTime[0]) / 50.0f);
FpsTime_i=0;
}
else
FpsTime_i++;
if(Fps != 0)
DrawFormatString(565,0,color_brack,"FPS %.1f",Fps); //fpsを表示
return;
}
/* main.cpp */
#include "DxLib.h"
#include "GlobalVariable.h"
int WINAPI WinMain( HINSTANCE hInstance,
HINSTANCE hPrevInstance,LPSTR lpCmdLine, int nCmdShow ){
extern void img_sound_load();
extern void initialization();
extern void SetColor();
extern void Background();
extern void BackGround2();
extern void PlayerShotCalc();
extern void PlayerShotDisp();
extern void PlayerControl(); extern void EnemyControl();
extern void EnemyCalcDisp();
extern void FpsTimeFanction();
extern void Font();
extern void wait_fanc();
int RefreshTime=0;
ChangeWindowMode( TRUE ) ;
if( DxLib_Init() == -1 ) return -1;
SetDrawScreen( DX_SCREEN_BACK ) ; //裏画面を使用する。
img_sound_load();
initialization();
SetColor();
while(ProcessMessage() == 0 && GetHitKeyStateAll(Key) == 0){
RefreshTime = GetNowCount(); //今の時間を取得
ClearDrawScreen(); //裏画面のデータを全て削除
Background();
EnemyControl();
EnemyCalcDisp();
PlayerShotCalc();
PlayerShotDisp();
PlayerControl();
BackGround2();
FpsTimeFanction();
ScreenFlip() ; //裏画面データを表画面へ反映
counter++;
if(Key[KEY_INPUT_ESCAPE]==1) break;
while(GetNowCount() - RefreshTime < 17);
}
DxLib_End() ;
return 0 ;
}
です。
自分がインストールしたものでは何が関係あるかさっぱりわからないので、
今度友人の家にいって試してみたいと思います。