-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPowerXO_main.das
More file actions
65 lines (47 loc) · 1.33 KB
/
Copy pathPowerXO_main.das
File metadata and controls
65 lines (47 loc) · 1.33 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
require daslib/media
options debugger // uncomment for debug in VS Code
require daslib/debug // uncomment for debug in VS Code
require model public
let VT_DELTA = 0.5
var
img <- create_image("back.png")
vT: float = 0.5
def drawHelperText()
set_font_name("mono")
set_font_size(30)
text_out(505, 1160, "Change view 'v' | End game - 'e'", 0xffffff)
// 'initialize' runs once when game starts and every hot-reload
[export]
def initialize
set_resolution(1600, 1200)
set_window_title("PowXO")
init()
return
// this function is called to update game data,
// dt - time elapsed since the previous update (in seconds)
[export]
def act(dt: float)
vT+=dt
if get_key(VK_ESCAPE)
schedule_quit_game()
if get_key(VK_E)
end()
if get_key(VK_V) && (vT > VT_DELTA)
vT = 0.0
changeView()
if (isActive())
update()
mouseMove(get_mouse_position())
if get_mouse_button_up(MB_LEFT)
mouseClick(get_mouse_position())
return
// this function will be called every frame after 'act',
// you can draw anything in this function
[export]
def draw
img |> draw_image(0, 0)
drawHelperText()
drawText()
enable_premultiplied_alpha_blend()
drawGame()
return