プレイ日記
Michael miccla00549
paddle moves(stops at wall so that it doesn't do syntax error)
1そうだね
プレイ済み
返信[1]
親投稿
Michael miccla00549
I need help for the ball part/collision
0そうだね
プレイ済み
返信[2]
親投稿
raimondz raimondxz
Store the position and the velocity of the ball. Then you must add this in your game loop: LOCATE X,Y ? " " IF collission(X,Y+DY) THEN DY=-DY IF collission(X+DX,Y) THEN DX=-DX INC X,DX INC Y,DY LOCATE X,Y ? "#"
0そうだね
プレイ済み
返信[3]
親投稿
raimondz raimondxz
And define this function below your loop. DEF collission(X,Y) IF X>50 THEN RETURN 1 IF X<0 THEN RETURN 1 IF Y>28 THEN RETURN 1 IF Y<0 THEN RETURN 1 RETURN 0 END
0そうだね
プレイ済み
返信[4]
親投稿
raimondz raimondxz
By the way DX and DY are the speed of the ball. If you want to detect a collision with the paddle, then you must compare the argument with the paddle's coordinates and the space it use. You should add that on collission(X,Y)
0そうだね
プレイ済み