Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Scriptnaam: Optellen.lua
- -- Auteur: Aaron Imming
- -- Datum: Vandaag
- intX = 1
- intY = 1
- operator = "+"
- function veranderOperator()
- if Keys.newPress.A then
- operator = "+"
- elseif Keys.newPress.B then
- operator = "-"
- elseif Keys.newPress.X then
- operator = "*"
- elseif Keys.newPress.Y then
- operator = "/"
- end
- end
- function waardeOphogen()
- if Keys.newPress.Up then
- intX = intX + 1
- elseif Keys.newPress.Down then
- intX = intX - 1
- elseif Keys.newPress.Left then
- intY = intY + 1
- elseif Keys.newPress.Right then
- intY = intY - 1
- end
- end
- function berekenSom()
- if operator == "+" then
- return intX + intY
- elseif operator == "-" then
- return intX - intY
- elseif operator == "*" then
- return intX * intY
- elseif operator == "/" then
- return intX / intY
- end
- end
- function drawScreen()
- startDrawing()
- screen.print(SCREEN_UP, 0, 0, "Press START to stop.")
- screen.print(SCREEN_UP, 0, 10, "Press A, B, X or Y to see what happens.")
- screen.print(SCREEN_DOWN, 10, 100, "x: " .. intX)
- screen.print(SCREEN_DOWN, 10, 110, "y: " .. intY)
- screen.print(SCREEN_DOWN, 10, 120, "operator: " .. operator)
- screen.print(SCREEN_DOWN, 10, 130, "Het antwoord van " .. intX .. " " .. operator .. " " .. intY .. " is: " .. berekenSom())
- stopDrawing()
- end
- while not Keys.newPress.Start do
- Controls.read()
- waardeOphogen()
- drawScreen()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement