How do you make it smoother?
At the moment it is very jumpy 8(
Hide Mouse
Sync On
Sync Rate 60
Load Music "Hidden Fury.mid",1
Loop Music 1
Repeat
repeat
Set Text Size 50
Center Text 320,20, "PONG!"
Set Text Size 10
Center Text 320,300, "Type 1 and press enter for One Player!"
Center Text 320,315, "Type 2 and press enter for Two Player!"
Center Text 320,450, "Press Space to exit"
Set Cursor 320,240
sync
choice$=inkey$()
until choice$="1" or choice$="2" or choice$=" "
cls
If choice$ = "1" then Gosub OnePlayer
If choice$ = "2" then Gosub TwoPlayer
Until choice$ = " "
end
InitialiseForPlay:
radius# = 3.0
score = 0
secondscore = 0
secondpspeed = 10
ballxpos = 320
ballypos = 240
ballyspeed = Rnd(4)
ballxspeed = 12
` Also initialise the second player - doesn't matter if its not needed
secondxpos = 530
secondypos = 240
return
Oneplayer:
gosub InitialiseForPlay
Do
Set Text Size 50
Center Text 320,20, "PONG!"
Set Text Size 10
Line 98,98,542,98
Line 542,98,542,382
Line 542,382,98,382
Line 98,382,98,98
Create bitmap 1,25,25
Line 1,1,1,21
Get Image 1,1,1,2,22
Set Current Bitmap 0
Sprite 1,xpos,ypos,1
ypos = MouseY()
xpos = 110
If ypos < 100 then ypos = 100
If ypos > 360 then ypos = 360
Create Bitmap 2,25,25
Circle 5,5,radius#
Get Image 2,1,1,10,10
Set Current Bitmap 0
Sprite 2,ballxpos,ballypos,2
ballxpos = ballxpos - ballxspeed
ballypos = ballypos + ballyspeed
If ballxpos > 534 then ballxspeed = ballxspeed * -1
If ballxpos < 100
ballxspeed = ballxspeed * -1
Endif
If ballypos < 97 then ballyspeed = ballyspeed * -1
If ballypos > 374 then ballyspeed = ballyspeed * -1
if ballxpos < xpos + 6 and ballxpos > xpos - 20 and ballypos < ypos + 20 and ballypos > ypos - 20
ballxspeed = ballxspeed * -1
score = score + 1
Endif
Rem PRINT SCORE TO SCREEN
Rem PRINT SCORE TO SCREEN
Sync
Cls
Text 0,0,"Score:"+str$(score)
If score >= 50
Cls
Delete Sprite 1
Delete Sprite 2
center text 320,240,"You win with "+str$(score)+" points!"
Wait 2000
Cls
`Gosub MainMenu
return
Endif
If Spacekey()=1 then End
Center Text 320,450, "Press Space to Exit"
Center Text 320,390, "You need 50 points to win!!"
Center Text 320,435, "Press Shift to go back to Main Menu!"
If Shiftkey()=1
Cls
Delete Sprite 1
Delete Sprite 2
`Gosub MainMenu
return
Endif
Sync
Loop
TwoPlayer:
gosub InitialiseForPlay
Do
Set Text Size 50
Center Text 320,20, "PONG!"
Set Text Size 10
Line 98,98,542,98
Line 542,98,542,382
Line 542,382,98,382
Line 98,382,98,98
Create bitmap 1,25,25
Line 1,1,1,21
Get Image 1,1,1,2,22
Set Current Bitmap 0
Sprite 1,xpos,ypos,1
Sprite 3,secondxpos,secondypos,1
if upkey()=1 then dec secondypos,secondpspeed
if downkey()=1 then inc secondypos,secondpspeed
ypos = MouseY()
xpos = 110
If ypos < 100 then ypos = 100
If ypos > 360 then ypos = 360
If secondypos < 100 then secondypos = 100
If secondypos > 360 then secondypos = 360
Create Bitmap 2,25,25
Circle 5,5,radius#
Get Image 2,1,1,10,10
Set Current Bitmap 0
Sprite 2,ballxpos,ballypos,2
ballxpos = ballxpos - ballxspeed
ballypos = ballypos + ballyspeed
If ballxpos > 534
ballxspeed = ballxspeed * -1
secondlives = secondlives - 1
Endif
If ballxpos < 100
ballxspeed = ballxspeed * -1
lives = lives - 1
Endif
If ballypos < 97 then ballyspeed = ballyspeed * -1
If ballypos > 374 then ballyspeed = ballyspeed * -1
If ballxpos < xpos + 6 and ballxpos > xpos - 20 and ballypos < ypos + 20 and ballypos > ypos - 20
ballxspeed = ballxspeed * -1
score = score + 1
Endif
If ballxpos > secondxpos - 12 and ballxpos < secondxpos + 20 and ballypos > secondypos - 20 and ballypos < secondypos + 20
ballxspeed = ballxspeed * -1
secondscore = secondscore + 1
Endif
If Spacekey()=1 then End
Center Text 320,450, "Press Space to Exit"
Center Text 320,390, "You need 50 points to win!!"
Center Text 320,435, "Press Shift to go back to Main Menu!"
Sync
Cls
Text 0,0,"Score:"+str$(score)
If score >= 50
Cls
Delete Sprite 1
Delete Sprite 2
Delete Sprite 3
center text 320,240,"Player 1 wins with "+str$(score)+" points!"
Wait 2000
Cls
`Gosub MainMenu
return
Endif
Sync
Cls
Text 530,0,"Score:"+str$(secondscore)
If secondscore >= 50
Cls
Delete Sprite 1
Delete Sprite 2
Delete Sprite 3
center text 320,240,"Player 2 wins with "+str$(score)+" points!"
Wait 2000
Cls
`Gosub MainMenu
return
Endif
If Shiftkey()=1
Cls
Delete Sprite 1
Delete Sprite 2
Delete Sprite 3
`Gosub MainMenu
return
Endif
Sync
Loop
MnKMaN