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/systems/start_game.rb | |
| 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/systems/start_game.rb')
| -rw-r--r-- | app/systems/start_game.rb | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/app/systems/start_game.rb b/app/systems/start_game.rb index 4657e77..4d6289e 100644 --- a/app/systems/start_game.rb +++ b/app/systems/start_game.rb @@ -1,6 +1,5 @@ FF::Sys.new('StartGame', priority: 50 ) do - thing = FF::Cmp::SingletonTitle[0].entities.clone - thing.each do |entity| + FF::Cmp::SingletonTitle[0].entities.reverse_each do |entity| entity.components[FF::Cmp::Sprite][0].delete if (!entity.components[FF::Cmp::Button].nil? && !entity.components[FF::Cmp::Hitbox].nil?) entity.components[FF::Cmp::Hitbox][0].delete @@ -9,17 +8,17 @@ FF::Sys.new('StartGame', priority: 50 ) do entity.delete end - FF::Cmp::SingletonTitle[0].title_screen = false - FF::Stg.remove FF::Scn::TitleScreen + #FF::Cmp::SingletonTitle[0].title_screen = false + #FF::Stg.remove FF::Scn::TitleScreen - debug_arrow = FF::Cmp::SingletonDebugVectorArrow.new(length: 5) + debug_arrow = FF::Cmp::SingletonDebugVectorArrow[0] position = [ {x: 100, y: 100}, {x: 500, y: 500}, {x: 700, y: 200}, {x: 150, y: 250}, ] - position_range = (100..700).to_a + position_range = (500..1000).to_a sprite = FF::Cmp::Sprite.new sprite.props[:path] = 'sprites/background.png' @@ -28,9 +27,9 @@ FF::Sys.new('StartGame', priority: 50 ) do FF::Cmp::SingletonCamera[0], FF::Cmp::Boid.new(h: 1920 * 2, w: 1920 * 2) ) - #15.times do |pos| - # Factory::Osprey.new(x: position_range.sample, y: position_range.sample) - #end + 8.times do |pos| + Factory::SampleEnemy.new(x: position_range.sample, y: position_range.sample) + end sprite = FF::Cmp::Sprite.new sprite.props[:path] = [ @@ -40,10 +39,11 @@ FF::Sys.new('StartGame', priority: 50 ) do 'sprites/kenny/Ships/Grosbeak.png', ].sample FF::Ent.new( - FF::Cmp::Boid.new(x: position_range.sample, y: position_range.sample, vx: 25, vy: 25, w: 32, h: 32), + FF::Cmp::Boid.new(x: 0, y: 0, vx: 25, vy: 25, w: 32, h: 32), sprite, debug_arrow, FF::Cmp::SingletonCamera[0], + FF::Cmp::SingletonMoveCamera[0], FF::Cmp::BoidBounds.new, FF::Cmp::Follow.new(target: :mouse, strength: 0.007), FF::Cmp::SingletonPlayer[0], @@ -51,6 +51,9 @@ FF::Sys.new('StartGame', priority: 50 ) do FF::Cmp::Weapon.new, FF::Cmp::BoidMinimumSpeed.new(speed: 5), FF::Cmp::DecaySpeed.new(strength: 0.8), + FF::Cmp::Hp.new(health: 100), + FF::Cmp::CollisionDamage.new(damage: 100), + FF::Cmp::Hitcircle.new(r: 32), ) @@ -59,7 +62,6 @@ FF::Sys.new('StartGame', priority: 50 ) do FF::Scn::BoidRules, FF::Scn::Camera, FF::Scn::Cleanup, - FF::Scn::Debug, ) FF::Scn::Debug.add(FF::Sys::DebugRenderVectorArrow) |
