diff options
| author | Arnold <[email protected]> | 2021-12-26 18:39:15 -0500 |
|---|---|---|
| committer | GitHub <[email protected]> | 2021-12-26 18:39:15 -0500 |
| commit | b7dea8016b5b1328808e28b76cc12343907de63e (patch) | |
| tree | 5339c23bbde03c4d6c8c79d96b2033ab9e838ec0 /app/factories | |
| parent | f70283e5ad5f5a5744ca0695a184f72f88803aca (diff) | |
| download | SteelWings-b7dea8016b5b1328808e28b76cc12343907de63e.tar.gz SteelWings-b7dea8016b5b1328808e28b76cc12343907de63e.zip | |
implement ai randomizer, gameover screen, and other bug fixes
* Cleaned up factory. Fixed most bugs with death(last bug should be with move camera).
* check if player entity is nil before shooting or moving camera
* implement ai randomizer
* separate button click detection to new system
* implement gameover screen with button to return to menu
* use reverse_each instead of cloning
Co-authored-by: realtradam <[email protected]>
Diffstat (limited to 'app/factories')
| -rw-r--r-- | app/factories/ships/osprey.rb | 34 | ||||
| -rw-r--r-- | app/factories/ships/sample_enemy.rb | 48 |
2 files changed, 48 insertions, 34 deletions
diff --git a/app/factories/ships/osprey.rb b/app/factories/ships/osprey.rb deleted file mode 100644 index e371e60..0000000 --- a/app/factories/ships/osprey.rb +++ /dev/null @@ -1,34 +0,0 @@ -class Factory - class Osprey - def self.new(x: x, y: y) - sprite = FF::Cmp::Sprite.new - sprite.props[:path] = [ - 'sprites/kenny/Ships/WeebillGrey.png', - 'sprites/kenny/Ships/BuntingGrey.png', - 'sprites/kenny/Ships/NighthawkGrey.png', - 'sprites/kenny/Ships/MagpieGrey.png', - 'sprites/kenny/Ships/WaxwingGrey.png', - 'sprites/kenny/Ships/LongspurGrey.png', - 'sprites/kenny/Ships/WarblerGrey.png', - 'sprites/kenny/Ships/NutcrackerGrey.png', - ].sample - FF::Ent.new( - FF::Cmp::Boid.new(x: x, y: y, vx: -3, vy: -3, w: 32, h: 32), - sprite, - FF::Cmp::BoidBounds.new(strength: 0.6), - FF::Cmp::BoidsAlignment.new(strength: 10), - FF::Cmp::BoidsSeparation.new(distance: 150, strength: 0.001), - FF::Cmp::BoidsCohesion.new(strength: 1000), - FF::Cmp::Hp.new(health: 100), - FF::Cmp::CollisionDamage.new(damage: 100), - FF::Cmp::Hitcircle.new(r: 12), - FF::Cmp::BoidMinimumSpeed.new(speed: 3), - FF::Cmp::DecaySpeed.new(strength: 0.9), - FF::Cmp::Team.new, - #FF::Cmp::SingletonDebugVectorArrow[0], - FF::Cmp::SingletonCamera[0], - ) - end - end -end - diff --git a/app/factories/ships/sample_enemy.rb b/app/factories/ships/sample_enemy.rb new file mode 100644 index 0000000..a2a3a21 --- /dev/null +++ b/app/factories/ships/sample_enemy.rb @@ -0,0 +1,48 @@ +class Factory + class SampleEnemy + def self.defaults + @defaults ||= { + boid_bounds_strength: 0.6, + boids_alignment_strength: 0.005, + boids_seperation_strength: 0.005, + boids_seperation_distance: 50, + boids_cohesion_strength: 0.003, + hp_health: 100, + collision_damage_damage: 100, + hitcircle_r: 12, + boid_minimum_speed_speed: 5, + decay_speed_multiplier: 0.9, + } + end + def self.new(x: 0, y: 0, vx: -3, vy: -3) + sprite = FF::Cmp::Sprite.new + sprite.props[:path] = [ + 'sprites/kenny/Ships/WeebillGrey.png', + 'sprites/kenny/Ships/BuntingGrey.png', + 'sprites/kenny/Ships/NighthawkGrey.png', + 'sprites/kenny/Ships/MagpieGrey.png', + 'sprites/kenny/Ships/WaxwingGrey.png', + 'sprites/kenny/Ships/LongspurGrey.png', + 'sprites/kenny/Ships/WarblerGrey.png', + 'sprites/kenny/Ships/NutcrackerGrey.png', + ].sample + FF::Ent.new( + FF::Cmp::Boid.new(x: x, y: y, vx: vx, vy: vy, w: 32, h: 32), + sprite, + FF::Cmp::BoidBounds.new(strength: self.defaults[:boid_bounds_strength]), + FF::Cmp::BoidsAlignment.new(strength: self.defaults[:boids_alignment_strength]), + FF::Cmp::BoidsSeparation.new(distance: self.defaults[:boids_seperation_distance], strength: self.defaults[:boids_seperation_strength]), + FF::Cmp::BoidsCohesion.new(strength: self.defaults[:boids_cohesion_strength]), + FF::Cmp::Hp.new(health: self.defaults[:hp_health]), + FF::Cmp::CollisionDamage.new(damage: self.defaults[:collision_damage_damage]), + FF::Cmp::Hitcircle.new(r: self.defaults[:hitcircle_r]), + FF::Cmp::BoidMinimumSpeed.new(speed: self.defaults[:boid_minimum_speed_speed]), + FF::Cmp::DecaySpeed.new(strength: self.defaults[:decay_speed_multiplier]), + FF::Cmp::Team.new, + FF::Cmp::SingletonDebugVectorArrow[0], + FF::Cmp::SingletonCamera[0], + ) + end + end +end + |
