Microsoft Small Basic

Program Listing: NXR647
'Thanks For Helps!
'Copyright © 2013-∞ POSB Games, All Rights Reserved.
init()

Sub init
GraphicsWindow.Width=640
GraphicsWindow.Height=480
GraphicsWindow.BackgroundColor="cyan"
GraphicsWindow.BrushColor="green"
asd=Shapes.AddRectangle(2100,25)
GraphicsWindow.BrushColor="red"
ball=Shapes.AddEllipse(25,25)
X=25
Y=430
c=0
v=455
z=0
b=455
u=150
l=406
t=0.1
r=2
vb=207
nm=23
hj=0
Shapes.Move(ball,x,y)
Shapes.Move(asd,c,v)
right="False"
left="False"
boxes="________oo__o___o______________o_o_o______"
Level="_____p________p____p_p_p_p_p__p_p_p_p_____"
lg=Text.GetLength(Level)
For xtile = 1 To 42
If Text.GetSubText(Level,xtile,1) = "p" Then
GraphicsWindow.BrushColor="Cyan"
GraphicsWindow.PenColor="Cyan"
sp[xtile]=Shapes.AddRectangle(50,50)
z[xtile]=(xtile * 50)
Shapes.Move(sp[xtile],z[xtile], b)
EndIf
EndFor
For xtile = 1 To 42
If Text.GetSubText(boxes,xtile,1) = "o" Then
GraphicsWindow.BrushColor="Gold"
GraphicsWindow.PenColor="Black"
bx[xtile]=Shapes.AddRectangle(50,50)
k[xtile]=(xtile * 50) - 25
Shapes.Move(bx[xtile],k[xtile], l)
EndIf
EndFor

EndSub

paddlesheight = 25
diameter = 25+paddlesheight
Y = GraphicsWindow.Height - diameter
dY = 0
powerBurst = 5

GraphicsWindow.KeyDown = OnKeyDown
GraphicsWindow.KeyUp = OnKeyUp

While "True"
If keyPressed = "Space" Then
hj=0
jumping = "True"
keyPressed = ""
EndIf
If keyPressed = "Right" Then
right = "True"
keyPressed = ""
EndIf

If keyPressed = "Left" Then
left = "True"
keyPressed = ""
EndIf

If keyUpped = "Right" Then
right = "False"
keyPressed = ""
EndIf

If keyUpped = "Left" Then
left = "False"
keyPressed = ""
EndIf

If jumping Then
Jump()
EndIf

Y = Y - dY

If right Then
If c<0-1448 then
u=615
EndIf
If X X=X+r
Shapes.Move(ball, X, Y)
EndIf
EndIf
If left Then
If X>25 Then
X=X-r
Shapes.Move(ball, X, Y)
EndIf
EndIf
control()
delay=Math.Max(0, 20 - (Clock.ElapsedMilliseconds - start))
Shapes.Move(ball, X, Y)
Program.Delay(delay) '50 fps Else Delay(0) & any lag
start = Clock.ElapsedMilliseconds
EndWhile

Sub OnKeyDown
keyPressed = GraphicsWindow.LastKey
If X>96 Then
If keyPressed="Right" Or keyPressed="D" Then
If c>0-1450 Then
c=c-r
Shapes.Move(asd,c,v)
For xtile=1 To 42
z[xtile]=z[xtile]-r
Shapes.Move(sp[xtile],z[xtile],b)
k[xtile]=k[xtile]-r
Shapes.Move(bx[xtile],k[xtile],l)
EndFor
EndIf
EndIf
EndIf
If X<10 Then
If keyPressed="Left" Or keyPressed="A" Then
If c<0 Then
c=c+r
Shapes.Move(asd,c,v)
For xtile=1 To 42
z[xtile]=z[xtile]+r
Shapes.Move(sp[xtile],z[xtile],b)
k[xtile]=k[xtile]+r
Shapes.Move(bx[xtile],k[xtile],l)
EndFor
EndIf
EndIf
EndIf
EndSub

Sub OnKeyUp
keyUpped = GraphicsWindow.LastKey
EndSub

Sub Jump
If dY = 0 And Y = GraphicsWindow.Height - diameter Then
dY = powerBurst
EndIf

dY = dY - t

If dY = -powerBurst+hj Then
dY = 0
jumping = "False"
EndIf
EndSub

Sub control
For xtip=1 To 42
If X>z[xtip] And X=430 Then
Y=Y+1
Shapes.Animate(ball,X,Y,0)
EndIf
If X=k[xtip]-24 And Y>405 Then
X=X-4
EndIf
If X=k[xtip]+50 And Y>405 Then
X=X+4
EndIf
If X>k[xtip] And X hj=1.1
EndIf
EndFor
GraphicsWindow.BrushColor="Black"
GraphicsWindow.DrawLine(210,25,420,25)
sm=Shapes.AddEllipse(5,5)
Shapes.Move(sm,vb,nm)
kl=-c/300
If keyPressed="Right" Then
vb=vb+kl
keyPressed=""
EndIf
If Y>479 And Y<481 Then
GraphicsWindow.ShowMessage("You Lose!","Game Menu")
GraphicsWindow.Clear()
init()
EndIf
If c<-1435 Then
GraphicsWindow.ShowMessage("You Win!","Game Menu")
GraphicsWindow.Clear()
init()
EndIf
EndSub