Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- OPTION TITLE, "Pong for Sega Genesis"
- Palette rgb(255, 255, 255), 0, 1
- Palette rgb(255, 255, 0), 1, 1
- Palette rgb(0, 255, 255), 2, 1
- Palette rgb(0, 0, 255), 3, 1
- dim x as integer
- dim y as integer
- dim x2 as integer
- dim y2 as integer
- dim ballX as integer
- dim ballY as integer
- dim velocity as integer
- velocity = 1
- dim points1 as integer
- dim points2 as integer
- x = 128
- y = 128
- x2 = 128 + 320 - 8
- y2 = 128
- ballX = 128 + 100
- ballY = 128 + 100
- 'Paddle 1
- s11 = addsprite(1, 1)
- s12 = addsprite(1, 1)
- s13 = addsprite(1, 1)
- s14 = addsprite(1, 1)
- s15 = addsprite(1, 1)
- 'Paddle 2
- s21 = addsprite(1, 1)
- s22 = addsprite(1, 1)
- s23 = addsprite(1, 1)
- s24 = addsprite(1, 1)
- s25 = addsprite(1, 1)
- 'The ball
- ball = addsprite(1, 1)
- propsprite s11, 1, 1
- propsprite s12, 1, 1
- propsprite s13, 1, 1
- propsprite s14, 1, 1
- propsprite s15, 1, 1
- propsprite s21, 1, 2
- propSprite s22, 1, 2
- propSprite s23, 1, 2
- propsprite s24, 1, 2
- propsprite s25, 1, 2
- propsprite ball, 1, 3
- movesprite s11, x, y
- moveSprite s12, x, y + 8
- moveSprite s13, x, y + 16
- moveSprite s14, x, y + 24
- moveSprite s15, x, y + 32
- moveSprite s21, x2, y2
- movesprite s22, x2, y2 + 8
- movesprite s23, x2, y2 + 16
- movesprite s24, x2, y2 + 24
- movesprite s25, x2, y2 + 32
- moveSprite ball, ballX, ballY
- do
- if y < 128 then y = 128
- if y > (128 + 224) - 32 then y = (128 + 224) - (32 + 8)
- if y = 317 then y = 312
- if velocity = 2 and ballY < 128 then
- velocity = 3
- end if
- if velocity = 3 and ballY < 128 then
- velocity = 5
- end if
- if velocity = 5 and ballY > (128 + 224) - 8 then
- velocity = 3
- end if
- if velocity = 4 and ballY > (128 + 224) - 8 then
- velocity = 2
- end if
- if ballX < 128 then
- ballX = 128 + 100
- ballY = 128 + 100
- movesprite ball, ballX, ballY
- velocity = 1
- points2 = points2 + 1
- end if
- if ballX > 128 + 320 then
- ballX = 128 + 100
- ballY = 128 + 100
- movesprite ball, ballX, ballY
- velocity = 1
- points1 = points1 + 1
- end if
- locate 0, 10
- print points1
- locate 0, 25
- print points2
- locate 20, 5
- print x
- locate 21, 5
- print y
- locate 20, 15
- print ballX
- locate 21, 15
- print ballY
- locate 20, 25
- print x2
- locate 21, 25
- print y2
- if joypad(0).0 then y = y - 5
- if joypad(1).0 then y2 = y2 - 5
- if joypad(0).1 then y = y + 5
- if joypad(1).1 then y2 = y2 + 5
- movesprite s11, x, y
- moveSprite s12, x, y + 8
- moveSprite s13, x, y + 16
- moveSprite s14, x, y + 24
- moveSprite s15, x, y + 32
- moveSprite s21, x2, y2
- movesprite s22, x2, y2 + 8
- movesprite s23, x2, y2 + 16
- movesprite s24, x2, y2 + 24
- movesprite s25, x2, y2 + 32
- if velocity = 1 and ballX = x + 8 and ballY > y and ballY < y + 32 then velocity = 0
- if velocity = 0 and ballX = x2 - 8 and ballY > y2 and ballY < y2 + 32 then velocity = 1
- if velocity = 2 and ballX = x + 8 and ballY > y and ballY < y + 32 then velocity = 3
- if velocity = 0 then ballX = ballX + 1
- if velocity = 1 then ballX = ballX - 1
- if velocity = 2 then
- ballX = ballX - 30
- ballY = ballY - 30
- end if
- if velocity = 3 then
- ballX = ballX + 30
- ballY = ballY - 30
- end if
- if velocity = 4 then
- ballX = ballX - 30
- ballY = ballY + 30
- end if
- if velocity = 5 then
- ballX = ballX + 30
- ballY = ballY + 30
- end if
- moveSprite ball, ballX, ballY
- sleep 1
- loop
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement