diff options
| author | Alexander M Pickering <alex@cogarr.net> | 2025-01-26 15:21:55 -0600 |
|---|---|---|
| committer | Alexander M Pickering <alex@cogarr.net> | 2025-01-26 15:21:55 -0600 |
| commit | f7a6cb3573957ae617bf88a05f72cb22bb912abd (patch) | |
| tree | 9bd8dabfcbd5808a74d995c93dc6f3f611da13f8 /src/controllers/fish.moon | |
| parent | 5846a4fea8d6a993466a792977128d21a18587bc (diff) | |
| download | ggj25-f7a6cb3573957ae617bf88a05f72cb22bb912abd.tar.gz ggj25-f7a6cb3573957ae617bf88a05f72cb22bb912abd.tar.bz2 ggj25-f7a6cb3573957ae617bf88a05f72cb22bb912abd.zip | |
Revert "final commit"
This reverts commit c39ff632b46c179709101c5b50a061ebd723689f.
Diffstat (limited to 'src/controllers/fish.moon')
| -rw-r--r-- | src/controllers/fish.moon | 33 |
1 files changed, 4 insertions, 29 deletions
diff --git a/src/controllers/fish.moon b/src/controllers/fish.moon index dc3b1e9..9ba2d83 100644 --- a/src/controllers/fish.moon +++ b/src/controllers/fish.moon @@ -2,16 +2,12 @@ ecs = require("ecs") world = require("world") controller = {} - - - class FishControllerComponent extends ecs.Component new: () => --print("Fish controller started") @node = am.group! join: (entity) => super(entity) - @ent = entity graphic = entity\get("graphic") assert(graphic, "Fish controller must have a graphic") pred_component = entity\get("pred") @@ -31,7 +27,7 @@ class FishControllerComponent extends ecs.Component while comp.state == "swimming" comp.state = "waiting" start_wait = world.sync_time! - while world.sync_time! - start_wait < 8 + while world.sync_time! - start_wait < 4 --TODO: look for nearby hooks and get caught coroutine.yield! if comp.state == "waiting" @@ -45,33 +41,12 @@ class FishControllerComponent extends ecs.Component pick_next_location: () => -- Pick somewhere to swim based on where we are? -- This can only be done on the host. - --TODO: spawn fish on all sides. - -- everything has to be floats so math.random returns a float. if @net.properties.pos.x > 10 -- pick somewhere to the right @net.properties.next_loc = vec2( - math.random(11.1,15), - math.random(-10.1,10) - ) - elseif @net.properties.pos.x < -10 - @net.properties.next_loc = vec2( - math.random(-15.1,-11) - math.random(-10.1,10) + math.random(10.3,12), + math.random(-10,10) ) - elseif @net.properties.pos.y > 10 - @net.properties.next_loc = vec2( - math.random(-10.1,10) - math.random(11.1,15) - ) - elseif @net.properties.pos.y < -10 - @net.properties.next_loc = vec2( - math.random(-10.1,10) - math.random(-15.1,-11) - ) - else - --If none of these apply, we're stuck on land somehow, delete ourselves - @entity\destroy! - - @net.properties.next_loc_time = world.sync_time! + @net.properties.next_loc_time = world.sync_time! --@net.properties.next_loc = @net.properties.pos + vec2(0,1) --@net.properties.next_loc_time = world.sync_time! --print("Picking next location, it was ", @net.properties.next_loc) |
