Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- exercise9_1
- -- L字型が下に落ちる
- -- Functions
- function init()
- term.setTextColor(colors.white)
- term.setBackgroundColor(colors.black)
- term.clear()
- end
- function drawPoint(x,y,color)
- term.setBackgroundColor(color)
- term.setCursorPos(x,y)
- term.write(" ")
- end
- function drawLShape(x,y,color)
- drawPoint(x,y,color)
- drawPoint(x,y+1,color)
- drawPoint(x,y+2,color)
- drawPoint(x+1,y+2,color)
- drawPoint(x+2,y+2,color)
- end
- -- Main
- for y=1,20 do
- init() -- 画面を初期化する
- drawLShape(2,y,colors.red) -- 指定した座標に指定した色で点を描く
- os.sleep(0.5) -- 0.5秒待つ
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement