use 8 pixel tiles i guess
Signed-off-by: Xe Iaso <me@christine.website>
This commit is contained in:
parent
3492329649
commit
6c35dc1503
|
@ -13,6 +13,8 @@ fn mapgen(b: *std.build.Step) !void {
|
|||
var deno = std.ChildProcess.init(&.{"deno", "run", "-A", "./src/tools/genmap.js", map[0], map[1]}, alloc);
|
||||
try deno.spawn();
|
||||
_ = try deno.wait();
|
||||
|
||||
std.log.info("generated map {s}", .{map[1]});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -23,6 +25,8 @@ fn release(b: *std.build.Step) !void {
|
|||
var rel = std.ChildProcess.init(&.{"bash", "./release.sh"}, alloc);
|
||||
try rel.spawn();
|
||||
_ = try rel.wait();
|
||||
|
||||
std.log.info("generated release assets in dist/{s}", .{""});
|
||||
}
|
||||
|
||||
pub fn build(b: *std.build.Builder) !void {
|
||||
|
@ -31,6 +35,7 @@ pub fn build(b: *std.build.Builder) !void {
|
|||
|
||||
const release_step = b.step("release", "generate release binaries");
|
||||
release_step.makeFn = release;
|
||||
release_step.dependOn(map_step);
|
||||
|
||||
const mode = b.standardReleaseOptions();
|
||||
const lib = b.addSharedLibrary("cart", "src/main.zig", .unversioned);
|
||||
|
|
|
@ -1,25 +1,35 @@
|
|||
{ "compressionlevel":-1,
|
||||
"height":10,
|
||||
"height":20,
|
||||
"infinite":false,
|
||||
"layers":[
|
||||
{
|
||||
"data":[1, 1, 1, 18, 1, 19, 20, 21, 1, 18,
|
||||
69, 1, 35, 52, 1, 36, 53, 38, 35, 52,
|
||||
1, 18, 1, 18, 86, 88, 104, 1, 18, 17,
|
||||
35, 52, 35, 52, 105, 1, 18, 35, 92, 1,
|
||||
18, 69, 1, 1, 105, 35, 52, 1, 81, 1,
|
||||
52, 35, 1, 18, 105, 67, 66, 97, 98, 99,
|
||||
1, 68, 35, 52, 105, 66, 67, 114, 115, 116,
|
||||
18, 103, 88, 88, 106, 1, 1, 100, 118, 101,
|
||||
52, 1, 1, 1, 103, 88, 88, 88, 107, 88,
|
||||
11, 13, 1, 12, 1, 69, 1, 18, 35, 52],
|
||||
"height":10,
|
||||
"data":[1, 2, 137, 138, 1, 2, 137, 138, 1, 2, 71, 72, 73, 74, 75, 76, 1, 2, 137, 138,
|
||||
35, 36, 171, 172, 35, 36, 171, 172, 35, 36, 105, 106, 107, 108, 109, 110, 35, 36, 171, 172,
|
||||
69, 70, 205, 206, 69, 70, 205, 206, 69, 70, 139, 140, 207, 208, 143, 144, 69, 70, 205, 206,
|
||||
103, 104, 239, 240, 103, 104, 239, 240, 103, 104, 173, 174, 241, 242, 177, 178, 103, 104, 239, 240,
|
||||
137, 138, 137, 138, 1, 2, 137, 138, 1, 2, 137, 138, 1, 2, 137, 138, 1, 2, 33, 34,
|
||||
171, 172, 171, 172, 35, 36, 171, 172, 35, 36, 171, 172, 35, 36, 171, 172, 35, 36, 67, 68,
|
||||
205, 206, 205, 206, 69, 70, 205, 206, 69, 70, 205, 206, 69, 70, 205, 206, 69, 70, 205, 206,
|
||||
239, 240, 239, 240, 103, 104, 239, 240, 103, 104, 239, 240, 103, 104, 239, 240, 103, 104, 239, 240,
|
||||
1, 2, 137, 138, 1, 2, 137, 138, 1, 2, 137, 138, 1, 2, 137, 138, 1, 2, 137, 138,
|
||||
35, 36, 171, 172, 35, 36, 171, 172, 35, 36, 171, 172, 35, 36, 171, 172, 331, 332, 171, 172,
|
||||
69, 70, 205, 206, 69, 70, 205, 206, 69, 70, 235, 236, 233, 234, 205, 364, 365, 366, 367, 206,
|
||||
103, 104, 239, 240, 103, 104, 239, 240, 103, 104, 269, 270, 267, 268, 397, 398, 399, 400, 401, 402,
|
||||
1, 2, 237, 238, 1, 2, 137, 138, 1, 2, 233, 234, 235, 236, 431, 432, 433, 434, 435, 436,
|
||||
35, 36, 271, 272, 35, 353, 354, 172, 35, 36, 267, 268, 269, 270, 465, 466, 467, 468, 469, 470,
|
||||
69, 70, 351, 352, 69, 387, 388, 206, 347, 348, 349, 350, 343, 344, 499, 500, 439, 440, 503, 504,
|
||||
103, 104, 385, 386, 103, 104, 239, 240, 381, 382, 383, 384, 377, 378, 403, 404, 473, 474, 405, 406,
|
||||
1, 2, 409, 410, 345, 346, 345, 346, 417, 418, 417, 418, 417, 418, 345, 346, 417, 418, 345, 346,
|
||||
35, 36, 443, 444, 379, 380, 379, 380, 451, 452, 451, 452, 451, 452, 379, 380, 451, 452, 379, 380,
|
||||
69, 57, 58, 206, 69, 70, 205, 206, 69, 70, 205, 206, 69, 70, 205, 206, 69, 70, 205, 206,
|
||||
90, 91, 92, 93, 103, 104, 57, 58, 103, 104, 239, 240, 103, 104, 239, 240, 103, 104, 239, 240],
|
||||
"height":20,
|
||||
"id":1,
|
||||
"name":"map",
|
||||
"opacity":1,
|
||||
"type":"tilelayer",
|
||||
"visible":true,
|
||||
"width":10,
|
||||
"width":20,
|
||||
"x":0,
|
||||
"y":0
|
||||
},
|
||||
|
@ -138,7 +148,6 @@
|
|||
"x":120.727,
|
||||
"y":86.9091
|
||||
},
|
||||
|
||||
{
|
||||
"class":"",
|
||||
"height":7.09091,
|
||||
|
@ -315,14 +324,14 @@
|
|||
"orientation":"orthogonal",
|
||||
"renderorder":"right-down",
|
||||
"tiledversion":"1.9.0",
|
||||
"tileheight":16,
|
||||
"tileheight":8,
|
||||
"tilesets":[
|
||||
{
|
||||
"firstgid":1,
|
||||
"source":"..\/sprites\/kenney_rpg.tsx"
|
||||
}],
|
||||
"tilewidth":16,
|
||||
"tilewidth":8,
|
||||
"type":"map",
|
||||
"version":"1.9",
|
||||
"width":10
|
||||
"width":20
|
||||
}
|
|
@ -1,21 +1,31 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<map version="1.9" tiledversion="1.9.0" orientation="orthogonal" renderorder="right-down" width="10" height="10" tilewidth="16" tileheight="16" infinite="0" nextlayerid="5" nextobjectid="34">
|
||||
<map version="1.9" tiledversion="1.9.0" orientation="orthogonal" renderorder="right-down" width="20" height="20" tilewidth="8" tileheight="8" infinite="0" nextlayerid="5" nextobjectid="34">
|
||||
<editorsettings>
|
||||
<export target="RPGmap.json" format="json"/>
|
||||
</editorsettings>
|
||||
<tileset firstgid="1" source="../sprites/kenney_rpg.tsx"/>
|
||||
<layer id="1" name="map" width="10" height="10">
|
||||
<layer id="1" name="map" width="20" height="20">
|
||||
<data encoding="csv">
|
||||
1,1,1,18,1,19,20,21,1,18,
|
||||
69,1,35,52,1,36,53,38,35,52,
|
||||
1,18,1,18,86,88,104,1,18,17,
|
||||
35,52,35,52,105,1,18,35,92,1,
|
||||
18,69,1,1,105,35,52,1,81,1,
|
||||
52,35,1,18,105,67,66,97,98,99,
|
||||
1,68,35,52,105,66,67,114,115,116,
|
||||
18,103,88,88,106,1,1,100,118,101,
|
||||
52,1,1,1,103,88,88,88,107,88,
|
||||
11,13,1,12,1,69,1,18,35,52
|
||||
1,2,137,138,1,2,137,138,1,2,71,72,73,74,75,76,1,2,137,138,
|
||||
35,36,171,172,35,36,171,172,35,36,105,106,107,108,109,110,35,36,171,172,
|
||||
69,70,205,206,69,70,205,206,69,70,139,140,207,208,143,144,69,70,205,206,
|
||||
103,104,239,240,103,104,239,240,103,104,173,174,241,242,177,178,103,104,239,240,
|
||||
137,138,137,138,1,2,137,138,1,2,137,138,1,2,137,138,1,2,33,34,
|
||||
171,172,171,172,35,36,171,172,35,36,171,172,35,36,171,172,35,36,67,68,
|
||||
205,206,205,206,69,70,205,206,69,70,205,206,69,70,205,206,69,70,205,206,
|
||||
239,240,239,240,103,104,239,240,103,104,239,240,103,104,239,240,103,104,239,240,
|
||||
1,2,137,138,1,2,137,138,1,2,137,138,1,2,137,138,1,2,137,138,
|
||||
35,36,171,172,35,36,171,172,35,36,171,172,35,36,171,172,331,332,171,172,
|
||||
69,70,205,206,69,70,205,206,69,70,235,236,233,234,205,364,365,366,367,206,
|
||||
103,104,239,240,103,104,239,240,103,104,269,270,267,268,397,398,399,400,401,402,
|
||||
1,2,237,238,1,2,137,138,1,2,233,234,235,236,431,432,433,434,435,436,
|
||||
35,36,271,272,35,353,354,172,35,36,267,268,269,270,465,466,467,468,469,470,
|
||||
69,70,351,352,69,387,388,206,347,348,349,350,343,344,499,500,439,440,503,504,
|
||||
103,104,385,386,103,104,239,240,381,382,383,384,377,378,403,404,473,474,405,406,
|
||||
1,2,409,410,345,346,345,346,417,418,417,418,417,418,345,346,417,418,345,346,
|
||||
35,36,443,444,379,380,379,380,451,452,451,452,451,452,379,380,451,452,379,380,
|
||||
69,57,58,206,69,70,205,206,69,70,205,206,69,70,205,206,69,70,205,206,
|
||||
90,91,92,93,103,104,57,58,103,104,239,240,103,104,239,240,103,104,239,240
|
||||
</data>
|
||||
</layer>
|
||||
<objectgroup id="2" name="coll">
|
||||
|
|
|
@ -1,73 +0,0 @@
|
|||
{ "compressionlevel":-1,
|
||||
"editorsettings":
|
||||
{
|
||||
"export":
|
||||
{
|
||||
"format":"json",
|
||||
"target":"TestMap.json"
|
||||
}
|
||||
},
|
||||
"height":10,
|
||||
"infinite":false,
|
||||
"layers":[
|
||||
{
|
||||
"data":[29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 18, 29, 29, 29, 29, 29, 29, 29, 29, 29, 38, 29, 29, 29, 29, 1, 2, 3, 4, 2, 48, 4, 2, 3, 4, 6, 50, 50, 50, 50, 50, 50, 22, 50, 23, 16, 22, 50, 23, 50, 43, 50, 50, 50, 50, 26, 41, 50, 50, 50, 50, 50, 22, 50, 50, 6, 50, 50, 50, 22, 50, 50, 50, 42, 50],
|
||||
"height":10,
|
||||
"id":1,
|
||||
"name":"Tile Layer 1",
|
||||
"opacity":1,
|
||||
"type":"tilelayer",
|
||||
"visible":true,
|
||||
"width":10,
|
||||
"x":0,
|
||||
"y":0
|
||||
},
|
||||
{
|
||||
"draworder":"topdown",
|
||||
"id":2,
|
||||
"name":"coll",
|
||||
"objects":[
|
||||
{
|
||||
"height":80,
|
||||
"id":3,
|
||||
"name":"",
|
||||
"rotation":0,
|
||||
"type":"",
|
||||
"visible":true,
|
||||
"width":160,
|
||||
"x":0,
|
||||
"y":80
|
||||
},
|
||||
{
|
||||
"height":32,
|
||||
"id":4,
|
||||
"name":"",
|
||||
"rotation":0,
|
||||
"type":"",
|
||||
"visible":true,
|
||||
"width":16,
|
||||
"x":80,
|
||||
"y":48
|
||||
}],
|
||||
"opacity":1,
|
||||
"type":"objectgroup",
|
||||
"visible":true,
|
||||
"x":0,
|
||||
"y":0
|
||||
}],
|
||||
"nextlayerid":3,
|
||||
"nextobjectid":5,
|
||||
"orientation":"orthogonal",
|
||||
"renderorder":"right-down",
|
||||
"tiledversion":"1.4.3",
|
||||
"tileheight":16,
|
||||
"tilesets":[
|
||||
{
|
||||
"firstgid":1,
|
||||
"source":"..\/sprites\/Cave.tsx"
|
||||
}],
|
||||
"tilewidth":16,
|
||||
"type":"map",
|
||||
"version":1.4,
|
||||
"width":10
|
||||
}
|
|
@ -1,25 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<map version="1.4" tiledversion="1.4.3" orientation="orthogonal" renderorder="right-down" width="10" height="10" tilewidth="16" tileheight="16" infinite="0" nextlayerid="3" nextobjectid="5">
|
||||
<editorsettings>
|
||||
<export target="TestMap.json" format="json"/>
|
||||
</editorsettings>
|
||||
<tileset firstgid="1" source="../sprites/Cave.tsx"/>
|
||||
<layer id="1" name="map" width="10" height="10">
|
||||
<data encoding="csv">
|
||||
29,29,29,29,29,29,29,29,29,29,
|
||||
29,29,29,29,29,29,29,29,29,29,
|
||||
29,29,29,29,29,29,29,29,29,29,
|
||||
29,29,29,29,29,18,29,29,29,29,
|
||||
29,29,29,29,29,38,29,29,29,29,
|
||||
1,2,3,4,2,48,4,2,3,4,
|
||||
6,50,50,50,50,50,50,22,50,23,
|
||||
16,22,50,23,50,43,50,50,50,50,
|
||||
26,41,50,50,50,50,50,22,50,50,
|
||||
6,50,50,50,22,50,50,50,42,50
|
||||
</data>
|
||||
</layer>
|
||||
<objectgroup id="2" name="coll">
|
||||
<object id="3" x="0" y="80" width="160" height="80"/>
|
||||
<object id="4" x="80" y="48" width="16" height="32"/>
|
||||
</objectgroup>
|
||||
</map>
|
|
@ -4,10 +4,9 @@ set -ex
|
|||
|
||||
mkdir -p dist
|
||||
rm -rf dist/*
|
||||
zig build mapgen
|
||||
zig build -Drelease-small=true
|
||||
wasm-strip ./zig-out/lib/cart.wasm
|
||||
wasm-opt -Oz --strip-producers --dce ./zig-out/lib/cart.wasm -o ./dist/tamamo.wasm
|
||||
wasm-strip ./dist/tamamo.wasm
|
||||
w4 bundle \
|
||||
--windows ./dist/tamamo.exe \
|
||||
--mac ./dist/tamamo.macOS \
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<tileset version="1.4" tiledversion="1.4.3" name="kenney_rpg" tilewidth="16" tileheight="16" tilecount="136" columns="17">
|
||||
<tileset version="1.9" tiledversion="1.9.0" name="kenney_rpg" tilewidth="8" tileheight="8" tilecount="544" columns="34">
|
||||
<image source="kenney_rpg.png" width="272" height="128"/>
|
||||
</tileset>
|
||||
|
|
39
src/main.zig
39
src/main.zig
|
@ -20,27 +20,16 @@ var mara_box: Rect = Rect{.base = map.start_point, .width = 16, .height = 16};
|
|||
var mara_speed: u16 = 0;
|
||||
var screen = Rect{.base = Point{.x = 0, .y = 0}, .width = 160, .height = 160};
|
||||
|
||||
const screen_width = 10;
|
||||
const screen_height = 10;
|
||||
var camera: [screen_height * screen_width]u8 = [_]u8{0} ** (screen_height * screen_width);
|
||||
const screen_width = 20;
|
||||
const screen_height = 20;
|
||||
|
||||
var sound_timer: u8 = 0;
|
||||
|
||||
var textBuf: [160]u8 = undefined;
|
||||
var done: bool = true;
|
||||
var done: bool = false;
|
||||
|
||||
export fn start() void {
|
||||
palette.mist();
|
||||
|
||||
var col: u32 = 0;
|
||||
while(col < screen_width) {
|
||||
defer col += 1;
|
||||
var row: u32 = 0;
|
||||
while(row < screen_height) {
|
||||
defer row += 1;
|
||||
camera[row * screen_width + col] = map.data[row * screen_width + col];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn bonk() void {
|
||||
|
@ -85,23 +74,23 @@ fn drawMap() !void {
|
|||
while (row < screen_height) {
|
||||
defer row += 1;
|
||||
|
||||
var tile = camera[col * map.width + row];
|
||||
var tile = map.data[col * map.width + row];
|
||||
var tileX = tile % map.ts_width;
|
||||
var tileY = tile / map.ts_width;
|
||||
|
||||
// if (!done) {
|
||||
// var buf = fmt.bufPrint(&textBuf, "{},{}: {}: {},{}", .{col, row, tile, tileX, tileY}) catch unreachable;
|
||||
// w4.trace(buf);
|
||||
// }
|
||||
if (!done) {
|
||||
var buf = fmt.bufPrint(&textBuf, "{},{}: {}: {},{}", .{col, row, tile, tileX, tileY}) catch unreachable;
|
||||
w4.trace(buf);
|
||||
}
|
||||
|
||||
w4.blitSub(
|
||||
&sprites.kenney_rpg,
|
||||
row * 16,
|
||||
col * 16,
|
||||
16,
|
||||
16,
|
||||
@intCast(u32, tileX) * 16,
|
||||
@intCast(u32, tileY) * 16,
|
||||
row * 8,
|
||||
col * 8,
|
||||
8,
|
||||
8,
|
||||
@intCast(u32, tileX) * 8,
|
||||
@intCast(u32, tileY) * 8,
|
||||
sprites.kenney_rpg_width,
|
||||
w4.BlitFlags{.two_bits = true},
|
||||
);
|
||||
|
|
|
@ -3,26 +3,58 @@
|
|||
const sh0rk = @import("../sh0rk.zig");
|
||||
const Direction = sh0rk.Direction;
|
||||
const Point = sh0rk.Point;
|
||||
const Tileset = sh0rk.Tileset;
|
||||
const Trigger = sh0rk.Trigger;
|
||||
const Rect = sh0rk.Rect;
|
||||
|
||||
pub const width = 10;
|
||||
pub const height = 10;
|
||||
pub const width = 20;
|
||||
pub const height = 20;
|
||||
|
||||
pub const ts_width = 17;
|
||||
pub const ts_height = 8;
|
||||
pub const tileset: Tileset = .Rpg;
|
||||
pub const ts_width = 34;
|
||||
pub const ts_height = 16;
|
||||
|
||||
pub const data = [100]u8{
|
||||
0, 0, 0, 17, 0, 18, 19, 20, 0, 17, 68,
|
||||
0, 34, 51, 0, 35, 52, 37, 34, 51, 0,
|
||||
17, 0, 17, 85, 87, 103, 0, 17, 16, 34,
|
||||
51, 34, 51, 104, 0, 17, 34, 91, 0, 17,
|
||||
68, 0, 0, 104, 34, 51, 0, 80, 0, 51,
|
||||
34, 0, 17, 104, 66, 65, 96, 97, 98, 0,
|
||||
67, 34, 51, 104, 65, 66, 113, 114, 115, 17,
|
||||
102, 87, 87, 105, 0, 0, 99, 117, 100, 51,
|
||||
0, 0, 0, 102, 87, 87, 87, 106, 87, 10,
|
||||
12, 0, 11, 0, 68, 0, 17, 34, 51,
|
||||
pub const data = [400]u9{
|
||||
0, 1, 136, 137, 0, 1, 136, 137, 0, 1, 70,
|
||||
71, 72, 73, 74, 75, 0, 1, 136, 137, 34,
|
||||
35, 170, 171, 34, 35, 170, 171, 34, 35, 104,
|
||||
105, 106, 107, 108, 109, 34, 35, 170, 171, 68,
|
||||
69, 204, 205, 68, 69, 204, 205, 68, 69, 138,
|
||||
139, 206, 207, 142, 143, 68, 69, 204, 205, 102,
|
||||
103, 238, 239, 102, 103, 238, 239, 102, 103, 172,
|
||||
173, 240, 241, 176, 177, 102, 103, 238, 239, 136,
|
||||
137, 136, 137, 0, 1, 136, 137, 0, 1, 136,
|
||||
137, 0, 1, 136, 137, 0, 1, 32, 33, 170,
|
||||
171, 170, 171, 34, 35, 170, 171, 34, 35, 170,
|
||||
171, 34, 35, 170, 171, 34, 35, 66, 67, 204,
|
||||
205, 204, 205, 68, 69, 204, 205, 68, 69, 204,
|
||||
205, 68, 69, 204, 205, 68, 69, 204, 205, 238,
|
||||
239, 238, 239, 102, 103, 238, 239, 102, 103, 238,
|
||||
239, 102, 103, 238, 239, 102, 103, 238, 239, 0,
|
||||
1, 136, 137, 0, 1, 136, 137, 0, 1, 136,
|
||||
137, 0, 1, 136, 137, 0, 1, 136, 137, 34,
|
||||
35, 170, 171, 34, 35, 170, 171, 34, 35, 170,
|
||||
171, 34, 35, 170, 171, 330, 331, 170, 171, 68,
|
||||
69, 204, 205, 68, 69, 204, 205, 68, 69, 234,
|
||||
235, 232, 233, 204, 363, 364, 365, 366, 205, 102,
|
||||
103, 238, 239, 102, 103, 238, 239, 102, 103, 268,
|
||||
269, 266, 267, 396, 397, 398, 399, 400, 401, 0,
|
||||
1, 236, 237, 0, 1, 136, 137, 0, 1, 232,
|
||||
233, 234, 235, 430, 431, 432, 433, 434, 435, 34,
|
||||
35, 270, 271, 34, 352, 353, 171, 34, 35, 266,
|
||||
267, 268, 269, 464, 465, 466, 467, 468, 469, 68,
|
||||
69, 350, 351, 68, 386, 387, 205, 346, 347, 348,
|
||||
349, 342, 343, 498, 499, 438, 439, 502, 503, 102,
|
||||
103, 384, 385, 102, 103, 238, 239, 380, 381, 382,
|
||||
383, 376, 377, 402, 403, 472, 473, 404, 405, 0,
|
||||
1, 408, 409, 344, 345, 344, 345, 416, 417, 416,
|
||||
417, 416, 417, 344, 345, 416, 417, 344, 345, 34,
|
||||
35, 442, 443, 378, 379, 378, 379, 450, 451, 450,
|
||||
451, 450, 451, 378, 379, 450, 451, 378, 379, 68,
|
||||
56, 57, 205, 68, 69, 204, 205, 68, 69, 204,
|
||||
205, 68, 69, 204, 205, 68, 69, 204, 205, 89,
|
||||
90, 91, 92, 102, 103, 56, 57, 102, 103, 238,
|
||||
239, 102, 103, 238, 239, 102, 103, 238, 239,
|
||||
};
|
||||
|
||||
pub const coll = [_]Rect{
|
||||
|
|
|
@ -3,16 +3,18 @@
|
|||
const sh0rk = @import("../sh0rk.zig");
|
||||
const Direction = sh0rk.Direction;
|
||||
const Point = sh0rk.Point;
|
||||
const Tileset = sh0rk.Tileset;
|
||||
const Trigger = sh0rk.Trigger;
|
||||
const Rect = sh0rk.Rect;
|
||||
|
||||
pub const width = 20;
|
||||
pub const height = 20;
|
||||
|
||||
pub const ts_width = 17;
|
||||
pub const ts_height = 8;
|
||||
pub const tileset: Tileset = .Rpg;
|
||||
pub const ts_width = 34;
|
||||
pub const ts_height = 16;
|
||||
|
||||
pub const data = [400]u8{
|
||||
pub const data = [400]u9{
|
||||
0, 0, 0, 17, 0, 18, 19, 20, 0, 17, 0,
|
||||
17, 18, 67, 20, 17, 0, 17, 19, 17, 68,
|
||||
0, 34, 51, 0, 35, 52, 37, 34, 51, 34,
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
// Generated by ./src/tools/genmap.js ./maps/TestMap.json, DO NOT EDIT
|
||||
|
||||
const sh0rk = @import("../sh0rk.zig");
|
||||
const Direction = sh0rk.Direction;
|
||||
const Point = sh0rk.Point;
|
||||
const Trigger = sh0rk.Trigger;
|
||||
const Rect = sh0rk.Rect;
|
||||
|
||||
pub const width = 10;
|
||||
pub const height = 10;
|
||||
|
||||
pub const ts_width = 10;
|
||||
pub const ts_height = 5;
|
||||
|
||||
pub const coll = [_]Rect{
|
||||
Rect{.base = Point{.x = 0, .y = 80}, .width = 160, .height = 80},
|
||||
Rect{.base = Point{.x = 80, .y = 48}, .width = 16, .height = 32},
|
||||
};
|
||||
|
|
@ -47,7 +47,8 @@ pub const Trigger = struct {
|
|||
dialogue: []const u8,
|
||||
};
|
||||
|
||||
pub const Tile = packed struct {
|
||||
x: u4,
|
||||
y: u4,
|
||||
pub const Tileset = enum(u2) {
|
||||
Cave,
|
||||
Rpg,
|
||||
Dungeon,
|
||||
};
|
|
@ -17,6 +17,7 @@ out += `const sh0rk = @import("../sh0rk.zig");\n`;
|
|||
|
||||
out += `const Direction = sh0rk.Direction;\n`;
|
||||
out += `const Point = sh0rk.Point;\n`;
|
||||
out += `const Tileset = sh0rk.Tileset;\n`;
|
||||
out += `const Trigger = sh0rk.Trigger;\n`;
|
||||
out += `const Rect = sh0rk.Rect;\n\n`;
|
||||
|
||||
|
@ -33,24 +34,27 @@ let tilesheet = {
|
|||
map.tilesets.forEach(tset => {
|
||||
if (tset.source.includes("kenney")) {
|
||||
tilesheet = {
|
||||
width: 17,
|
||||
height: 8,
|
||||
width: 34,
|
||||
height: 16,
|
||||
name: "Rpg",
|
||||
};
|
||||
}
|
||||
|
||||
if (tset.source.includes("Cave")) {
|
||||
tilesheet = {
|
||||
width: 10,
|
||||
width: 14,
|
||||
height: 5,
|
||||
name: "Cave",
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
out += `pub const tileset: Tileset = .${tilesheet.name};\n`;
|
||||
out += `pub const ts_width = ${tilesheet.width};\n`;
|
||||
out += `pub const ts_height = ${tilesheet.height};\n\n`;
|
||||
|
||||
const genMap = (tiles) => {
|
||||
out += `pub const data = [${tiles.data.length}]u8{\n `;
|
||||
out += `pub const data = [${tiles.data.length}]u9{\n `;
|
||||
|
||||
tiles.data.forEach((tile, index) => {
|
||||
tile -= 1;
|
||||
|
|
Loading…
Reference in New Issue