Hm, irgendwas passt bei der neueren Version nocht nicht. Habe alle Fillrect Parameter mit Drawrect ersetzt. Hier der Code:
// Pong
DIM bat_y[2]
DIM bat_x[2]
DIM score[2]
// Voreinstellungen / Setup values
GOSUB Init
// Hauptschleife / Main Loop
main:
GOSUB MoveAll
GOSUB ShowAll
GOTO main
// ------------------------------------------------------------- //
// -=# INIT #=-
// ------------------------------------------------------------- //
SUB Init:
GOSUB ResetBall
// Spielfeld zeichnen, als Hintergrund nutzen
// Draw playfield, use as background bitmap
BLACKSCREEN
DRAWRECT 0, 0, 639, 15, RGB(255, 255, 255)
DRAWRECT 0, 464, 639, 479, RGB(255, 255, 255)
DRAWRECT 312, 0, 327, 479, RGB(255, 255, 255)
USEASBMP
// Schläger 0 setzten / Reset Bat 0
bat_y[0]=240; bat_y[1]=240
// Schläger 1 setzten / Reset Bat 1
bat_x[0]=16; bat_x[1]=600
// Klassischer Zeichensatz / Classic Font
LOADFONT "FontBW.bmp", 0
ENDSUB // INIT
// ------------------------------------------------------------- //
// -=# RESETBALL #=-
// ------------------------------------------------------------- //
SUB ResetBall:
// Diese Variablen sind als LOCAL definiert:
// These variables are defined LOCAL:
// void
ball_x=320
ball_y=240
IF ball_sx<0
ball_sx=1
ELSE
ball_sx=-1
ENDIF
ball_sy=1
ENDSUB // RESETBALL
// ------------------------------------------------------------- //
// -=# SHOWALL #=-
// ------------------------------------------------------------- //
SUB ShowAll:
// Die Schläger anzeigen / Show the bats
FOR num=0 TO 1
DRAWRECT bat_x[num], bat_y[num], bat_x[num]+16, bat_y[num]+64, RGB(255, 255, 255)
PRINT score[num], num*320 + 32, 16
NEXT
// Der Ball / The ball
DRAWRECT ball_x, ball_y, ball_x+16, ball_y+16, RGB(255, 255, 255)
SHOWSCREEN
ENDSUB // SHOWALL
// ------------------------------------------------------------- //
// -=# MOVEALL #=-
// ------------------------------------------------------------- //
SUB MoveAll:
// Paddles
FOR num=0 TO 1
// Tasten / Keys: A, Y
IF KEY(30) THEN bat_y[0]=bat_y[0]-2
IF KEY(44) THEN bat_y[0]=bat_y[0]+2
// Tasten / Keys: /\, \/
IF KEY(200) THEN bat_y[1]=bat_y[1]-2
IF KEY(208) THEN bat_y[1]=bat_y[1]+2
// Schläger am Rand? / Bat at border?
IF bat_y[num]<0 THEN bat_y[num]=0
IF bat_y[num]>416 THEN bat_y[num]=416
NEXT
// Ball
ball_x=ball_x+ball_sx
ball_y=ball_y+ball_sy
// Ball unten am Rand / Ball at lower border
IF ball_y>464
ball_y=464
ball_sy=-ball_sy
ENDIF
// Ball oben am Rand / Ball at upper border
IF ball_y<0
ball_y=0
ball_sy=-ball_sy
ENDIF
// Ball Linker Rand / Ball at left border
IF ball_x<0
score[1]=score[1]+1
GOSUB ResetBall
ENDIF
// Ball rechter Rand / Ball at right border
IF ball_x>624
score[0]=score[0]+1
GOSUB ResetBall
ENDIF
// Pong
FOR num=0 TO 1 // Für jeden Spieler / For each player
// Bewegt sich der Ball auf den Schläger 'num' zu?
// Does ball move toward bat 'num'
IF (ball_sx<0 AND num = 0) OR (ball_sx>0 AND num=1)
BOXCOLL col, bat_x[num], bat_y[num], 16, 64, ball_x, ball_y, 16, 16
IF col=TRUE
// Ballgeschwindigkeit in X umdrehen / Flip ball's X-direction
ball_sx= -ball_sx
// Schneller machen / Speed up
ball_sx = ball_sx * 1.2
ball_sy = ball_sy * 1.05
ENDIF
ENDIF
NEXT
ENDSUB // MOVEALL
// Pong
DIM bat_y[2]
DIM bat_x[2]
DIM score[2]
// Voreinstellungen / Setup values
GOSUB Init
// Hauptschleife / Main Loop
main:
GOSUB MoveAll
GOSUB ShowAll
GOTO main
// ------------------------------------------------------------- //
// -=# INIT #=-
// ------------------------------------------------------------- //
SUB Init:
GOSUB ResetBall
// Spielfeld zeichnen, als Hintergrund nutzen
// Draw playfield, use as background bitmap
BLACKSCREEN
DRAWRECT 0, 0, 639, 15, RGB(255, 255, 255)
DRAWRECT 0, 464, 639, 479, RGB(255, 255, 255)
DRAWRECT 312, 0, 327, 479, RGB(255, 255, 255)
USEASBMP
// Schläger 0 setzten / Reset Bat 0
bat_y[0]=240; bat_y[1]=240
// Schläger 1 setzten / Reset Bat 1
bat_x[0]=16; bat_x[1]=600
// Klassischer Zeichensatz / Classic Font
LOADFONT "FontBW.bmp", 0
ENDSUB // INIT
// ------------------------------------------------------------- //
// -=# RESETBALL #=-
// ------------------------------------------------------------- //
SUB ResetBall:
// Diese Variablen sind als LOCAL definiert:
// These variables are defined LOCAL:
// void
ball_x=320
ball_y=240
IF ball_sx<0
ball_sx=1
ELSE
ball_sx=-1
ENDIF
ball_sy=1
ENDSUB // RESETBALL
// ------------------------------------------------------------- //
// -=# SHOWALL #=-
// ------------------------------------------------------------- //
SUB ShowAll:
// Die Schläger anzeigen / Show the bats
FOR num=0 TO 1
DRAWRECT bat_x[num], bat_y[num], bat_x[num]+16, bat_y[num]+64, RGB(255, 255, 255)
PRINT score[num], num*320 + 32, 16
NEXT
// Der Ball / The ball
DRAWRECT ball_x, ball_y, ball_x+16, ball_y+16, RGB(255, 255, 255)
SHOWSCREEN
ENDSUB // SHOWALL
// ------------------------------------------------------------- //
// -=# MOVEALL #=-
// ------------------------------------------------------------- //
SUB MoveAll:
// Paddles
FOR num=0 TO 1
// Tasten / Keys: A, Y
IF KEY(30) THEN bat_y[0]=bat_y[0]-2
IF KEY(44) THEN bat_y[0]=bat_y[0]+2
// Tasten / Keys: /\, \/
IF KEY(200) THEN bat_y[1]=bat_y[1]-2
IF KEY(208) THEN bat_y[1]=bat_y[1]+2
// Schläger am Rand? / Bat at border?
IF bat_y[num]<0 THEN bat_y[num]=0
IF bat_y[num]>416 THEN bat_y[num]=416
NEXT
// Ball
ball_x=ball_x+ball_sx
ball_y=ball_y+ball_sy
// Ball unten am Rand / Ball at lower border
IF ball_y>464
ball_y=464
ball_sy=-ball_sy
ENDIF
// Ball oben am Rand / Ball at upper border
IF ball_y<0
ball_y=0
ball_sy=-ball_sy
ENDIF
// Ball Linker Rand / Ball at left border
IF ball_x<0
score[1]=score[1]+1
GOSUB ResetBall
ENDIF
// Ball rechter Rand / Ball at right border
IF ball_x>624
score[0]=score[0]+1
GOSUB ResetBall
ENDIF
// Pong
FOR num=0 TO 1 // Für jeden Spieler / For each player
// Bewegt sich der Ball auf den Schläger 'num' zu?
// Does ball move toward bat 'num'
IF (ball_sx<0 AND num = 0) OR (ball_sx>0 AND num=1)
BOXCOLL col, bat_x[num], bat_y[num], 16, 64, ball_x, ball_y, 16, 16
IF col=TRUE
// Ballgeschwindigkeit in X umdrehen / Flip ball's X-direction
ball_sx= -ball_sx
// Schneller machen / Speed up
ball_sx = ball_sx * 1.2
ball_sy = ball_sy * 1.05
ENDIF
ENDIF
NEXT
ENDSUB // MOVEALL