try doing sprites better

Signed-off-by: Christine Dodrill <me@christine.website>
This commit is contained in:
Cadey Ratio 2022-07-01 11:06:47 -04:00
parent 45b6b7f185
commit e157638405
10 changed files with 48 additions and 16 deletions

View File

@ -5,7 +5,7 @@ set -ex
mkdir -p dist
rm -rf dist/*
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
w4 bundle \
--windows ./dist/tamamo.exe \

Binary file not shown.

Before

Width:  |  Height:  |  Size: 395 B

After

Width:  |  Height:  |  Size: 399 B

BIN
sprites/glaceon-4.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 651 B

BIN
sprites/glaceon.ase Normal file

Binary file not shown.

BIN
sprites/glaceon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 651 B

BIN
sprites/tamamotitle.ase Normal file

Binary file not shown.

BIN
sprites/tamamotitle.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -10,12 +10,12 @@ const Rect = sh0rk.Rect;
var frame_count: u32 = 0;
var mara_direction: Direction = Direction.Right;
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 screen = Rect{.base = Point{.x = 0, .y = 0}, .width = 160, .height = 160};
export fn start() void {
palette.tamtam();
palette.mist();
}
export fn update() void {
@ -24,11 +24,6 @@ export fn update() void {
w4.text("Mara 2:\nTamamo's Fury", 10, 10);
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;
@ -38,16 +33,16 @@ export fn update() void {
}
if (gamepad.up) {
mara_direction = Direction.Up;
mara_speed = 2;
mara_speed = 1;
} else if (gamepad.down) {
mara_direction = Direction.Down;
mara_speed = 2;
mara_speed = 1;
} else if (gamepad.left) {
mara_direction = Direction.Left;
mara_speed = 2;
mara_speed = 1;
} else if (gamepad.right) {
mara_direction = Direction.Right;
mara_speed = 2;
mara_speed = 1;
}
switch (mara_direction) {
@ -76,15 +71,29 @@ export fn update() void {
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._1 = .p0;
w4.m.colors._2 = .p1;
w4.m.colors._3 = .p3;
var flags: w4.BlitFlags = w4.BlitFlags {
.two_bits = true,
};
if (mara_direction == Direction.Left) {
flags.flip_x = true;
}

View File

@ -1,5 +1,18 @@
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 {
w4.m.palette.* = .{
w4.Color{.blue = 0xAF, .green = 0xB0, .red = 0xD9},

File diff suppressed because one or more lines are too long