summaryrefslogtreecommitdiffhomepage
path: root/run.rb
diff options
context:
space:
mode:
Diffstat (limited to 'run.rb')
-rw-r--r--run.rb28
1 files changed, 16 insertions, 12 deletions
diff --git a/run.rb b/run.rb
index 4e3a080..e836681 100644
--- a/run.rb
+++ b/run.rb
@@ -6,7 +6,7 @@ require 'felflame'
# change values here to see a change in the simulation
FF::Cmp.new('SingletonConfig',
# Show vectors
- debug: true,
+ debug: false,
# If the camera should follow the "center mass"
follow: false,
@@ -19,7 +19,7 @@ FF::Cmp.new('SingletonConfig',
# Higher is stronger
bounds_strength: 1.0,
# What the bounds are
- xmax: 480.0, xmin: -580.0,
+ xmax: 450.0, xmin: -580.0,
ymax: 250.0, ymin: -340.0,
# How much the boids try to pull together
@@ -28,17 +28,17 @@ FF::Cmp.new('SingletonConfig',
# How much the boids push away from eachother
# Smaller is stronger
- seperation: 375.0,
+ seperation: 60.0,
# What the range of seperating should be
- seperation_distance: 150.0,
+ seperation_distance: 50.0,
# How strong their vector alignment should be
# Smaller is stronger
alignment: 1000.0,
- # How much they try to follow their target(your mouse cursor)
- # Smaller is stronger
- target_strength: 2500.0,
+ # How much they try to follow their target
+ # Larger is strongzer
+ target_strength: 500.0,
# These are later set by the mouse position
target_x: 0, target_y: 0)
@@ -54,7 +54,7 @@ Dir[File.join(__dir__, 'lib/**', '*.rb')].sort.each { |file| require file }
FF::Scn::BoidCalculations.add FF::Sys::Cohesion
#FF::Scn::BoidCalculations.add FF::Sys::Alignment
FF::Scn::BoidCalculations.add FF::Sys::Seperation
-#FF::Scn::BoidCalculations.add FF::Sys::Target
+FF::Scn::BoidCalculations.add FF::Sys::Target
FF::Scn::BoidCalculations.add FF::Sys::Bounds
FF::Stg.add FF::Scn::BoidCalculations
@@ -64,12 +64,12 @@ class GameWindow < Ruby2D::Window
super
Camera::Image.new('assets/Background.png', x: -get(:width)+57, y: -get(:height)+97, z: -99)
randspot = ((-get(:height) / 2)..(get(:height)/2)).to_a
- 7.times do
+ 50.times do
Fish.create(randspot.sample.to_f, randspot.sample.to_f)
end
- 2.times do
- Piranha.create(randspot.sample.to_f, randspot.sample.to_f)
- end
+ #2.times do
+ # Piranha.create(randspot.sample.to_f, randspot.sample.to_f)
+ #end
unless $config.debug
FF::Cmp::BoidVisuals.each do |boid|
boid.vect.remove
@@ -80,6 +80,9 @@ class GameWindow < Ruby2D::Window
def update
$config.target_x = Camera.coordinate_to_worldspace(get(:mouse_x), get(:mouse_y))[0]
$config.target_y = Camera.coordinate_to_worldspace(get(:mouse_y), get(:mouse_y))[1]
+ if key_down('space')
+ Piranha.create($config.target_x, $config.target_y)
+ end
FF::Stage.call
Camera.y += 1 if key_held('s')
Camera.y -= 1 if key_held('w')
@@ -90,6 +93,7 @@ class GameWindow < Ruby2D::Window
end
def render
+ puts get(:fps)
end
end