2024-10-07 12:23:04 +00:00
|
|
|
ORIGIN = { x = 320, y = 180 }
|
|
|
|
RADIUS = 48
|
|
|
|
offset = { x = 0, y = 0 }
|
|
|
|
angle = 0
|
|
|
|
|
|
|
|
function game_tick()
|
2025-02-15 19:19:14 +00:00
|
|
|
if ctx.udata == nil then
|
|
|
|
ctx.udata = {
|
|
|
|
frame_count = 0,
|
|
|
|
nest = {
|
|
|
|
frame_count = 0,
|
|
|
|
},
|
|
|
|
arr = { [0] = 0 },
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
|
|
|
draw_text {
|
|
|
|
string = tostring(ctx.udata.frame_count),
|
|
|
|
position = { x = 0, y = 0 },
|
|
|
|
font = "/fonts/kenney-pixel.ttf",
|
|
|
|
}
|
|
|
|
|
|
|
|
draw_text {
|
|
|
|
string = tostring(ctx.udata.nest.frame_count),
|
|
|
|
position = { x = 0, y = 14 },
|
|
|
|
font = "/fonts/kenney-pixel.ttf",
|
|
|
|
}
|
|
|
|
|
|
|
|
draw_text {
|
|
|
|
string = tostring(ctx.udata.arr[0]),
|
|
|
|
position = { x = 0, y = 28 },
|
|
|
|
font = "/fonts/kenney-pixel.ttf",
|
|
|
|
}
|
|
|
|
|
2025-01-13 05:57:21 +00:00
|
|
|
input_action {
|
2024-12-23 19:02:17 +00:00
|
|
|
name = "press",
|
|
|
|
control = "A"
|
|
|
|
}
|
|
|
|
|
2025-01-13 05:57:21 +00:00
|
|
|
draw_sprite {
|
2025-01-07 11:14:21 +00:00
|
|
|
texture = "/assets/title.png",
|
2024-10-07 12:23:04 +00:00
|
|
|
rect = {
|
|
|
|
x = 320 - (320 / 2),
|
|
|
|
y = 180 - (128 / 2),
|
|
|
|
w = 320,
|
|
|
|
h = 128,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
2025-01-13 05:57:21 +00:00
|
|
|
if input_action_pressed { name = "press" } then
|
|
|
|
draw_text {
|
2024-12-23 19:02:17 +00:00
|
|
|
string = "it never happened",
|
|
|
|
position = offset,
|
|
|
|
font = "/fonts/kenney-pixel.ttf",
|
|
|
|
}
|
|
|
|
end
|
2024-10-07 12:23:04 +00:00
|
|
|
|
2025-02-15 19:19:14 +00:00
|
|
|
ctx.udata.frame_count = ctx.udata.frame_count + 1
|
|
|
|
ctx.udata.nest.frame_count = ctx.udata.nest.frame_count + 1
|
|
|
|
ctx.udata.arr[0] = ctx.udata.arr[0] + 1
|
|
|
|
|
2024-10-07 12:23:04 +00:00
|
|
|
offset.x = ORIGIN.x + (math.cos(angle) * RADIUS)
|
|
|
|
offset.y = ORIGIN.y + (math.sin(angle) * RADIUS)
|
|
|
|
angle = angle + 0.1
|
|
|
|
end
|