Player.Scopeはもちろん奇数で、乗せた後にMAP[y][x]が0でなく、さらにScope[y][x]が1でないと通れない…みたいにしたいところなのですが、
コード:
//MAP
#define SCREEN_WIDTH 480
#define SCREEN_HEIGHT 360
#define MAP_PIXEL_HEIGHT (24*15+12)
#define MAP_PIXEL_WIDTH (48*8+24)
#define MAP_HEIGHT (MAP_PIXEL_HEIGHT/12)
#define MAP_WIDTH (MAP_PIXEL_WIDTH/24)
int MAP[MAP_HEIGHT][MAP_WIDTH] =
{
{2,2,2,2,2,2,1,1,1,1,1,1,1,1,1,},
{2,2,2,2,2,2,1,1,1,1,1,1,1,1,1,},
{2,2,2,2,2,2,1,1,1,1,1,1,1,1,1,},
{1,1,1,1,1,1,1,1,1,1,0,0,1,1,1,},
{1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,},
{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,},
{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,},
{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,},
{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,},
{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,},
{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,},
{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,},
{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,},
{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,},
{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,},
};
//移動範囲をこの中に作る
int scope[15][15] =
{
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,},
};
//////////////////////////////
void DrawScope()
{
//この瞬間だけにプレイヤー座標をスコープポジションにコピー
//描画後動かないように表示にはにはスコープポジションを使う
if(ScopeDecision==0)
if( (CommandNumber==1 ||CommandNumber==2) &&CommandSelect==1 ){
ScopePositionX = Player.X;
ScopePositionY = Player.Y;
ScopeDecision=1;
}
int x,y;
SetDrawBlendMode( DX_BLENDMODE_ALPHA, 128 );
for(y=0;y<15;++y)
{
for(x=0;x<15;++x)
{
//プレイヤーを中心に『Player.scope』の数値分のひろがりを1にする(未完成)
if(MAP[y][x]!=0)
scope[ScopePositionY][ScopePositionX] = 1;
//移動範囲で1の部分に青い枠を描画
if(MAP[y][x]!=0){
if(scope[y][x]!=0){
DrawGraph(
(15-y)*(48/2)+(x*24)-24-CameraX,
(x+y)*12-CameraY-24,
Scope,
TRUE); //マップ描画
}
}
}
}
SetDrawBlendMode( DX_BLENDMODE_NOBLEND, 0 );
}