aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--res/img/bullet.qoibin0 -> 54 bytes
-rw-r--r--res/img/pistol.qoibin0 -> 61 bytes
-rw-r--r--res/rooms/room_begin.tmj8
-rw-r--r--res/world.tiled-session16
-rwxr-xr-xsrc.binbin0 -> 5507120 bytes
-rw-r--r--src/assets.odin14
-rw-r--r--src/bullet.odin94
-rw-r--r--src/draw.odin (renamed from src/draw/draw.odin)39
-rw-r--r--src/draw/animation.odin86
-rw-r--r--src/draw/sprite.odin5
-rw-r--r--src/entity_list.odin6
-rw-r--r--src/input.odin9
-rw-r--r--src/main.odin16
-rw-r--r--src/phys/body.odin2
-rw-r--r--src/phys/world.odin13
-rw-r--r--src/platform.odin7
-rw-r--r--src/player.odin61
-rw-r--r--src/sprite.odin10
-rw-r--r--src/world.odin1
-rw-r--r--tools/compile_assets/aseprite/utils/sprite_sheet.odin2
20 files changed, 226 insertions, 163 deletions
diff --git a/res/img/bullet.qoi b/res/img/bullet.qoi
new file mode 100644
index 0000000..73c93b8
--- /dev/null
+++ b/res/img/bullet.qoi
Binary files differ
diff --git a/res/img/pistol.qoi b/res/img/pistol.qoi
new file mode 100644
index 0000000..df38c39
--- /dev/null
+++ b/res/img/pistol.qoi
Binary files differ
diff --git a/res/rooms/room_begin.tmj b/res/rooms/room_begin.tmj
index 2e1fe8b..ec4cba0 100644
--- a/res/rooms/room_begin.tmj
+++ b/res/rooms/room_begin.tmj
@@ -47,8 +47,8 @@
"type":"player_spawn",
"visible":true,
"width":0,
- "x":304,
- "y":128
+ "x":240,
+ "y":200
},
{
"height":48,
@@ -58,8 +58,8 @@
"type":"collision",
"visible":true,
"width":48,
- "x":288,
- "y":128
+ "x":0,
+ "y":0
}],
"opacity":1,
"type":"objectgroup",
diff --git a/res/world.tiled-session b/res/world.tiled-session
index 20c8558..ed64f3c 100644
--- a/res/world.tiled-session
+++ b/res/world.tiled-session
@@ -3,10 +3,10 @@
"height": 4300,
"width": 2
},
- "activeFile": "rooms/room_begin_secret_1.tmj",
+ "activeFile": "rooms/room_begin.tmj",
"expandedProjectPaths": [
- "rooms",
- "."
+ ".",
+ "rooms"
],
"fileStates": {
"room_begin.tmj": {
@@ -29,11 +29,11 @@
"expandedObjectLayers": [
2
],
- "scale": 3,
- "selectedLayer": 0,
+ "scale": 1.5,
+ "selectedLayer": 1,
"viewCenter": {
- "x": 465.66666666666663,
- "y": 131.83333333333331
+ "x": 328,
+ "y": 106.33333333333331
}
},
"rooms/room_begin_1.tmj": {
@@ -80,8 +80,8 @@
"recentFiles": [
"tileset.tsj",
"rooms/room_begin_1.tmj",
- "rooms/room_begin.tmj",
"rooms/room_begin_secret_1.tmj",
+ "rooms/room_begin.tmj",
"room_begin.tmj",
"room_begin_1.tmj"
],
diff --git a/src.bin b/src.bin
new file mode 100755
index 0000000..fcf3583
--- /dev/null
+++ b/src.bin
Binary files differ
diff --git a/src/assets.odin b/src/assets.odin
index 841c740..a9a4d36 100644
--- a/src/assets.odin
+++ b/src/assets.odin
@@ -9,8 +9,10 @@ package demonchime
import rl "vendor:raylib"
Image_Id :: enum {
+ BULLET,
PLAYER,
TILESETS,
+ PISTOL,
}
Animation_Id :: enum {
@@ -19,9 +21,9 @@ Animation_Id :: enum {
}
Room_Id :: enum {
- ROOM_BEGIN_SECRET_1,
ROOM_BEGIN,
ROOM_BEGIN_1,
+ ROOM_BEGIN_SECRET_1,
}
Tileset_Id :: enum {
@@ -41,19 +43,21 @@ Resource_Id :: union {
}
images: [Image_Id]Image_Resource = {
+ .BULLET = {data = #load("../res/img/bullet.qoi"), anim = .NONE},
.PLAYER = {data = #load("../.compiled-res/player-sheet.qoi"), anim = .PLAYER},
.TILESETS = {data = #load("../.compiled-res/tilesets.qoi"), anim = .NONE},
+ .PISTOL = {data = #load("../res/img/pistol.qoi"), anim = .NONE},
}
animations: [Animation_Id]Animation_Resource = {
.NONE = {frame_count=1, frame_durations={100}, tags={}},
- .PLAYER = {frame_count = 23, frame_durations = {100, 100, 100, 100, 100, 100, 75, 75, 75, 75, 75, 75, 75, 75, 100, 100, 100, 100, 100, 100, 100, 100, 100}, tags = {"jump_trans"={from = 16, to = 16}, "jump_down"={from = 17, to = 18}, "idle"={from = 0, to = 5}, "sleep"={from = 19, to = 22}, "jump_up"={from = 14, to = 15}, "run"={from = 6, to = 13}}},
+ .PLAYER = {frame_count = 23, frame_durations = {100, 100, 100, 100, 100, 100, 75, 75, 75, 75, 75, 75, 75, 75, 100, 100, 100, 100, 100, 100, 100, 100, 100}, tags = {"jump_trans"={from = 16, to = 16}, "sleep"={from = 19, to = 22}, "run"={from = 6, to = 13}, "idle"={from = 0, to = 5}, "jump_up"={from = 14, to = 15}, "jump_down"={from = 17, to = 18}}},
}
rooms: [Room_Id]Room_Resource = {
- .ROOM_BEGIN_SECRET_1 = {width=30, height=20, tile_width=16, tile_height=16, layers={{40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 27, 31, 31, 19, 31, 31, 28, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 21, 17, 0, 0, 0, 0, 0, 10, 19, 19, 31, 19, 31, 19, 28, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 27, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 27, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 41, 9, 18, 9, 18, 39, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 20, 9, 18, 9, 9, 9, 20, 20, 9, 18, 9, 39, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40}}, objects={}, background_image=nil},
- .ROOM_BEGIN = {width=30, height=20, tile_width=16, tile_height=16, layers={{40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 27, 31, 31, 19, 19, 28, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 21, 31, 31, 31, 11, 0, 0, 0, 0, 7, 40, 40, 40, 40, 40, 40, 40, 40, 27, 31, 19, 31, 19, 19, 19, 31, 19, 31, 19, 19, 17, 0, 0, 0, 0, 0, 0, 0, 0, 7, 40, 40, 40, 40, 21, 31, 31, 31, 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 40, 40, 21, 19, 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 40, 21, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 27, 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 41, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 32, 0, 0, 0, 0, 0, 0, 5, 9, 20, 9, 20, 20, 20, 18, 20, 20, 18, 18, 9, 18, 9, 18, 6, 0, 0, 0, 0, 0, 7, 32, 0, 0, 0, 0, 0, 0, 7, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 8, 0, 0, 0, 0, 0, 7, 11, 0, 0, 0, 0, 0, 0, 7, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 38, 9, 9, 18, 18, 9, 39, 0, 0, 0, 5, 9, 20, 9, 44, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 0, 0, 0, 7, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 20, 9, 18, 39, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40}}, objects={{type = .PLAYER_SPAWN, pos = {304, 128}, size = {0, 0}, parallax = {0, 0}, properties = {}}, {type = .COLLISION, pos = {288, 128}, size = {48, 48}, parallax = {0, 0}, properties = {}}, }, background_image=nil},
+ .ROOM_BEGIN = {width=30, height=20, tile_width=16, tile_height=16, layers={{40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 27, 31, 31, 19, 19, 28, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 21, 31, 31, 31, 11, 0, 0, 0, 0, 7, 40, 40, 40, 40, 40, 40, 40, 40, 27, 31, 19, 31, 19, 19, 19, 31, 19, 31, 19, 19, 17, 0, 0, 0, 0, 0, 0, 0, 0, 7, 40, 40, 40, 40, 21, 31, 31, 31, 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 40, 40, 21, 19, 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 40, 21, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 27, 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 41, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 32, 0, 0, 0, 0, 0, 0, 5, 9, 20, 9, 20, 20, 20, 18, 20, 20, 18, 18, 9, 18, 9, 18, 6, 0, 0, 0, 0, 0, 7, 32, 0, 0, 0, 0, 0, 0, 7, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 8, 0, 0, 0, 0, 0, 7, 11, 0, 0, 0, 0, 0, 0, 7, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 38, 9, 9, 18, 18, 9, 39, 0, 0, 0, 5, 9, 20, 9, 44, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 0, 0, 0, 7, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 20, 9, 18, 39, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40}}, objects={{type = .PLAYER_SPAWN, pos = {240, 200}, size = {0, 0}, parallax = {0, 0}, properties = {}}, {type = .COLLISION, pos = {0, 0}, size = {48, 48}, parallax = {0, 0}, properties = {}}, }, background_image=nil},
.ROOM_BEGIN_1 = {width=30, height=20, tile_width=16, tile_height=16, layers={{40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 27, 19, 31, 31, 19, 19, 31, 19, 19, 19, 19, 28, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 21, 19, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 31, 19, 28, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 27, 19, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 31, 28, 40, 40, 40, 40, 40, 40, 27, 31, 31, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 28, 40, 40, 40, 40, 27, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 28, 40, 40, 40, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 40, 40, 40, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 28, 40, 21, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 40, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 40, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 40, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 40, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 40, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 40, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 40, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 40, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 40, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 41, 18, 20, 20, 20, 20, 18, 9, 18, 9, 40, 38, 9, 18, 42, 0, 0, 0, 0, 0, 0, 0, 41, 9, 18, 18, 9, 18, 18, 20, 39, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 43, 20, 9, 18, 9, 18, 20, 9, 39, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40}}, objects={}, background_image=nil},
+ .ROOM_BEGIN_SECRET_1 = {width=30, height=20, tile_width=16, tile_height=16, layers={{40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 27, 31, 31, 19, 31, 31, 28, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 21, 17, 0, 0, 0, 0, 0, 10, 19, 19, 31, 19, 31, 19, 28, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 27, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 27, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 41, 9, 18, 9, 18, 39, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 20, 9, 18, 9, 9, 9, 20, 20, 9, 18, 9, 39, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40}}, objects={}, background_image=nil},
}
tilesets: [Tileset_Id]Tileset_Resource = {
@@ -162,6 +166,8 @@ path_to_id: map[string]Resource_Id = {
"res/rooms/room_begin.tmj" = Room_Id.ROOM_BEGIN,
"res/rooms/room_begin_1.tmj" = Room_Id.ROOM_BEGIN_1,
"res/img/player.ase" = Image_Id.PLAYER,
+ "res/img/bullet.qoi" = Image_Id.BULLET,
+ "res/img/pistol.qoi" = Image_Id.PISTOL,
"res/img/tilesets.png" = Image_Id.TILESETS,
}
diff --git a/src/bullet.odin b/src/bullet.odin
new file mode 100644
index 0000000..b26cc14
--- /dev/null
+++ b/src/bullet.odin
@@ -0,0 +1,94 @@
+package demonchime
+
+import "core:math"
+import "core:log"
+
+import "phys"
+
+Bullet :: struct {
+ handle: Entity_Handle,
+ body_handle: phys.Body_Handle,
+ sprite: Sprite,
+ lifetime: f32,
+}
+
+make_bullet :: proc(
+ pos: Vec2,
+ vel: Vec2,
+ lifetime: f32 = 5,
+ image_id := Image_Id.BULLET,
+ layers: bit_set[phys.Layer;u16] = {.PLAYER_PROJECTILE},
+ mask: bit_set[phys.Layer;u16] = {.DEFAULT},
+) -> (Entity_Handle, ^Bullet) {
+ sprite: Sprite
+ init_sprite(&sprite, image_id)
+
+ sprite.offset = {
+ math.round(f32(sprite.width) * 0.5),
+ math.round(f32(sprite.height) * 0.5),
+ }
+ sprite.rotation = math.atan2(vel.y, vel.x) * math.DEG_PER_RAD
+ sprite.pos = pos
+
+ body_rect := phys.Rect{
+ start = {-3, -3},
+ size = {6, 6},
+ }
+ body_handle, body := phys.make_body(body_rect, layers, mask)
+
+ body.vel = vel
+
+ phys.set_body_position(body_handle, pos)
+
+ return make_entity(&state.bullet_list, Bullet{
+ body_handle = body_handle,
+ sprite = sprite,
+ lifetime = lifetime,
+ })
+}
+
+delete_bullet :: proc(bullet_handle: Entity_Handle) {
+ bullet := get_entity(state.bullet_list, bullet_handle)
+
+ phys.remove_body(bullet.body_handle)
+ delete_entity(&state.platform_list, bullet.handle)
+}
+
+update_bullets :: proc(dt: f32) {
+ iter := iter_entity_list(state.bullet_list)
+ for bullet in entity_list_iter(&iter) {
+ bullet.lifetime -= dt
+
+ phys.update_body(bullet.body_handle)
+ body := phys.get_body(bullet.body_handle)
+
+ if body.collisions != {} || bullet.lifetime < 0 {
+ delete_entity(&state.bullet_list, bullet.handle)
+ }
+
+ bullet.sprite.pos = body.pos
+ }
+}
+
+draw_bullets :: proc() {
+ iter := iter_entity_list(state.bullet_list)
+ for bullet in entity_list_iter(&iter) {
+ draw_sprite(bullet.sprite)
+
+ body := phys.get_body(bullet.body_handle)
+ rect := body.rect
+ rect.start += body.pos
+ draw_rect(transmute(Rect)rect)
+ }
+}
+
+clear_bullets :: proc() {
+ iter := iter_entity_list(state.bullet_list)
+ for bullet in entity_list_iter(&iter) {
+ delete_bullet(bullet.handle)
+ }
+}
+
+on_room_open_bullets :: proc(room_id: Room_Id) {
+ clear_bullets()
+}
diff --git a/src/draw/draw.odin b/src/draw.odin
index 75071f3..2aa1257 100644
--- a/src/draw/draw.odin
+++ b/src/draw.odin
@@ -1,31 +1,22 @@
-package draw
+package demonchime
import "core:c"
import "core:math"
import rl "vendor:raylib"
-Vec2 :: [2]f32
-Vec3 :: [3]f32
-
-Rect :: struct {
- start: Vec2,
- size: Vec2,
-}
-
-Mat4 :: matrix[4, 4]f32
-
Color :: [4]f32
SCREEN_WIDTH :: 480
SCREEN_HEIGHT :: 320
+SCREEN_SIZE :: Vec2{SCREEN_WIDTH, SCREEN_HEIGHT}
renderer: struct {
screen: rl.RenderTexture2D,
tint: Color,
}
-@(private)
+@(private = "file")
_color_to_rl :: proc(col: Color) -> rl.Color {
return rl.Color {
u8(col.r * 255),
@@ -35,21 +26,21 @@ _color_to_rl :: proc(col: Color) -> rl.Color {
}
}
-init :: proc() {
+init_draw :: proc() {
renderer.screen = rl.LoadRenderTexture(SCREEN_WIDTH, SCREEN_HEIGHT)
renderer.tint = Color{1, 1, 1, 1}
}
-deinit :: proc() {
+deinit_draw :: proc() {
rl.UnloadRenderTexture(renderer.screen)
}
-new_frame :: proc() {
+draw_new_frame :: proc() {
rl.BeginTextureMode(renderer.screen)
rl.ClearBackground(_color_to_rl(Color{0.2, 0.2, 0.2, 1}))
}
-end_frame :: proc() {
+draw_end_frame :: proc() {
rl.EndTextureMode()
rl.BeginDrawing()
@@ -64,7 +55,7 @@ end_frame :: proc() {
(f32(rl.GetScreenHeight()) - (SCREEN_HEIGHT * scale)) / 2,
}
- texture_full(
+ draw_texture_full(
renderer.screen.texture,
screen_start,
scale = Vec2{scale, scale},
@@ -73,7 +64,7 @@ end_frame :: proc() {
rl.EndDrawing()
}
-rect :: proc(rect: Rect) {
+draw_rect :: proc(rect: Rect) {
assert(rect.size.x > 0 && rect.size.y > 0)
rl.DrawRectangle(
@@ -85,12 +76,12 @@ rect :: proc(rect: Rect) {
)
}
-texture :: proc {
- texture_full,
- texture_quad,
+draw_texture :: proc {
+ draw_texture_full,
+ draw_texture_quad,
}
-texture_quad :: proc(
+draw_texture_quad :: proc(
img: rl.Texture2D,
quad: Rect,
position: Vec2,
@@ -121,7 +112,7 @@ texture_quad :: proc(
)
}
-texture_full :: proc(
+draw_texture_full :: proc(
img: rl.Texture2D,
position: Vec2,
offset := Vec2{0, 0},
@@ -130,5 +121,5 @@ texture_full :: proc(
) {
size := Vec2{f32(img.width), -f32(img.height)}
- texture_quad(img, Rect{Vec2{0, 0}, size}, position, offset, rotation, scale)
+ draw_texture_quad(img, Rect{Vec2{0, 0}, size}, position, offset, rotation, scale)
}
diff --git a/src/draw/animation.odin b/src/draw/animation.odin
deleted file mode 100644
index a59fe5f..0000000
--- a/src/draw/animation.odin
+++ /dev/null
@@ -1,86 +0,0 @@
-package draw
-
-import "core:encoding/json"
-import "core:log"
-import "core:os"
-import "core:path/filepath"
-import "core:strings"
-
-FrameRect :: struct {
- x: i32 `json:"x"`,
- y: i32 `json:"y"`,
- w: i32 `json:"w"`,
- h: i32 `json:"h"`,
-}
-
-Frame :: struct {
- rect: FrameRect `json:"frame"`,
- duration: i32 `json:"duration"`,
-}
-
-Tag :: struct {
- name: string `json:"name"`,
- from: i32 `json:"from"`,
- to: i32 `json:"to"`,
- direction: string `json:"direction"`,
-}
-
-AnimationMeta :: struct {
- image_path: string `json:"image"`,
- frame_tags: []Tag `json:"frameTags"`,
- frame_tags_indices: map[string]u32,
-}
-
-Animation :: struct {
- frames: []Frame `json:"frames"`,
- using meta: AnimationMeta `json:"meta"`,
-}
-
-@(require_results)
-init_anim_data :: proc(anim: ^Animation, path: string) -> bool {
- data, ok := os.read_entire_file(path)
- if !ok {
- return false
- }
- defer delete(data)
-
- json_err := json.unmarshal(data, anim)
- if json_err != nil {
- log.error("could not unmarshal data")
- return false
- }
-
- for tag, i in anim.frame_tags {
- anim.frame_tags_indices[tag.name] = u32(i)
- }
-
- partial_img_path := anim.image_path
- defer delete(partial_img_path)
- anim_dir := filepath.dir(path)
- defer delete(anim_dir)
-
- anim.image_path = strings.concatenate({anim_dir, "/", partial_img_path})
-
- log.debugf("loaded animation '%v'", path)
-
- return true
-}
-
-delete_anim_data :: proc(anim: Animation) {
- delete(anim.frames)
-
- for tag in anim.frame_tags {
- delete(tag.name)
- delete(tag.direction)
- }
-
- // sg.destroy_image(anim.image)
-
- delete(anim.frame_tags)
- delete(anim.frame_tags_indices)
- delete(anim.image_path)
-}
-
-get_anim_tag :: proc(anim: Animation, tag_name: string) -> Tag {
- return anim.frame_tags[anim.frame_tags_indices[tag_name]]
-}
diff --git a/src/draw/sprite.odin b/src/draw/sprite.odin
deleted file mode 100644
index f7cd87b..0000000
--- a/src/draw/sprite.odin
+++ /dev/null
@@ -1,5 +0,0 @@
-package draw
-
-import "core:log"
-
-import rl "vendor:raylib"
diff --git a/src/entity_list.odin b/src/entity_list.odin
index ce69be8..3ee553e 100644
--- a/src/entity_list.odin
+++ b/src/entity_list.odin
@@ -48,7 +48,9 @@ delete_entity :: proc(list: ^Entity_List($T), handle: Entity_Handle) {
}
get_entity :: proc(list: Entity_List($T), h: Entity_Handle) -> ^T {
- if h.idx < 1 || h.idx >= len(list.items) || list.items[h.idx].handle == h {
+ if h.idx < 1 ||
+ h.idx >= u32(len(list.items)) ||
+ list.items[h.idx].handle != h {
return nil
}
return &list.items[h.idx]
@@ -61,7 +63,7 @@ active_entity_count :: proc(list: Entity_List($T)) -> int {
Entity_List_Iter :: struct($T: typeid) {
list: Entity_List(T),
- idx: int,
+ idx: int,
}
iter_entity_list :: proc(list: Entity_List($T)) -> Entity_List_Iter(T) {
diff --git a/src/input.odin b/src/input.odin
index 475be92..0b1d56e 100644
--- a/src/input.odin
+++ b/src/input.odin
@@ -18,6 +18,7 @@ actions: struct {
move_right: Keybind,
jump: Keybind,
dash: Keybind,
+ shoot: Keybind,
}
init_keybinds :: proc() {
@@ -25,6 +26,7 @@ init_keybinds :: proc() {
actions.move_right.input = .D
actions.jump.input = .SPACE
actions.dash.input = .LEFT_SHIFT
+ actions.shoot.input = rl.MouseButton.LEFT
}
is_keybind_down :: proc(keybind: Keybind) -> bool {
@@ -50,3 +52,10 @@ is_keybind_just_down :: proc(keybind: Keybind) -> bool {
assert(false)
return false
}
+
+get_mouse_pos :: proc() -> (mouse_pos: Vec2) {
+ mouse_pos = Vec2{f32(rl.GetMouseX()), f32(rl.GetMouseY())}
+ mouse_pos /= Vec2{f32(rl.GetScreenWidth()), f32(rl.GetScreenHeight())}
+ mouse_pos *= SCREEN_SIZE
+ return
+}
diff --git a/src/main.odin b/src/main.odin
index 8a528eb..1e3f8ba 100644
--- a/src/main.odin
+++ b/src/main.odin
@@ -11,7 +11,6 @@ import os "core:os/os2"
import rl "vendor:raylib"
-import "draw"
import "phys"
Vec2 :: [2]f32
@@ -24,6 +23,7 @@ Rect :: struct {
state: struct {
camera: rl.Camera2D,
platform_list: Entity_List(Platform),
+ bullet_list: Entity_List(Bullet),
}
logger: log.Logger
@@ -59,21 +59,23 @@ init :: proc() {
state.camera.zoom = 1
init_keybinds()
- draw.init()
+ init_draw()
init_player()
open_room(.ROOM_BEGIN)
}
frame :: proc() {
update_player(rl.GetFrameTime())
+ update_bullets(rl.GetFrameTime())
- draw.new_frame()
+ draw_new_frame()
rl.BeginMode2D(state.camera)
draw_player()
draw_room(current_room.id)
- draw_platforms()
+ draw_bullets()
+ // draw_platforms()
rl.EndMode2D()
@@ -84,12 +86,13 @@ frame :: proc() {
)
rl.DrawText(fps_text, 5, 5, 8, rl.GREEN)
- draw.end_frame()
+ draw_end_frame()
}
cleanup :: proc() {
- delete_player()
+ deinit_player()
delete_entity_list(state.platform_list)
+ delete_entity_list(state.bullet_list)
phys.destroy_world()
}
@@ -143,4 +146,3 @@ main :: proc() {
cleanup()
}
-
diff --git a/src/phys/body.odin b/src/phys/body.odin
index d568186..93d8623 100644
--- a/src/phys/body.odin
+++ b/src/phys/body.odin
@@ -13,6 +13,8 @@ Layer :: enum (u16) {
SOFT, // soft collisions; push away other bodies with a force
ENEMY, // enemy hitboxes
PLAYER, // player hitboxes
+ ENEMY_PROJECTILE,
+ PLAYER_PROJECTILE,
}
Collision_Type :: enum (u8) {
diff --git a/src/phys/world.odin b/src/phys/world.odin
index 5bbfcbd..7a56990 100644
--- a/src/phys/world.odin
+++ b/src/phys/world.odin
@@ -33,9 +33,9 @@ _hash_bin :: proc(x: i32, y: i32) -> u32 {
@(private = "file")
_world_to_bin :: proc(point: Vec2) -> (i32, i32) {
- return i32(
- math.floor(point.x / BIN_SIZE),
- ), i32(math.floor(point.y / BIN_SIZE))
+ return \
+ i32(math.floor(point.x / BIN_SIZE)),
+ i32(math.floor(point.y / BIN_SIZE))
}
@(private = "file")
@@ -85,8 +85,9 @@ _remove_from_bins :: proc(b: Body) {
last := pop(bin)
if last != b.handle {
// log.debug(last, b.handle)
- last_body := get_body(last)
bin[b.bin_idx] = last
+
+ last_body := get_body(last)
last_body.bin_idx = b.bin_idx
}
}
@@ -192,6 +193,10 @@ update_body :: proc(h: Body_Handle) {
c := get_body(c_h)
+ if b.mask & c.layers == {} {
+ continue
+ }
+
c_rect := c.rect
c_rect.start += c.pos
diff --git a/src/platform.odin b/src/platform.odin
index fc50923..b155905 100644
--- a/src/platform.odin
+++ b/src/platform.odin
@@ -1,6 +1,5 @@
package demonchime
-import "draw"
import "phys"
Platform :: struct {
@@ -15,12 +14,12 @@ make_platform :: proc(rect: Rect) -> (Entity_Handle, ^Platform) {
draw_platforms :: proc() {
iter := iter_entity_list(state.platform_list)
- draw.renderer.tint = {1, 0, 0, 0.25}
+ renderer.tint = {1, 0, 0, 0.25}
for p in entity_list_iter(&iter) {
body := phys.get_body(p.body)
- draw.rect(cast(draw.Rect)body.rect)
+ draw_rect(cast(Rect)body.rect)
}
- draw.renderer.tint = {1, 1, 1, 1}
+ renderer.tint = {1, 1, 1, 1}
}
clear_platforms :: proc() {
diff --git a/src/player.odin b/src/player.odin
index 7233278..c758f31 100644
--- a/src/player.odin
+++ b/src/player.odin
@@ -1,6 +1,10 @@
package demonchime
import "core:math"
+import "core:math/linalg"
+import "core:log"
+
+import rl "vendor:raylib"
import "phys"
@@ -16,6 +20,9 @@ PLAYER_DASH_SPEED :: 500
PLAYER_DASH_TIME :: 0.15
PLAYER_DASH_COOLDOWN :: 0.3
+PLAYER_GUN_HEIGHT :: 7
+PLAYER_GUN_DIST :: 5 // how far out to hold the gun
+
Player_State :: enum {
DEFAULT,
DASH,
@@ -25,6 +32,7 @@ Player_State :: enum {
player: struct {
body_handle: phys.Body_Handle,
sprite: Sprite,
+ gun_sprite: Sprite,
jump_buffer: f32,
coyote_time: f32,
dash_cooldown: f32,
@@ -35,7 +43,11 @@ player: struct {
}
init_player :: proc() {
- handle, body := phys.make_body(phys.Rect{{-4, 17}, {8, 16}})
+ handle, body := phys.make_body(
+ phys.Rect{{-4, -16}, {8, 16}},
+ layers = {.PLAYER},
+ mask = {.DEFAULT}
+ )
player.body_handle = handle
phys.set_body_position(handle, Vec2{50, 100})
@@ -44,14 +56,19 @@ init_player :: proc() {
player.sprite.offset = Vec2 {
math.floor(f32(player.sprite.width / 2)),
- -f32(player.sprite.height),
+ f32(player.sprite.height),
+ }
+
+ init_sprite(&player.gun_sprite, .PISTOL)
+
+ player.gun_sprite.offset = Vec2 {
+ -PLAYER_GUN_DIST,
+ math.round(f32(player.gun_sprite.height / 2)),
}
}
-delete_player :: proc() {
+deinit_player :: proc() {
phys.remove_body(player.body_handle)
-
- destroy_sprite(player.sprite)
}
@(private = "file")
@@ -74,7 +91,6 @@ _default_state :: proc(dt: f32) {
if input != 0 {
set_sprite_active_tag(&player.sprite, "run")
- player.sprite.scale.x = math.sign(input)
} else {
set_sprite_active_tag(&player.sprite, "idle")
}
@@ -104,6 +120,27 @@ _default_state :: proc(dt: f32) {
}
}
+ rel_mouse_pos := get_mouse_pos() - body.pos
+
+ if is_keybind_just_down(actions.shoot) {
+ mouse_dir := linalg.normalize0(rel_mouse_pos)
+
+ bullet_pos := body.pos
+ bullet_pos.y -= PLAYER_GUN_HEIGHT
+ bullet_pos += mouse_dir * PLAYER_GUN_DIST
+
+ make_bullet(
+ bullet_pos,
+ mouse_dir * 200,
+ )
+
+ // `make_bullet()` adds a new physics body, which could invalidate the
+ // pointer to our body when the body array reallocs
+ body = phys.get_body(player.body_handle)
+ }
+
+ player.sprite.scale.x = math.sign(rel_mouse_pos.x)
+
if player.jump_buffer > 0 {
if player.coyote_time > 0 {
body.vel.y = -PLAYER_JUMP_FORCE
@@ -184,6 +221,7 @@ _change_rooms :: proc() {
new_room_pos := Vec2{f32(current_room.x), f32(current_room.y)}
diff := prev_room_pos - new_room_pos
+ body = phys.get_body(player.body_handle)
new_pos := body.pos + diff - {0, 0}
phys.set_body_position(player.body_handle, new_pos)
}
@@ -201,6 +239,16 @@ update_player :: proc(dt: f32) {
player.sprite.pos = body.pos
update_sprite(&player.sprite, dt)
+ player.gun_sprite.pos = body.pos - Vec2{0, PLAYER_GUN_HEIGHT}
+
+ mouse_dir := get_mouse_pos() - player.gun_sprite.pos
+ player.gun_sprite.rotation = math.atan2(
+ mouse_dir.y,
+ mouse_dir.x,
+ ) * math.DEG_PER_RAD
+
+ player.gun_sprite.scale.y = -1 if mouse_dir.x < 0 else 1
+
player.dash_cooldown -= dt
player.jump_buffer -= dt
player.coyote_time -= dt
@@ -210,6 +258,7 @@ update_player :: proc(dt: f32) {
draw_player :: proc() {
draw_sprite(player.sprite)
+ draw_sprite(player.gun_sprite)
}
@(private = "file")
diff --git a/src/sprite.odin b/src/sprite.odin
index 549373b..ab7df6e 100644
--- a/src/sprite.odin
+++ b/src/sprite.odin
@@ -4,8 +4,6 @@ import "core:log"
import rl "vendor:raylib"
-import "draw"
-
Sprite :: struct {
image: rl.Texture2D,
anim_id: Animation_Id,
@@ -45,10 +43,6 @@ init_sprite :: proc(
return true
}
-destroy_sprite :: proc(sprite: Sprite) {
- rl.UnloadTexture(sprite.image)
-}
-
set_sprite_active_tag :: proc(sprite: ^Sprite, tag_name: string) {
anim := animations[sprite.anim_id]
sprite.current_tag = anim.tags[tag_name]
@@ -81,12 +75,12 @@ update_sprite :: proc(sprite: ^Sprite, dt: f32) {
}
draw_sprite :: proc(sprite: Sprite) {
- rect := draw.Rect {
+ rect := Rect {
{f32(sprite.width * sprite.current_frame), 0},
{f32(sprite.width), f32(sprite.height)},
}
- draw.texture_quad(
+ draw_texture(
sprite.image,
rect,
sprite.pos,
diff --git a/src/world.odin b/src/world.odin
index f16852a..d6f611e 100644
--- a/src/world.odin
+++ b/src/world.odin
@@ -14,6 +14,7 @@ object_spawners := [Object_Type]Object_Spawner{
room_open_cb := []Room_Change_Callback{
on_room_open_platforms,
+ on_room_open_bullets,
}
room_close_cb := []Room_Change_Callback{
diff --git a/tools/compile_assets/aseprite/utils/sprite_sheet.odin b/tools/compile_assets/aseprite/utils/sprite_sheet.odin
index ceb4b76..482db47 100644
--- a/tools/compile_assets/aseprite/utils/sprite_sheet.odin
+++ b/tools/compile_assets/aseprite/utils/sprite_sheet.odin
@@ -260,7 +260,7 @@ find_min_sprite_size :: proc(info: Info, make_square := true) -> (res: [2]int) {
draw_sheet_grid :: proc(sheet: ^Sprite_Sheet, colour: [4]u8) {
- draw_sheet_spacing(sheet, colour, true)
+ draw_sheet_spacing(sheet, colour, true)
}