summaryrefslogtreecommitdiffhomepage
path: root/app
diff options
context:
space:
mode:
authorarngo <[email protected]>2021-12-19 22:34:28 -0500
committerarngo <[email protected]>2021-12-19 22:34:33 -0500
commit561ac9574a5afc88ac762edc8892353e678b1117 (patch)
treeb14bed88b44f3e5731243aa83b3e930e83f99455 /app
parent0c2d73d8a43d8aab8f6549a738084a3f4d8549ce (diff)
downloadSteelWings-561ac9574a5afc88ac762edc8892353e678b1117.tar.gz
SteelWings-561ac9574a5afc88ac762edc8892353e678b1117.zip
implemented speed decay
Diffstat (limited to 'app')
-rw-r--r--app/components/rules/decay_speed.rb2
-rw-r--r--app/main.rb2
-rw-r--r--app/systems/rules/decay_speed.rb9
-rw-r--r--app/systems/start_game.rb1
4 files changed, 14 insertions, 0 deletions
diff --git a/app/components/rules/decay_speed.rb b/app/components/rules/decay_speed.rb
new file mode 100644
index 0000000..83a3938
--- /dev/null
+++ b/app/components/rules/decay_speed.rb
@@ -0,0 +1,2 @@
+FF::Cmp.new('DecaySpeed',
+ strength: 0.8)
diff --git a/app/main.rb b/app/main.rb
index 3bd54a2..d70958c 100644
--- a/app/main.rb
+++ b/app/main.rb
@@ -11,6 +11,7 @@ require 'app/components/rules/cohesion.rb'
require 'app/components/rules/alignment.rb'
require 'app/components/rules/separation.rb'
require 'app/components/rules/follow.rb'
+require 'app/components/rules/decay_speed.rb'
require 'app/components/debug/singleton_debug_vector_arrow.rb'
require 'app/components/singleton_camera.rb'
require 'app/components/stats/collision_damage.rb'
@@ -34,6 +35,7 @@ require 'app/systems/rules/alignment.rb'
require 'app/systems/rules/separation.rb'
require 'app/systems/rules/reset_change_vector.rb'
require 'app/systems/rules/follow.rb'
+require 'app/systems/rules/decay_speed.rb'
require 'app/systems/debug/debug_render_vector_arrow.rb'
require 'app/systems/camera.rb'
require 'app/systems/collision_damage.rb'
diff --git a/app/systems/rules/decay_speed.rb b/app/systems/rules/decay_speed.rb
new file mode 100644
index 0000000..490c7d0
--- /dev/null
+++ b/app/systems/rules/decay_speed.rb
@@ -0,0 +1,9 @@
+FF::Scn::BoidRules.add(
+ FF::Sys.new('DecaySpeed', priority: 50) do
+ FF::Cmp::DecaySpeed.each do |decay|
+ boid = decay.entities[0].components[FF::Cmp::Boid][0]
+ boid.vx *= decay.strength
+ boid.vy *= decay.strength
+ end
+ end
+)
diff --git a/app/systems/start_game.rb b/app/systems/start_game.rb
index 678100b..ed78339 100644
--- a/app/systems/start_game.rb
+++ b/app/systems/start_game.rb
@@ -44,6 +44,7 @@ FF::Sys.new('StartGame', priority: 50 ) do
FF::Cmp::SingletonPlayer[0],
FF::Cmp::Team.new(team: 'player'),
FF::Cmp::Weapon.new,
+ FF::Cmp::DecaySpeed.new(strength: 0.9),
)