矩形の当たり判定です
#include "DxLib.h"
void sentouki();
void yomikomi();
void hanntei();
// WinMain関数
int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int nCmdShow )
{
ChangeWindowMode( TRUE ) ;
DxLib_Init();
yomikomi();
while(!ProcessMessage() && !ClearDrawScreen()){
sentouki();
hanntei();
WaitTimer( 20 ) ;
}
// DXライブラリ使用の終了処理
DxLib_End() ;
// ソフトの終了
return 0 ;
}
#include "DxLib.h"
static int handoru;
static int handoru2;
static int x1=200;
static int y1=200;
static int x2=x1+258;
static int y2=y1+258;
static int x3=250;
static int y3=100;
static int x4=x3+32;
static int y4=y3+32;
static int flag=1;
void yomikomi(){
handoru = LoadGraph("EDGE1.png");
handoru2 = LoadGraph("EDGE2.bmp");
}
void sentouki(){
DrawGraph(x1,y1,handoru,TRUE);
DrawGraph(x3,y3,handoru2,TRUE);
}
void hanntei(){
if( CheckHitKey( KEY_INPUT_UP ) == 1 ) y3 += 8 ;
if( x1<x4 && y1<y4 && x2>x3 && y2>y3) y3 -= 8;
}
移動キャンセルをしたいつもりです
自分で考えれば良いと思われるかもしれませんが課題的なもので・・・
いやはや、すみません 教えていただけると光栄です