Posted 25 March 2012 - 04:14 PM
Hello everybody I've made a little drawing programm, sorry it's German, but i didn't want to translate it…
I will be pleased if somebody can make it better.
move with w a s d
beginning: press any key, now choose your drawing symbol,press Enter. Now press pfor draw and m for move ( you can change it later anytime)
press u to choose a other symbol, then press Enter.
(if this is bad English I'm sorry but I'm only 12 years old…)
so heres the code:
I will be pleased if somebody can make it better.
move with w a s d
beginning: press any key, now choose your drawing symbol,press Enter. Now press pfor draw and m for move ( you can change it later anytime)
press u to choose a other symbol, then press Enter.
(if this is bad English I'm sorry but I'm only 12 years old…)
so heres the code:
term.clear()
q = 1
height = 1
lenght = 1
term.setCursorPos(12, 13)
print ("Hallo: Als erstes bitte gleich dein Mal-zeichen eingeben, dannach drücke")
print ("den Modus: p für malen oder m für laufen|kann jederzeit geändert")
print ("werden| e für beenden, u für zeichen wechsel Press any key...")
while true do
event, fer, fer1 = os.pullEvent()
if event == "char" then
break
end
end
while true do
y = read()
while q == 1 do
event, par, par1 = os.pullEvent()
if event == "char" and par == "p" then
x = 1
break
elseif event == "char" and par == "m" then
x = 2
break
end
end
term.clear()
while true do
event, mo, mo1 = os.pullEvent()
if event == "char" and mo == "d" then
lenght = lenght+1
elseif event == "char" and mo == "a" then
lenght = lenght-1
elseif event == "char" and mo == "w" then
height = height-1
elseif event == "char" and mo == "s" then
height = height+1
elseif event == "char" and mo == "e" then
z = 1
break
elseif event == "char" and mo == "m" then
x = 3
elseif event == "char" and mo == "p" then
x = 1
elseif event == "char" and mo == "u" then
y = read(" ")
elseif event == "char" and mo == "c" then
x = 2
end
term.setCursorPos(lenght, height)
if x == 1 then
print (y)
end
end
if z == 1 then
break
end
end
term.clear()
term.setCursorPos(1, 1)