soundmini[1].loop=true
screen:clear()
screen:print(194, 136, "Starting Game", green)
screen.flip()
stillleft = Image.load("still.png")
trigleft = Image.load("worm1.png")
trigdown = Image.load("worm2.png")
trigright = Image.load("worm3.png")

trigup = Image.load("elbows.png")
trigsquare = Image.load("lstep.png")
trigx = Image.load("down.png")
trigcircle = Image.load("rstep.png")
trigtriangle = Image.load("jumpgrab.png")
screen:clear()

voice:stop()

local sound = bgmusic
voice = sound:play()

Music.volume(128)

nopress = "true"
crossw = "false"
circlew = "false"
trianglew = "false"
squarew = "false"
upw = "false"
rightw = "false"
downw = "false"
leftw = "false"
lw = "false"
rw = "false"
spleft = "false"
spdown = "false"
spright = "false"
spup = "false"
spsquare = "false"
spx = "false"
spcircle = "false"
sptriangle = "false"
screen:clear()

while true do
if tostring(Controls.read())   == "Controls (0)"  then
nopress = "true"
end
screen:blit(0, 0, background, false)
if nopress == "true" then
screen:blit(191,40,still) 
end


pad = Controls.read() 

screen:print(95, 251, "Press 'Start' to return to main menu", black)
screen:print(112, 261, "Press 'Select' for a screenshot", black)
screen:print(345, 15, "Created By:", black)
screen:print(365, 25, "Greenskull", green)
screen:print(335, 35, "dan_tm@hotmail.com", black)


if crossw == "true" then
screen:blit(191, 40, x)
end

if pad:cross() then
nopress = "false"
crossw = "true"
else crossw = "false"
end






if circlew == "true" then
screen:blit(191, 40, circle)
end

if pad:circle() then
nopress = "false"
circlew = "true"
else circlew = "false"
end






if trianglew == "true" then
screen:blit(191, 40, triangle)
end

if pad:triangle() then
nopress = "false"
trianglew = "true"
else 
trianglew = "false"
end





if squarew == "true" then
screen:blit(191, 40, square)
end

if pad:square() then
nopress = "false"
squarew = "true"
else
squarew = "false"
end





if upw == "true" then
screen:blit(191, 40, up)
end

if pad:up() then
nopress = "false"
upw = "true"
else
upw = "false"
end





if rightw == "true" then
screen:blit(191, 40, right)
end

if pad:right() then
nopress = "false"
rightw = "true"
else
rightw = "false"
end





if downw == "true" then
screen:blit(191, 40, down)
end

if pad:down() then
nopress = "false"
downw = "true"
else
downw = "false"
end





if leftw == "true" then
screen:blit(191, 40, left)
end

if pad:left() then
nopress = "false"
leftw = "true"
else
leftw = "false"
end





if lw == "true" then
screen:blit(191, 40, l)
end

if pad:l() then
nopress = "false"
lw = "true"
else 
lw = "false"
end





if rw == "true" then
screen:blit(191, 40, r)
end

if pad:r() then
nopress = "false"
rw = "true"
else 
rw = "false"
end





--variations
if pad:l() and pad:r() then
nopress = "false"
lw = "false"
rw = "true"
end




if pad:left() and pad:right() then
nopress = "false"
leftw = "false"
rightw = "true"
end



if pad:left() and pad:down() then
nopress = "false"
leftw = "false"
downw = "true"
end




if pad:left() and pad:up() then
nopress = "false"
leftw = "false"
upw = "true"
end




if pad:left() and pad:square() then
nopress = "false"
leftw = "false"
squarew = "true"
end




if pad:left() and pad:circle() then
nopress = "false"
leftw = "false"
circlew = "true"
end




if pad:left() and pad:cross() then
nopress = "false"
leftw = "false"
crossw = "true"
end




if pad:left() and pad:triangle() then
nopress = "false"
leftw = "false"
trianglew = "true"
end





if pad:up() and pad:down() then
nopress = "false"
upw = "false"
downw = "true"
end




if pad:up() and pad:right() then
nopress = "false"
upw = "false"
rightw = "true"
end




if pad:up() and pad:square() then
nopress = "false"
upw = "false"
squarew = "true"
end




if pad:up() and pad:circle() then
nopress = "false"
upw = "false"
circlew = "true"
end




if pad:up() and pad:cross() then
nopress = "false"
upw = "false"
crossw = "true"
end




if pad:up() and pad:triangle() then
nopress = "false"
upw = "false"
trianglew = "true"
end




if pad:down() and pad:right() then
nopress = "false"
downw = "false"
rightw = "true"
end




if pad:down() and pad:square() then
nopress = "false"
downw = "false"
squarew = "true"
end




if pad:down() and pad:circle() then
nopress = "false"
downw = "false"
circlew = "true"
end




if pad:down() and pad:cross() then
nopress = "false"
downw = "false"
crossw = "true"
end




if pad:down() and pad:triangle() then
nopress = "false"
downw = "false"
trianglew = "true"
end




if pad:right() and pad:square() then
nopress = "false"
rightw = "false"
squarew = "true"
end




if pad:right() and pad:circle() then
nopress = "false"
rightw = "false"
circlew = "true"
end




if pad:right() and pad:cross() then
nopress = "false"
rightw = "false"
crossw = "true"
end




if pad:right() and pad:triangle() then
nopress = "false"
rightw = "false"
trianglew = "true"
end




if pad:square() and pad:cross() then
nopress = "false"
squarew = "false"
crossw = "true"
end




if pad:square() and pad:triangle() then
nopress = "false"
squarew = "false"
trianglew = "true"
end




if pad:triangle() and pad:circle() then
nopress = "false"
trianglew = "false"
circlew = "true"
end




if pad:cross() and pad:circle() then
nopress = "false"
crossw = "false"
circlew = "true"
end




if pad:square() and pad:circle() then
nopress = "false"
squarew = "false"
circlew = "true"
end



if pad:triangle() and pad:cross() then
nopress = "false"
trianglew = "false"
crossw = "true"
end

--Specials
if spleft == "true" then
screen:blit(150,120,trigleft)
end

if pad:l() and pad:left()
then
spleft = "true"
lw = "false"
rw = "false"
leftw = "false"
elseif
pad:r() and pad:left()
then
spleft = "true"
rw = "false"
lw = "false"
leftw = "false"
else
spleft = "false"
end








if spdown == "true" then
screen:blit(150,120,trigdown)
end

if pad:l() and pad:down()
then
spdown = "true"
spleft = "false"
spup = "false"
lw = "false"
rw = "false"
downw = "false"
elseif
pad:r() and pad:down()
then
spdown = "true"
spleft = "false"
spup = "false"
rw = "false"
lw = "false"
downw = "false"
else
spdown = "false"
end








if spright == "true" then
screen:blit(150,120,trigright)
end

if pad:l() and pad:right()
then
spright = "true"
spleft = "false"
spdown = "false"
spup = "false"
lw = "false"
rw = "false"
rightw = "false"
elseif
pad:r() and pad:right()
then
spright = "true"
spleft = "false"
spdown = "false"
spup = "false"
rw = "false"
lw = "false"
rightw = "false"
else
spright = "false"
end






if spup == "true" then
screen:blit(191,40,trigup)
end

if pad:l() and pad:up()
then
spup = "true"
spleft = "false"
lw = "false"
rw = "false"
upw = "false"
elseif
pad:r() and pad:up()
then
spup = "true"
spleft = "false"
rw = "false"
lw = "false"
upw = "false"
else
spup = "false"
end








if spsquare == "true" then
screen:blit(191,40,trigsquare)
end

if pad:l() and pad:square()
then
spsquare = "true"
spleft = "false"
spdown = "false"
spright = "false"
spup = "false"
lw = "false"
rw = "false"
squarew = "false"
elseif
pad:r() and pad:square()
then
spsquare = "true"
spleft = "false"
spdown = "false"
spright = "false"
spup = "false"
rw = "false"
lw = "false"
squarew = "false"
else
spsquare = "false"
end







if spx == "true" then
screen:blit(191,40,trigx)
end

if pad:l() and pad:cross()
then
spx = "true"
spleft = "false"
spdown = "false"
spright = "false"
spup = "false"
spsquare = "false"
sptriangle = "false"
lw = "false"
rw = "false"
crossw = "false"
elseif
pad:r() and pad:cross()
then
spx = "true"
spleft = "false"
spdown = "false"
spright = "false"
spup = "false"
spsquare = "false"
sptriangle = "false"
rw = "false"
lw = "false"
crossw = "false"
else
spx = "false"
end







if spcircle == "true" then
screen:blit(191,40,trigcircle)
end

if pad:l() and pad:circle()
then
spcircle = "true"
spleft = "false"
spdown = "false"
spright = "false"
spup = "false"
spsquare = "false"
spx = "false"
sptriangle = "false"
lw = "false"
rw = "false"
circlew = "false"
elseif
pad:r() and pad:circle()
then
spcircle = "true"
spcircle = "true"
spleft = "false"
spdown = "false"
spright = "false"
spup = "false"
spsquare = "false"
spx = "false"
sptriangle = "false"
rw = "false"
lw = "false"
circlew = "false"
else
spcircle = "false"
end







if sptriangle == "true" then
screen:blit(191,40,trigtriangle)
end

if pad:l() and pad:triangle()
then
sptriangle = "true"
spleft = "false"
spdown = "false"
spright = "false"
spup = "false"
spsquare = "false"
trianglew = "false"
lw = "false"
rw = "false"
elseif
pad:r() and pad:triangle()
then
sptriangle = "true"
spleft = "false"
spdown = "false"
spright = "false"
spup = "false"
spsquare = "false"
trianglew = "false"
rw = "false"
lw = "false"
else
sptriangle = "false"
end



if pad:select() then
dofile ("screenshot.lua")
end

if exit == 1 then
break
end

if pad:start() then
voice:stop()
screen.waitVblankStart(30)
dofile ("mainmenu.lua")
end

screen.flip()

end