diff options
| author | Alexander M Pickering <alex@cogarr.net> | 2025-01-26 14:31:52 -0600 |
|---|---|---|
| committer | Alexander M Pickering <alex@cogarr.net> | 2025-01-26 14:31:52 -0600 |
| commit | c39ff632b46c179709101c5b50a061ebd723689f (patch) | |
| tree | 23060311477b996cd11c50851e7dfb889d339346 /src/world.moon | |
| parent | c1030d5ddbf34b1b19fa7fd169f3cf5a7b7f98f3 (diff) | |
| download | ggj25-c39ff632b46c179709101c5b50a061ebd723689f.tar.gz ggj25-c39ff632b46c179709101c5b50a061ebd723689f.tar.bz2 ggj25-c39ff632b46c179709101c5b50a061ebd723689f.zip | |
final commit
Diffstat (limited to 'src/world.moon')
| -rw-r--r-- | src/world.moon | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/world.moon b/src/world.moon index 60cb57b..d622351 100644 --- a/src/world.moon +++ b/src/world.moon @@ -68,6 +68,18 @@ x.fromscreen = (pos) -> vec2(globalx, globaly) x.level.on_land = (pos) -> not (pos.x > 10 or pos.x < -10 or pos.y > 10 or pos.y < -10) +x.level.in_sea = (pos) -> + pos.x > 15 or pos.x < -15 or pos.y > 15 or pos.y < -15 +-- Each pixel is 4 bytes, 1 byte per channel +x.level.bubble_buffer = am.buffer(1024 * 4 * 4, "dynamic") + +bubble_view = x.level.bubble_buffer\view("vec4") -- xy location, w time? +bubble_texture = am.texture2d(am.image_buffer(x.level.bubble_buffer, 1024 * 4, 1)) +class Bubble + @wrap = 1 + new: (pos) => + bubble_view[@@wrap] = vec4(pos.x, pos.y, -1, am.current_time!) + print("Bubble created") class PhysicsComponent extends ecs.Component new: (name, properties, shape, args) => @@ -90,7 +102,6 @@ class PhysicsComponent extends ecs.Component collisions: () => x.level.physics_world\collisions(@shape) - class GraphicsComponent extends ecs.Component new: (name, properties) => print("Got name", name, "and properties", properties) @@ -109,7 +120,7 @@ class GraphicsComponent extends ecs.Component 1, 0, 0, 0, 0, aspect, 0, 0, 0, 0, 1, 0, - 0, 0, 0, 4 + 0, 0, 0, 3.5 ) binds = { MV: s_mv @@ -123,6 +134,7 @@ class GraphicsComponent extends ecs.Component world_y: x.world_y rot: 0 water: 0 + --bubbles: bubble_texture } for color, value in pairs(color.am_color) binds[color] = value @@ -175,4 +187,5 @@ class GraphicsComponent extends ecs.Component x.GraphicsComponent = GraphicsComponent x.PhysicsComponent = PhysicsComponent +x.Bubble = Bubble x |
