ズブの初心者がゲーム作れるまで勉強するブログ

現在、シューティングゲームの作り方を勉強中

HSP狙い撃ち弾 弾が当たらない

2006-03-29 14:44:23 | Weblog

buffer 2,640,480
screen 0,640,480

bx=320
by=240

tx=rnd(640)
ty=rnd(480)

//rad=atan(tx-bx, ty-by)  //計算箇所1

repeat
 gsel 2,0
 cls 4
 await 1

 color 255, 255, 255
 mes rad

 rad=atan(tx-bx, ty-by)  //計算箇所2
 
 circle tx, ty, tx+16, ty+16, 1

 circle bx, by, bx+16, by+16, 1

 bx=bx+sin(rad)*10
 by=by+cos(rad)*10

 if abs(tx-bx)<16 and abs(ty-by)<16 {
  tx=rnd(640)
  ty=rnd(480)
  rad=atan(tx-bx, ty-by)
 }


 gsel 0,1
 gcopy 2,0,0,640,480 
loop