[ code ] code in here [ /code ] but with out the spaces inside the square brackets
like this:
set display mode 800,600,32
randomize timer()
sync on
hide mouse
type bat
x as integer
y as integer
speedy as integer
score as integer
endtype
player1 as bat
player2 as bat
player1.score=0
player1.speedy=2
player2.score=0
player2.speedy=1
type ball
x as integer
y as integer
speedx as integer
speedy as integer
endtype
ball1 as ball
begining:
Initialize_game()
do
sync
cls
Test_keyboard()
Test_AI()
Move_ball()
Draw_HUD()
Draw_bats()
Draw_ball()
loop
function Initialize_game()
player1.x=50
player1.y=300
player2.x=750
player2.y=300
ball1.x=400
ball1.y=300
ball1.speedx=1
ball1.speedy=1
endfunction
function Test_keyboard()
if upkey()=1 then player1.y=player1.y-player1.speedy
if downkey()=1 then player1.y=player1.y+player1.speedy
if player1.y<50 then player1.y=50
if player1.y>550 then player1.y=550
endfunction
function Test_AI()
p=rnd(3)
if ball1.y<player2.y and p<>1 then player2.y=player2.y-player2.speedy
if ball1.y>player2.y and p<>1 then player2.y=player2.y+player2.speedy
endfunction
function Move_ball()
ball1.x=ball1.x+ball1.speedx
ball1.y=ball1.y+ball1.speedy
if ball1.y<10 or ball1.y>590 then ball1.speedy=-ball1.speedy
if ball1.x<player1.x+25 and ball1.y<player1.y+50 and ball1.y>player1.y-50 then ball1.speedx=-ball1.speedx
if ball1.x>player2.x-25 and ball1.y<player2.y+50 and ball1.y>player2.y-50 then ball1.speedx=-ball1.speedx
if ball1.x<0
player2.score=player2.score+1
goto begining
endif
if ball1.x>800
player1.score=player1.score+1
goto begining
endif
endfunction
function Draw_HUD()
center text 100,50,"Player 1: "+ player1.score
center text 700,50,"Player 2: "+ player2.score
endfunction
function Draw_bats()
box player1.x-15,player1.y-50,player1.x+15,player1.y+50
box player2.x-15,player2.y-50,player2.x+15,player2.y+50
endfunction
function Draw_ball()
circle ball1.x,ball1.y,10
endfunction