diff --git a/game/enemy/ai.rb b/game/enemy/ai.rb index 23d39cc..dacb1d4 100644 --- a/game/enemy/ai.rb +++ b/game/enemy/ai.rb @@ -19,6 +19,13 @@ class EnemyAI player_tile = [(player_x - 90) / 120, (player_y - 90) / 120].map(&:round) enemy_tile = [(@enemy.x - 90) / 120, (@enemy.y - 90) / 120].map(&:round) + # Don't pathfind if both player and enemy are in the starting room to make sure the player has a safe space to learn the mechanics. + start_room_tile = ($bus.get(:start_room_coords) || [0, 0]) + return if player_tile[0] > start_room_tile[0] - 1 && player_tile[0] < start_room_tile[0] + 3 && + player_tile[1] > start_room_tile[1] - 1 && player_tile[1] < start_room_tile[1] + 3 && + enemy_tile[0] > start_room_tile[0] - 1 && enemy_tile[0] < start_room_tile[0] + 3 && + enemy_tile[1] > start_room_tile[1] - 1 && enemy_tile[1] < start_room_tile[1] + 3 + return if $bus.get_all(:collides?, @enemy.rect)&.include?(:character) prop_in_tile = $bus.get(:prop_at, enemy_tile[0], enemy_tile[1]) diff --git a/game/props/handler.rb b/game/props/handler.rb index 19d383d..eb4c2e5 100644 --- a/game/props/handler.rb +++ b/game/props/handler.rb @@ -101,7 +101,7 @@ class PropsHandler tile = [(player_x - 90) / 120, (player_y - 90) / 120].map(&:round) torch = Torch.new(*tile) return if @grid[[tile[0], tile[1]]] # can't place if something is already there - return if $bus.get_all(:collides?, torch.rect).include?(:character) # can't place if colliding with player + return if $bus.get_all(:collides?, torch.collision_rect).include?(:character) # can't place if colliding with player return unless $bus.get(:consume, :torch, 1) add(torch) elsif selected_item == :radar @@ -109,7 +109,7 @@ class PropsHandler tile = [(player_x - 90) / 120, (player_y - 90) / 120].map(&:round) radar = Radar.new(*tile) return if @grid[[tile[0], tile[1]]] - return if $bus.get_all(:collides?, radar.rect).include?(:character) + return if $bus.get_all(:collides?, radar.collision_rect).include?(:character) return unless $bus.get(:consume, :radar, 1) add(radar) end @@ -141,7 +141,7 @@ class PropsHandler world_y = y * 120 + 90 screen_x = world_x - cam_x screen_y = world_y - cam_y - possible = !$bus.get_all(:collides?, [world_x - 20, world_y - 20, 40, 40]).include?(:character) + possible = !$bus.get_all(:collides?, [world_x - Prop::SIZE[0] / 2, world_y - Prop::SIZE[1], *Prop::SIZE]).include?(:character) color = possible ? Gosu::Color.new(255 * 0.7, 128, 239, 128) : Gosu::Color.new(255 * 0.7, 255, 116, 108) if selected_item == :torch Torch.ghost.draw(screen_x - 20, screen_y - 20, screen_y, 2, 2, color) diff --git a/game/traps/base.rb b/game/traps/base.rb new file mode 100644 index 0000000..e69de29 diff --git a/game/traps/event_horizon.rb b/game/traps/event_horizon.rb new file mode 100644 index 0000000..e69de29 diff --git a/game/traps/handler.rb b/game/traps/handler.rb new file mode 100644 index 0000000..e69de29 diff --git a/game/traps/landmine.rb b/game/traps/landmine.rb new file mode 100644 index 0000000..e69de29 diff --git a/game/traps/shrodingers_mine.rb b/game/traps/shrodingers_mine.rb new file mode 100644 index 0000000..e69de29 diff --git a/game/weapons/blade_of_recursion.rb b/game/weapons/blade_of_recursion.rb new file mode 100644 index 0000000..e69de29 diff --git a/game/weapons/lorentz_field.rb b/game/weapons/lorentz_field.rb new file mode 100644 index 0000000..0804db9 --- /dev/null +++ b/game/weapons/lorentz_field.rb @@ -0,0 +1,16 @@ +class LorentzField < Weapon + def initialize + super( + name: "Lorentz Field", + description: "A defensive weapon that creates a time distortion field around the user. While active, the field slows down incoming projectiles and enemies, giving the user a chance to react and evade. The field lasts for a short duration and has a cooldown period before it can be used again.", + image_path: "assets/images/lorentz_field.png", + cooldown: 5.0, + damage: 0, + range: 0, + area_of_effect: 0 + ) + end + + def activate(user) + end +end \ No newline at end of file diff --git a/game/weapons/occams_razor.rb b/game/weapons/occams_razor.rb new file mode 100644 index 0000000..e69de29 diff --git a/game/weapons/quantum_bow.rb b/game/weapons/quantum_bow.rb new file mode 100644 index 0000000..e69de29