-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflock.p8
50 lines (46 loc) · 1.39 KB
/
flock.p8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
pico-8 cartridge // http://www.pico-8.com
version 33
__lua__
function _init()
flock = {}
for i=0,20,1 do
add_new_boid()
end
end
function _draw()
cls()
for f in all(flock) do
f:draw()
end
end
function _update()
for f in all(flock) do
f:update()
end
end
-->8
function add_new_boid()
add(flock,
{
pos = {x = 63, y = 63},
vel = {x = rnd(0.2), y = -0.0001},
acc = {x = 0, y = 0},
draw = function(self)
circfill(self.pos.x, self.pos.y, 1, 2)
end,
update = function(self)
self.pos.x += self.vel.x
self.pos.y += self.vel.y
self.vel.x += self.acc.x
self.vel.y += self.vel.y
end
}
)
end
__gfx__
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00700700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00077000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00077000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00700700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000