Can anyone look at this and see whats wrong, trying to get the print out to the screen not the compiler.
when I change the print to text, I dont see anything. Why ?
--Press "h" for hit, "s" for stay,
--and "a" to play again.
--It's in portrait mode
supportedOrientations(PORTRAIT_ANY)
function setup()
showKeyboard()
output.clear()
player,dealer={},{}
for z=1,2 do
table.insert(player,math.random(11))
table.insert(dealer,math.random(11))
end
showPlayer(1)
end
function draw()
background(0)
fill(255)
if ans=="s" then
output.clear()
showDealer()
showPlayer(2)
showWinner()
elseif ans=="h" then
output.clear()
table.insert(player,math.random(11))
showPlayer(1)
elseif ans=="a" then
setup()
end
ans=""
end
function showDealer()
fill(233, 233, 233, 255) --added
fontSize(70) --added
font("Georgia-BoldItalic")--added
dealerSum=0
for a=1,#dealer do
dealerSum=dealerSum+dealer[a]
end
while dealerSum<17 do
dealerSum=0
table.insert(dealer,math.random(11))
for a=1,#dealer do
dealerSum=dealerSum+dealer[a]
end
end
text("The dealer has a total of "..dealerSum) --changed print to text
text("from these cards "..table.concat(dealer," "))--changed print to text
end
function showPlayer(a)
fill(233, 233, 233, 255) --added
fontSize(70) --added
font("Georgia-BoldItalic")--added
playerSum=0
for a=1,#player do
playerSum=playerSum+player[a]
end
text("You have a total of "..playerSum) --changed print to text
text("from these cards "..table.concat(player," "))--changed print to text
if playerSum>21 then
showWinner()
elseif a==1 then
print("\
\
Do you want to stay(s) or hit(h)")
end
end
function showWinner()
fill(233, 233, 233, 255) --added
fontSize(70) --added
font("Georgia-BoldItalic")--added
if playerSum>21 then
text("Dealer wins!") --changed print to text
elseif dealerSum>21 then
text("You win!") --changed print to text
elseif playerSum>dealerSum then
text("You win!") --changed print to text
else
text("Dealer wins!") --changed print to text
end
text("Play again?(a)") --changed print to text
end
function keyboard(k)
ans=k
end