自機が当たったら玉は消えて得点が加算されるゲームを作っているんですが、
当たり判定が分からないので教えて下さい!!
↓↓スクリプトです↓↓
//拡張プラグインを読み込み #uselib "user32" #func GetWindowLong "GetWindowLongA" int, int #func SetWindowLong "SetWindowLongA" int, int, int #func SetWindowPos "SetWindowPos" int, nullptr, nullptr, nullptr, nullptr, nullptr, int #func GetClassLong "GetClassLongA" int, int #func SetClassLong "SetClassLongA" int, int, int #include "gdi32.as" //マクロ #define ctype RGB(%1,%2,%3) (%1 | %2 << 8 | %3 << 16) //モジュール開始 #module #define ctype max( %1, %2 ) ( %1 )*( %1 > %2 ) + ( %2 )*( %1 <= %2 ) #define ctype min( %1, %2 ) ( %1 )*( %1 < %2 ) + ( %2 )*( %1 >= %2 ) #const DEFAULT_R 20 #deffunc rboxf int _x1, int _y1, int _x2, int _y2, int _r x1 = min(_x1, _x2) : x2 = max(_x1, _x2) y1 = min(_y1, _y2) : y2 = max(_y1, _y2) box_width = x2 - x1 : box_height = y2 - y1 if ( _r <= 0 ) { r = DEFAULT_R } else { r = _r } r = min( r, min( box_width / 2, box_height / 2 ) ) boxf x1, y1+r, x2, y2-r boxf x1+r, y1, x2-r, y2 repeat 4 x = x1 + ( cnt \ 2 ) * ( box_width - r * 2 + 1) y = y1 + ( cnt / 2 ) * ( box_height - r * 2 + 1 ) circle x, y, x + r * 2, y + r * 2 loop return #deffunc CenterMes str moji sdim word,1024 font "游ゴシック",20,0 msgx=320-(strlen(moji)*5) pos msgx,230 mes moji return //モジュール終了 #global //変数の宣言 dim hInput, 1 sdim word,1024 //絶対に必要な命令 oncmd gosub *ctlcoloredit, $133 onexit *exit //テスト時 goto *start //画面作成 screen 0,ginfo(20),ginfo(21),0,0,0 width 640,480,ginfo(20)/2-320,ginfo(21)/2-300 //タイトル名 title "CircleTraining ver1.0" //*******中略*******// *start //最大化ボタンとウィンドウサイズ可変有効のウィンドウを作成 screen 0,ginfo(20),ginfo(21),0,0,0 GetWindowLong hwnd, -16 SetWindowLong hwnd, -16, stat | $10000 | $40000 width 640,480,ginfo(20)/2-320,ginfo(21)/2-300 //タイトル名 title "CircleTraining ver1.0" //変数宣言 score = 10 esa_max = 10000 repeat esa_max esar(cnt)=rnd(256) esag(cnt)=rnd(256) esab(cnt)=rnd(256) esax(cnt)=rnd(50000) esay(cnt)=rnd(50000) loop //メインループ *mainloop //描画開始 redraw 0 //背景 color 255,255,255 : boxf //変数管理 if score \ 250 = 0 : size = size + 1 if score >= 999999999 : score = 999999999 if size >= 100 : size = 100 //自機描画 color 255,0,0 circle ginfo_winx/2-(size+1)+2,(ginfo_winy/2-(size+1))-12,ginfo_winx/2+(size+1)+12,ginfo_winy/2+(size+1)-2,1 color 0,0,0 font "游ゴシック",20,0 moji = ""+score msgx=ginfo_winx/2-(strlen(moji)*5)+5 msgy=ss pos msgx,ginfo_winy/2-20 mes moji if mousex>=ginfo_winx/2 : mx=mx-(1+speed) if mousex<=ginfo_winx/2 : mx=mx+(1+speed) if mousey>=ginfo_winy/2 : my=my-(1+speed) if mousey<=ginfo_winy/2 : my=my+(1+speed) GetClassLong hwnd, -26 SetClassLong hwnd, -26, stat | $8 //玉を描画 repeat esa_max color esar(cnt),esag(cnt),esab(cnt) circle esax(cnt)+mx,esay(cnt)+my,esax(cnt)+mx+5,esay(cnt)+my+5,1 if esax(cnt) >= mx -5 & esay(cnt) <= my - 5 & esax(cnt) >= mx & esay(cnt) <= my : else : score = score + 1 loop //描画終了 redraw 1 //時間待ち await 1 //メインループへ goto *mainloop *ctlcoloredit if hInput.0 = lparam { SetTextColor wparam, RGB($FF, $FF ,$FF) SetBkColor wparam, RGB(124, 92, 220) return hBrush.0 } return *exit DeleteObject hBrush.0 end