diff options
| author | arngo <[email protected]> | 2022-01-25 23:10:35 -0500 |
|---|---|---|
| committer | arngo <[email protected]> | 2022-01-25 23:10:35 -0500 |
| commit | ee4ea2cdb16ee50028a63cc11d9a46eafa40f80a (patch) | |
| tree | 069bdc212a92817da39369d48bfa3b038f1d76a1 | |
| parent | 8ce7f2aee71ac457ecc0ff5202cc0364d1d0b6d4 (diff) | |
| download | orc-arena-of-time-ee4ea2cdb16ee50028a63cc11d9a46eafa40f80a.tar.gz orc-arena-of-time-ee4ea2cdb16ee50028a63cc11d9a46eafa40f80a.zip | |
level unloading
| -rw-r--r-- | src/levels.rb | 21 | ||||
| -rw-r--r-- | src/logic.rb | 8 |
2 files changed, 15 insertions, 14 deletions
diff --git a/src/levels.rb b/src/levels.rb index ef9cbae..abe67c5 100644 --- a/src/levels.rb +++ b/src/levels.rb @@ -9,8 +9,8 @@ level0 = { player_spawn: Rl::Vector2.new(120,300), scissor_size: Path.new( lambda do |time| - [300, - 300] + [250, + 250] end ), scissor_path: Path.new( @@ -75,16 +75,19 @@ FECS::Sys.new('ConstructLevel') do player_ent.component[FECS::Cmp::Player].moved = false FECS::Cmp::ScissorTime.first.time = 0 - # use current_level component to know which level from levels array to load - # create entities e.g. walls - # set properties for scissor box - # set properties for end goal zone - # move player to start end FECS::Sys.new('DestroyLevel') do - # delete all level specific entities and their components - # dont delete entities that carry over to next level + FECS::Cmp::Hitbox.reverse_each do |hitbox_cmp| + unless hitbox_cmp.entities.empty? + next if hitbox_cmp.entity.equal? @player + end + hitbox_cmp.delete + end + + FECS::Cmp::DamageHitbox.reverse_each do |hitbox_cmp| + hitbox_cmp.delete + end end # changing the level will destroy the current level and set up the next one diff --git a/src/logic.rb b/src/logic.rb index 0b5d1d6..b4fb3a1 100644 --- a/src/logic.rb +++ b/src/logic.rb @@ -67,11 +67,10 @@ FECS::Cmp::Sprite.new( dest_rec: Rl::Rectangle.new(0,0,448*2,336*2) ) -puts 'about to make rectangles' 4.times do |x| lancelot.frames.push Rl::Rectangle.new((24 * x), 24*2, 24, 24) end -puts 'finished making rectangles' +=begin MovingHitbox1 = FECS::Cmp::Hitbox.new( rec: Rl::Rectangle.new(150,50,35,150), offset_x: 0,#4*2, @@ -82,7 +81,6 @@ MovingHitbox2 = FECS::Cmp::Hitbox.new( offset_x: 0,#4*2, offset_y: 0#4*2 ) -=begin FECS::Cmp::Hitbox.new( rec: Rl::Rectangle.new(250,250,250,150), offset_x: 0,#4*2, @@ -207,8 +205,8 @@ FECS::Scn::Play.add( end, FECS::Sys.new('Walls') do - MovingHitbox1.rec.x = (Math.sin(Rl.time) * 300) + 250 + 50 - MovingHitbox2.rec.x = (Math.sin(Rl.time) * 300) + 150 + 50 + #MovingHitbox1.rec.x = (Math.sin(Rl.time) * 300) + 250 + 50 + #MovingHitbox2.rec.x = (Math.sin(Rl.time) * 300) + 150 + 50 player = FECS::Cmp::Player.first.entity player_hitbox = player.component[FECS::Cmp::Hitbox] |
