Compare commits
2 Commits
04eb825646
...
feature/14
| Author | SHA1 | Date | |
|---|---|---|---|
| 2297f1b6e0 | |||
| 5ae1eec48a |
27
.devcontainer/Dockerfile
Normal file
27
.devcontainer/Dockerfile
Normal file
@@ -0,0 +1,27 @@
|
||||
FROM alpine:3.23
|
||||
|
||||
RUN apk update && apk add --no-cache \
|
||||
xeyes \
|
||||
jack \
|
||||
git \
|
||||
luarocks \
|
||||
mc \
|
||||
make \
|
||||
cmake \
|
||||
ruby \
|
||||
bash \
|
||||
curl \
|
||||
ca-certificates \
|
||||
g++ \
|
||||
pulseaudio \
|
||||
mesa-dev \
|
||||
mesa-gles \
|
||||
glu-dev
|
||||
|
||||
RUN git clone --recursive --depth=1 https://github.com/nesbox/TIC-80.git /root/TIC-80 \
|
||||
&& cd /root/TIC-80/build \
|
||||
&& cmake -DBUILD_PRO=1 .. \
|
||||
&& make -j$(nproc) \
|
||||
&& make install
|
||||
|
||||
CMD ["/bin/sh"]
|
||||
33
.devcontainer/devcontainer.json
Normal file
33
.devcontainer/devcontainer.json
Normal file
@@ -0,0 +1,33 @@
|
||||
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
|
||||
// README at: https://github.com/devcontainers/templates/tree/main/src/alpine
|
||||
{
|
||||
"name": "Alpine Edge",
|
||||
"build": {
|
||||
"dockerfile": "Dockerfile"
|
||||
},
|
||||
"mounts": [
|
||||
{
|
||||
"source": "/tmp/.X11-unix",
|
||||
"target": "/tmp/.X11-unix",
|
||||
"type": "bind"
|
||||
}
|
||||
],
|
||||
"containerEnv": {
|
||||
"DISPLAY": "${localEnv:DISPLAY}",
|
||||
"PULSE_SERVER": "tcp:host.docker.internal:4713"
|
||||
},
|
||||
"postCreateCommand": "if [ -n \"$WSL_DISTRO_NAME\" ]; then echo 'export DISPLAY=host.docker.internal:0.0' >> ~/.bashrc; fi"
|
||||
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
|
||||
|
||||
// Features to add to the dev container. More info: https://containers.dev/features.
|
||||
// "features": {},
|
||||
|
||||
// Use 'forwardPorts' to make a list of ports inside the container available locally.
|
||||
// "forwardPorts": [],
|
||||
|
||||
// Configure tool-specific properties.
|
||||
// "customizations": {},
|
||||
|
||||
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
|
||||
// "remoteUser": "root"
|
||||
}
|
||||
@@ -28,6 +28,7 @@ function Context.initial_data()
|
||||
return {
|
||||
current_menu_item = 1,
|
||||
test_mode = false,
|
||||
mouse_trace = false,
|
||||
popup = {
|
||||
show = false,
|
||||
content = {}
|
||||
@@ -46,6 +47,8 @@ function Context.initial_data()
|
||||
have_done_work_today = false,
|
||||
should_ascend = false,
|
||||
have_met_sumphore = false,
|
||||
office_sprites = {},
|
||||
walking_to_office_sprites = {},
|
||||
game = {
|
||||
current_screen = "home",
|
||||
},
|
||||
|
||||
@@ -8,21 +8,43 @@ Screen.register({
|
||||
},
|
||||
init = function()
|
||||
Audio.music_play_room_work()
|
||||
Context.have_been_to_office = true
|
||||
|
||||
local possible_sprites = {
|
||||
"dev_project_manager",
|
||||
"dev_hr_girl",
|
||||
"dev_introvert",
|
||||
"dev_extrovert",
|
||||
"dev_guru",
|
||||
"dev_operator",
|
||||
{id="dev_buddy", y_correct=1 * 8},
|
||||
{id="dev_boy", y_correct=1 * 8},
|
||||
{id="dev_girl", y_correct=1 * 8}
|
||||
}
|
||||
|
||||
local possible_positions = {
|
||||
{x = 6 * 8, y = 4 * 8},
|
||||
{x = 10 * 8, y = 11 * 8 + 4},
|
||||
{x = 12 * 8, y = 4 * 8},
|
||||
{x = 15 * 8, y = 9 * 8},
|
||||
{x = 16 * 8, y = 4 * 8},
|
||||
{x = 17 * 8, y = 8 * 8},
|
||||
{x = 17 * 8, y = 11 * 8},
|
||||
{x = 20 * 8, y = 4 * 8},
|
||||
{x = 23 * 8, y = 5 * 8},
|
||||
{x = 22 * 8, y = 10 * 8 + 4},
|
||||
{x = 27 * 8, y = 10 * 8 + 4},
|
||||
{x = -4 + 5 * 8, y = 9 * 8}
|
||||
}
|
||||
|
||||
Context.office_sprites = Sprite.list_randomize(possible_sprites, possible_positions)
|
||||
end,
|
||||
background = "office",
|
||||
draw = function()
|
||||
if Window.get_current_id() == "game" then
|
||||
Sprite.draw_at("norman", 13 * 8, 9 * 8)
|
||||
Sprite.draw_at("dev_buddy", 15 * 8, 9 * 8)
|
||||
Sprite.draw_at("dev_project_manager", 6 * 8, 4 * 8)
|
||||
Sprite.draw_at("dev_hr_girl", 12 * 8, 4 * 8)
|
||||
Sprite.draw_at("dev_introvert", -4 + 5 * 8, 9 * 8)
|
||||
Sprite.draw_at("dev_extrovert", 20 * 8, 4 * 8)
|
||||
Sprite.draw_at("dev_girl", 23 * 8, 5 * 8)
|
||||
Sprite.draw_at("dev_boy", 10 * 8, 11 * 8 + 4)
|
||||
Sprite.draw_at("dev_guru", 22 * 8, 10 * 8 + 4)
|
||||
Sprite.draw_at("dev_operator", 27 * 8, 10 * 8 + 4)
|
||||
|
||||
Sprite.draw_list(Context.office_sprites)
|
||||
end
|
||||
Context.have_been_to_office = true
|
||||
end
|
||||
})
|
||||
|
||||
@@ -8,6 +8,28 @@ Screen.register({
|
||||
},
|
||||
init = function()
|
||||
Audio.music_play_room_work()
|
||||
|
||||
local possible_sprites = {
|
||||
"matrix_trinity",
|
||||
"matrix_neo",
|
||||
{id="matrix_oraculum", y_correct=1 * 8},
|
||||
"matrix_architect"
|
||||
}
|
||||
|
||||
local possible_positions = {
|
||||
{x = 5 * 8, y = 11 * 8},
|
||||
{x = 7 * 8, y = 11 * 8},
|
||||
{x = 9 * 8, y = 11 * 8},
|
||||
{x = 11 * 8, y = 11 * 8},
|
||||
{x = 13 * 8, y = 11 * 8},
|
||||
{x = 15 * 8, y = 11 * 8},
|
||||
{x = 18 * 8, y = 11 * 8},
|
||||
{x = 21 * 8, y = 11 * 8},
|
||||
{x = 24 * 8, y = 11 * 8},
|
||||
{x = 27 * 8, y = 11 * 8},
|
||||
}
|
||||
|
||||
Context.walking_to_office_sprites = Sprite.list_randomize(possible_sprites, possible_positions)
|
||||
end,
|
||||
background = "street",
|
||||
draw = function()
|
||||
@@ -16,10 +38,8 @@ Screen.register({
|
||||
Sprite.draw_at("sumphore", 9 * 8, 2 * 8)
|
||||
Sprite.draw_at("pizza_vendor", 19 * 8, 1 * 8)
|
||||
Sprite.draw_at("dev_guard", 22 * 8, 2 * 8)
|
||||
Sprite.draw_at("matrix_trinity", 5 * 8, 11 * 8)
|
||||
Sprite.draw_at("matrix_neo", 7 * 8, 11 * 8)
|
||||
Sprite.draw_at("matrix_oraculum", 9 * 8, 12 * 8)
|
||||
Sprite.draw_at("matrix_architect", 11 * 8, 11 * 8)
|
||||
|
||||
Sprite.draw_list(Context.walking_to_office_sprites)
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
@@ -73,6 +73,70 @@ function Sprite.generate_table(width, height, starting_s, x_base, y_base, x_step
|
||||
return sprites
|
||||
end
|
||||
|
||||
--- Immediately draws a list of sprites
|
||||
--- @within Sprite
|
||||
--- @param sprite_list table An array of tables, each containing: `id` (string) sprite identifier, `x` (number) x-coordinate, `y` (number) y-coordinate, and optional `colorkey`, `scale`, `flip_x`, `flip_y`, `rot` parameters.
|
||||
function Sprite.draw_list(sprite_list)
|
||||
for _, sprite_info in ipairs(sprite_list) do
|
||||
local sprite_data = _sprites[sprite_info.id]
|
||||
if not sprite_data then
|
||||
trace("Error: Attempted to draw non-registered sprite with id: " .. sprite_info.id)
|
||||
else
|
||||
draw_sprite_instance(sprite_data, sprite_info)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--- Given a list of sprite IDs (or sprite entries with correction offsets) and a list of possible positions, randomly assigns each sprite to a unique position and returns a drawable list.
|
||||
--- @within Sprite
|
||||
--- @param sprite_ids table An array of sprite identifier values or tables.
|
||||
--- Each entry may be either:
|
||||
--- - string: sprite ID to draw.
|
||||
--- - table: { sprite_id = string, x_correct = number, y_correct = number }.
|
||||
--- @param positions table An array of tables, each containing `x` and `y` fields for possible sprite positions.
|
||||
function Sprite.list_randomize(sprite_ids, positions)
|
||||
if #sprite_ids > #positions then
|
||||
trace("Error: More sprite IDs than available positions in Sprite.draw_randomized")
|
||||
return
|
||||
end
|
||||
|
||||
local shuffled_positions = {}
|
||||
for i, pos in ipairs(positions) do
|
||||
shuffled_positions[i] = pos
|
||||
end
|
||||
for i = #shuffled_positions, 2, -1 do
|
||||
local j = math.random(i)
|
||||
shuffled_positions[i], shuffled_positions[j] = shuffled_positions[j], shuffled_positions[i]
|
||||
end
|
||||
|
||||
local drawable_list = {}
|
||||
for i, sprite_entry in ipairs(sprite_ids) do
|
||||
local sprite_id = sprite_entry
|
||||
local x_correct = 0
|
||||
local y_correct = 0
|
||||
|
||||
if type(sprite_entry) == "table" then
|
||||
sprite_id = sprite_entry.sprite_id or sprite_entry.id
|
||||
x_correct = sprite_entry.x_correct or 0
|
||||
y_correct = sprite_entry.y_correct or 0
|
||||
end
|
||||
|
||||
local sprite_data = _sprites[sprite_id]
|
||||
if not sprite_data then
|
||||
trace("Error: Attempted to draw non-registered sprite with id: " .. tostring(sprite_id))
|
||||
else
|
||||
local pos = shuffled_positions[i]
|
||||
table.insert(drawable_list, {
|
||||
id = sprite_id,
|
||||
x = pos.x + x_correct,
|
||||
y = pos.y + y_correct
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
return drawable_list
|
||||
end
|
||||
|
||||
--- Schedules a sprite for drawing.
|
||||
--- @within Sprite
|
||||
--- @param id string The unique identifier of the sprite.<br/>
|
||||
|
||||
@@ -10,6 +10,11 @@ function Mouse.update()
|
||||
_consumed = false
|
||||
local mt = {mouse()}
|
||||
_mx, _my, _mleft = mt[1], mt[2], mt[3]
|
||||
|
||||
-- trace mouse position and tile for testing purposes
|
||||
if Context.test_mode and Context.mouse_trace then
|
||||
trace("Mouse: (" .. _mx .. "," .. _my .. "), tile: (" .. math.floor(_mx / 8) .. "," .. math.floor(_my / 8) .. ")")
|
||||
end
|
||||
end
|
||||
|
||||
--- Returns current mouse X position.
|
||||
|
||||
Reference in New Issue
Block a user