try doing sprites better
Signed-off-by: Christine Dodrill <me@christine.website>
This commit is contained in:
parent
45b6b7f185
commit
e157638405
|
@ -5,7 +5,7 @@ set -ex
|
||||||
mkdir -p dist
|
mkdir -p dist
|
||||||
rm -rf dist/*
|
rm -rf dist/*
|
||||||
zig build -Drelease-small=true
|
zig build -Drelease-small=true
|
||||||
wasm-opt -Oz --zero-filled-memory --strip-producers --dce ./zig-out/lib/cart.wasm -o ./dist/tamamo.wasm
|
wasm-opt -Oz --strip-producers --dce ./zig-out/lib/cart.wasm -o ./dist/tamamo.wasm
|
||||||
wasm-strip ./dist/tamamo.wasm
|
wasm-strip ./dist/tamamo.wasm
|
||||||
w4 bundle \
|
w4 bundle \
|
||||||
--windows ./dist/tamamo.exe \
|
--windows ./dist/tamamo.exe \
|
||||||
|
|
BIN
sprites/Mara.png
BIN
sprites/Mara.png
Binary file not shown.
Before Width: | Height: | Size: 395 B After Width: | Height: | Size: 399 B |
Binary file not shown.
After Width: | Height: | Size: 651 B |
Binary file not shown.
Binary file not shown.
After Width: | Height: | Size: 651 B |
Binary file not shown.
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
39
src/main.zig
39
src/main.zig
|
@ -10,12 +10,12 @@ const Rect = sh0rk.Rect;
|
||||||
var frame_count: u32 = 0;
|
var frame_count: u32 = 0;
|
||||||
var mara_direction: Direction = Direction.Right;
|
var mara_direction: Direction = Direction.Right;
|
||||||
var mara_frame: bool = false;
|
var mara_frame: bool = false;
|
||||||
var mara_box: Rect = Rect{.base = Point{.x = 60, .y = 60}, .width = 16, .height = 16};
|
var mara_box: Rect = Rect{.base = Point{.x = 20, .y = 40}, .width = 16, .height = 16};
|
||||||
var mara_speed: i32 = 0;
|
var mara_speed: i32 = 0;
|
||||||
var screen = Rect{.base = Point{.x = 0, .y = 0}, .width = 160, .height = 160};
|
var screen = Rect{.base = Point{.x = 0, .y = 0}, .width = 160, .height = 160};
|
||||||
|
|
||||||
export fn start() void {
|
export fn start() void {
|
||||||
palette.tamtam();
|
palette.mist();
|
||||||
}
|
}
|
||||||
|
|
||||||
export fn update() void {
|
export fn update() void {
|
||||||
|
@ -24,11 +24,6 @@ export fn update() void {
|
||||||
w4.text("Mara 2:\nTamamo's Fury", 10, 10);
|
w4.text("Mara 2:\nTamamo's Fury", 10, 10);
|
||||||
|
|
||||||
const gamepad = w4.m.gamepads[0];
|
const gamepad = w4.m.gamepads[0];
|
||||||
if (gamepad.a) {
|
|
||||||
w4.m.colors._0 = .p2;
|
|
||||||
}
|
|
||||||
|
|
||||||
w4.text("Press X to blink", 16, 90);
|
|
||||||
|
|
||||||
var old_speed = mara_speed;
|
var old_speed = mara_speed;
|
||||||
|
|
||||||
|
@ -38,16 +33,16 @@ export fn update() void {
|
||||||
}
|
}
|
||||||
if (gamepad.up) {
|
if (gamepad.up) {
|
||||||
mara_direction = Direction.Up;
|
mara_direction = Direction.Up;
|
||||||
mara_speed = 2;
|
mara_speed = 1;
|
||||||
} else if (gamepad.down) {
|
} else if (gamepad.down) {
|
||||||
mara_direction = Direction.Down;
|
mara_direction = Direction.Down;
|
||||||
mara_speed = 2;
|
mara_speed = 1;
|
||||||
} else if (gamepad.left) {
|
} else if (gamepad.left) {
|
||||||
mara_direction = Direction.Left;
|
mara_direction = Direction.Left;
|
||||||
mara_speed = 2;
|
mara_speed = 1;
|
||||||
} else if (gamepad.right) {
|
} else if (gamepad.right) {
|
||||||
mara_direction = Direction.Right;
|
mara_direction = Direction.Right;
|
||||||
mara_speed = 2;
|
mara_speed = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (mara_direction) {
|
switch (mara_direction) {
|
||||||
|
@ -76,15 +71,29 @@ export fn update() void {
|
||||||
mara_box.base.y = 160 - mara_box.height;
|
mara_box.base.y = 160 - mara_box.height;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var flags: w4.BlitFlags = w4.BlitFlags {
|
||||||
|
.two_bits = true,
|
||||||
|
};
|
||||||
|
|
||||||
|
w4.m.colors._0 = .p0;
|
||||||
|
w4.m.colors._1 = .p1;
|
||||||
|
w4.m.colors._2 = .p2;
|
||||||
|
w4.m.colors._3 = .p3;
|
||||||
|
|
||||||
|
w4.blit(&sprites.tamamotitle, 60, 60, sprites.tamamotitle_width, sprites.tamamotitle_height, flags);
|
||||||
|
|
||||||
|
w4.m.colors._0 = .p0;
|
||||||
|
w4.m.colors._1 = .p1;
|
||||||
|
w4.m.colors._2 = .p3;
|
||||||
|
w4.m.colors._3 = .transparent;
|
||||||
|
|
||||||
|
w4.blit(&sprites.glaceon, 100, 128, sprites.glaceon_width, sprites.glaceon_height, flags);
|
||||||
|
|
||||||
w4.m.colors._0 = .transparent;
|
w4.m.colors._0 = .transparent;
|
||||||
w4.m.colors._1 = .p0;
|
w4.m.colors._1 = .p0;
|
||||||
w4.m.colors._2 = .p1;
|
w4.m.colors._2 = .p1;
|
||||||
w4.m.colors._3 = .p3;
|
w4.m.colors._3 = .p3;
|
||||||
|
|
||||||
var flags: w4.BlitFlags = w4.BlitFlags {
|
|
||||||
.two_bits = true,
|
|
||||||
};
|
|
||||||
|
|
||||||
if (mara_direction == Direction.Left) {
|
if (mara_direction == Direction.Left) {
|
||||||
flags.flip_x = true;
|
flags.flip_x = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,18 @@
|
||||||
const w4 = @import("./wasm4.zig");
|
const w4 = @import("./wasm4.zig");
|
||||||
|
|
||||||
|
pub fn mist() void {
|
||||||
|
w4.m.palette.* = .{
|
||||||
|
w4.Color{.blue = 0xc2, .green = 0xf0, .red = 0xc4},
|
||||||
|
//0xc4f0c2
|
||||||
|
w4.Color{.blue = 0xa8, .green = 0xb9, .red = 0x5a},
|
||||||
|
//0x5ab9a8
|
||||||
|
w4.Color{.blue = 0x6e, .green = 0x60, .red = 0x1e},
|
||||||
|
//0x1e606e
|
||||||
|
w4.Color{.blue = 0x00, .green = 0x1b, .red = 0x2d},
|
||||||
|
//0x2d1b00
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
pub fn orca() void {
|
pub fn orca() void {
|
||||||
w4.m.palette.* = .{
|
w4.m.palette.* = .{
|
||||||
w4.Color{.blue = 0xAF, .green = 0xB0, .red = 0xD9},
|
w4.Color{.blue = 0xAF, .green = 0xB0, .red = 0xD9},
|
||||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue