Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Scriptnaam: Optellen_H6.lua
- -- Auteur: Mark Broeren
- -- Datum: 07-02-2011
- intX = 0
- intY = 0
- operator = "+"
- function doEvent()
- if Keys.newPress.A then
- switchOperator(operator)
- intX = intX+1
- elseif Keys.newPress.B then
- intX = intX-1
- elseif Keys.newPress.X then
- intY = intY+1
- elseif Keys.newPress.Y then
- intY = intY-1
- elseif Keys.newPress.L then
- switchOperator(operator)
- elseif Keys.newPress.R then
- switchOperator(operator)
- end
- end
- function switchOperator(currentOperator)
- if currentOperator == "+" then
- operator = "-"
- elseif currentOperator == "-" then
- operator = "*"
- elseif currentOperator == "*" then
- operator = "/"
- end
- end
- function berekenSom(parX, parY)
- intAntwoord = parX + parY
- return intAntwoord
- end
- function drawScreen()
- startDrawing()
- screen.print(SCREEN_UP,0,0,"Press START to stop")
- screen.print(SCREEN_UP,0,10,"Press A, B, X, Y and 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 je optelling is: "..berekenSom(intX,intY))
- stopDrawing()
- end
- while not Keys.newPress.Start do
- Controls.read()
- doEvent()
- drawScreen()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement