
pink = Color.new(255, 0 , 153)
blue = Color.new(0 , 153, 255)
orange = Color.new(255, 102, 0)
gray = Color.new(153, 153, 153)
black = Color.new(0 , 0 , 0) 
i="d"
j="e"
q=0
while q<1 do
splash = Image.load("splash.png")
screen:blit(0, 0, splash, false)
screen.flip() 
screen.waitVblankStart(240)
q=2
end

while true do

    if i == "d" then
      i = "e"
    elseif i == "e" then
      i = "d"
    end
    if j == "d" then
      j = "e"
    elseif j == "e" then
      j = "d"
    end
pad = Controls.read()

file = io.open("testRead.txt","w")
file:write(i)
pad = Controls.read()
if pad:circle() then
file:write("10")
else
file:write("0")
end 

file:write(",")
pad = Controls.read()
if pad:cross() then
file:write("1")
--screen:blit(240, 136, cursor, false)
else
file:write("0")
--screen:blit(0, 0, splash, false)
end 
pad = Controls.read()

file:write(",")
if pad:up() then
file:write("up")

elseif pad:down() then
file:write("down")

elseif pad:left() then
file:write("left")

elseif pad:right() then
file:write("right")
else
file:write("none")
end 
file:close()


cursor = Image.load("c.png") 
if j == "d" then
background = Image.load("backgroundd.jpg") 
end
if j == "e" then
background = Image.load("backgrounde.jpg") 
end
screen:blit(0, 0, background, false)
screen:blit(240, 136, cursor, false)

screen.flip() 
screen.waitVblankStart(10)
end 