comparison game/js/monster.js @ 14:7fda634d15ad

adjustments to wave logic, tower pivot points
author ark
date 2026-10-19 22:50 +0200
parents 22b604680c5a
children
comparison
equal deleted inserted replaced
13:8df95050fc8b 14:7fda634d15ad
8 var cfg = MM.config; 8 var cfg = MM.config;
9 // share of the hop cycle spent in the air; the rest is the landing 9 // share of the hop cycle spent in the air; the rest is the landing
10 var AIR = 0.8; 10 var AIR = 0.8;
11 11
12 // a new monster of the given kind at the start of a route chosen by 12 // a new monster of the given kind at the start of a route chosen by
13 // the map's route weights 13 // the map's route weights. a boss takes the shortest route
14 function create(game, kind) { 14 function create(game, kind) {
15 var def = cfg.monster[kind]; 15 var def = cfg.monster[kind];
16 var mv = cfg.movement; 16 var mv = cfg.movement;
17 var map = game.map; 17 var map = game.map;
18 var speed = def.speed * (1 + mv.speed_variation * (2 * game.random() - 1)); 18 var speed = def.speed * (1 + mv.speed_variation * (2 * game.random() - 1));
19 var r = MM.util.pick(map.routeWeights(speed), game.random); 19 var r = def.boss ? map.shortestRoute() : MM.util.pick(map.routeWeights(speed), game.random);
20 var route = map.routes[r]; 20 var route = map.routes[r];
21 // sideways offsets at every wander_step along the route: a fixed 21 // sideways offsets at every wander_step along the route: a fixed
22 // lean plus a wandering part, together within the map's largest offset 22 // lean plus a wandering part, together within the map's largest offset
23 var lean = mv.lean * map.maxOffset * (2 * game.random() - 1); 23 var lean = mv.lean * map.maxOffset * (2 * game.random() - 1);
24 var wander = (1 - mv.lean) * map.maxOffset; 24 var wander = (1 - mv.lean) * map.maxOffset;