-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlua_example.lua
More file actions
36 lines (35 loc) · 952 Bytes
/
lua_example.lua
File metadata and controls
36 lines (35 loc) · 952 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
function _ready ()
circle = engine.Circle(100, 100, 10)
rect = engine.Rect(200, 120, 345, 300, "blue")
textbox = engine.Entry(250, 250, 5)
button = engine.Button(500, 400, 550, 450, "red", "Exit")
image = engine.Image(600, 400, "Queen_Crow.png")
oval = engine.Oval(50, 50, 100, 85, "blue")
line = engine.Line(100, 25, 225, 75, "green")
text = engine.Text(250, 125, "test text", "gray")
sound = engine.Sound("sound.wav")
sound.play()
end
function _process ()
key = window.key_pressed()
text = textbox.get_text()
x, y = window.get_click()
if button.is_touched(x, y) then
window.destroy()
end
if key == "w" then
image.move(0, 2.5)
end
if key == "s" then
image.move(0, -2.5)
end
if key == "a" then
image.move(-2.5, 0)
end
if key == "d" then
image.move(2.5, 0)
end
if key == "Return" then
print(text)
end
end