blob: 602f19c0c40fad72c537ab1e39a4f30a07f7d3bd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
FF::Scn::BoidRules.add(
FF::Sys.new('BoidBounds') do
FF::Cmp::BoidBounds.each do |boid_bounds|
boid = boid_bounds.entities[0].components[FF::Cmp::Boid][0]
if boid.x > boid_bounds.xmax
boid.cx -= boid_bounds.strength
elsif boid.x < boid_bounds.xmin
boid.cx += boid_bounds.strength
end
if boid.y > boid_bounds.ymax
boid.cy -= boid_bounds.strength
elsif boid.y < boid_bounds.ymin
boid.cy += boid_bounds.strength
end
end
end
)
|