Sub KeyDown
key = GraphicsWindow.LastKey
If key = "Space" Or key = "Up" Or key = "W" Then
continue = "True"
space = 1
EndIf
If key = "Right" Or key = "D" Then
right = 1
EndIf
If key = "Left" Or key = "A" Then
left2 = 1
EndIf
If key = "Down" Or key = "S" Then
shrink()
EndIf
If key = "F1" And explosivescount > 0 Then
useexplosives()
EndIf
If key = "Escape" Then
space = 0
isindown = "False"
isinmidjump = "False"
Shapes.Move(character, left, GraphicsWindow.Height - 110)
charposY = GraphicsWindow.Height - 110
EndIf
EndSub
Sub KeyUp
key2 = GraphicsWindow.LastKey
If key2 = "Left" Or key2 = "A" Then
left2 = 0
EndIf
If key2 = "Right" Or key2 = "D" Then
right = 0
EndIf
If key2 = "Down" Or key2 = "S" Then
unshrink()
EndIf
space = 0
EndSub
blockpos = GraphicsWindow.Width + 75
blockpos2 = GraphicsWindow.Width + 75
charposY = Shapes.GetTop(character)
isindown = "False"
While "True"
If paused = "False" Then
If space = 1 then
isinmidjump = "True"
space = 0
EndIf
If left2 = 1 Then
moveleft()
EndIf
If right = 1 Then
moveright()
EndIf
If isindown Then
movecharacterdown()
EndIf
If isinmidjump Then
begincounting = "True"
movecharacter()
EndIf
moverectangle()
blockpos = blockpos - speedrate
blockpos2 = blockpos2 - speedrate
If blockpos < -75 Then
blocktype = blocktype + 1
If blocktype = 4 Then
blocktype = 1
EndIf
blockpos = GraphicsWindow.Width + 75
Shapes.Remove(block)
getnewblock()
Shapes.Move(block, blockpos, blockypos)
passed = passed + 1
money = money + moneyamount
Shapes.SetText(blocks_passed, "Blocks Passed: " + passed)
Shapes.SetText(money_txt, "Money: $" + money)
EndIf
getifhitblock()
Program.Delay(5)
EndIf
EndWhile
Sub moverectangle
Shapes.Move(block, blockpos, blockypos)
EndSub
Sub movecharacter
If continue Then
space = 0
getisatend()
count = count + 1
If isatend = "False" Then
charposY = charposY - 3
Else
charposY = charposY - 3
EndIf
If isshrunk Then
charposY2 = charposY + 20
Else
charposY2 = charposY
EndIf
Shapes.Move(character, left, charposY2)
If charposY < 2 Then
count = 0
isinmidjump = "False"
isindown = "True"
EndIf
If count > 249 Then
count = 0
continue = "False"
count = 0
space = 0
KeyUp()
isatend = "False"
isinmidjump = "False"
isindown = "True"
'unstick()
EndIf
'Else
' isindown = "True"
' movecharacterdown()
EndIf
EndSub
Sub movecharacterdown
isinmidjump = "False"
space = 0
getisatend()
count = count + 1
If isatend = "False" Then
charposY = charposY + 3
Else
charposY = charposY + 2.5
EndIf
If isshrunk Then
charposY2 = charposY + 20
Else
charposY2 = charposY
EndIf
Shapes.Move(character, left, charposY2)
If charposY > GraphicsWindow.Height - 112 Then
isindown = "False"
EndIf
If count > 179 Then
count = 0
space = 0
KeyUp()
Shapes.Move(character, left, GraphicsWindow.Height - 110)
isatend = "False"
isindown = "False"
isinmidjump = "False"
begincounting = "False"
charposY2 = GraphicsWindow.Height - 110
charposY = GraphicsWindow.Height - 110
EndIf
EndSub
Sub getisatend
If Shapes.GetTop(character) < GraphicsWindow.Height - 210 Then
isatend = "True"
Else
isatend = "False"
EndIf
EndSub
Sub moveright
If left < GraphicsWindow.Width - 50 Then
left = left + 5
EndIf
If isshrunk Then
charposY2 = charposY + 20
Else
charposY2 = charposY
EndIf
Shapes.Move(character, left, charposY2)
EndSub
Sub moveleft
If left > 0 Then
left = left - 5
EndIf
If isshrunk Then
charposY2 = charposY + 20
Else
charposY2 = charposY
EndIf
Shapes.Move(character, left, charposY2)
EndSub
Sub shrink
isshrunk = "True"
Shapes.Remove(character)
GraphicsWindow.BrushColor = "Red"
character = Shapes.AddEllipse(50, 30)
Shapes.Move(character, left, charposY + 20)
shrinkshadows()
EndSub
Sub unshrink
isshrunk = "False"
GraphicsWindow.BrushColor = "Red"
Shapes.Remove(character)
character = Shapes.AddEllipse(50, 50)
Shapes.Move(character, left, charposY)
unshrinkshadows()
EndSub
Sub getifhitblock
getleft = Shapes.GetLeft(character)
getright = getleft + 50
gettop = Shapes.GetTop(character)
getbottom = gettop + 50
l = Shapes.GetLeft(block)
r = l + randomW
t = Shapes.GetTop(block)
b = t + randomY
If (getright > l) And (getleft < r) And (getbottom > t) And (gettop < b) And isusedexplosives = "False" Then
health = health - 10
If health = 0 Then
health = 100
GraphicsWindow.BrushColor = "Black"
GraphicsWindow.FontSize = 50
GraphicsWindow.DrawText(100, 100, "YOU LOST!")
Program.Delay(1000)
restart()
EndIf
EndIf
EndSub
Sub ButtonClicked
buton = Controls.LastClickedButton
If buton = shop_btn Then
openshop()
ElseIf buton = exit_btn Then
closeshop()
ElseIf buton = buy_explosives Then
buyexplosives()
EndIf
EndSub
Sub additems
buy_explosives = Controls.AddButton("Explosives: Removes the block in front of you. Stay away from the block or you'll be hurt. Good for 3 uses on any block. (key:F1). Cost: $5", 0, 100)
EndSub
Sub buyexplosives
If money > 4.5 Then
explosivescount = explosivescount + 3
money = money - 5
Shapes.SetText(money_txt, "Money: $" + money)
Shapes.SetText(explosives_txt, "Explosives: " + explosivescount)
EndIf
EndSub
Sub addshadows
For i = 1 To 5
a_shadow[i] = Shapes.AddEllipse(50, 50)
Shapes.Move(a_shadow[i], Shapes.GetLeft(character), Shapes.GetTop(character))
EndFor
i = 0
EndSub
Sub moveshadows
i = i + 1
If i = 6 Then
i = 1
EndIf
Shapes.Move(a_shadow[i], Shapes.GetLeft(character), Shapes.GetTop(character))
EndSub
Sub Tick
moveshadows()
EndSub
Sub unstick
'For i = Shapes.GetTop(character) To GraphicsWindow.Height - 110
' Shapes.Move(character, left, i)
' charposY = 0
' charposY2 = 0
' Program.Delay(2)
' moveshadows()
'EndFor
EndSub
Sub shrinkshadows
' For i = 1 To 5
' Shapes.Remove(a_shadow[i])
' EndFor
' GraphicsWindow.BrushColor = "Red"
' For i = 1 To 5
' a_shadow[i] = Shapes.AddEllipse(50, 30)
' Shapes.Move(a_shadow[i], Shapes.GetLeft(character), Shapes.GetTop(character))
' EndFor
EndSub
Sub unshrinkshadows
' For i = 1 To 5
' Shapes.Remove(a_shadow[i])
' EndFor
' GraphicsWindow.BrushColor = "Red"
' For i = 1 To 5
' a_shadow[i] = Shapes.AddEllipse(50, 50)
' Shapes.Move(a_shadow[i], Shapes.GetLeft(character), Shapes.GetTop(character))
' EndFor
EndSub
Sub loadgame
' The following line could be harmful and has been automatically commented.
' 'arrays = File.ReadContents(Program.Directory + "\game!.txt")
'health = arrays[1]
'money = arrays[2]
'Shapes.Move(character, arrays[3], arrays[4])
EndSub