LordXido commited on
Commit
df80484
·
verified ·
1 Parent(s): 816d7cb

Update agents.js

Browse files
Files changed (1) hide show
  1. agents.js +13 -6
agents.js CHANGED
@@ -1,9 +1,16 @@
1
- let agents=[];
 
 
 
 
2
 
3
- export function spawnAgent(){
4
- agents.push({x:Math.random(),y:Math.random(),energy:1});
5
- }
6
 
7
- export function updateAgents(){
8
- agents.forEach(a=>a.energy*=0.999);
 
 
 
9
  }
 
1
+ // agents.js — v9.2
2
+ export class Agents {
3
+ constructor() {
4
+ this.list = [];
5
+ }
6
 
7
+ spawn(type = "observer") {
8
+ this.list.push({ type, t: 0 });
9
+ }
10
 
11
+ update(dt) {
12
+ for (const a of this.list) {
13
+ a.t += dt;
14
+ }
15
+ }
16
  }