mirror of
https://github.com/cyberarm/i-mic-rts.git
synced 2025-12-15 15:52:34 +00:00
Added refinery and war_factory definitions
This commit is contained in:
@@ -1,15 +1,32 @@
|
|||||||
IMICRTS::Entity.define_entity(:power_plant, :building, 800, "Generates power") do |entity|
|
IMICRTS::Entity.define_entity(:power_plant, :building, 800, "Generates power") do |entity|
|
||||||
entity.radius = 14
|
entity.radius = 24
|
||||||
entity.max_health = 100.0
|
entity.max_health = 100.0
|
||||||
|
|
||||||
entity.body_image = "vehicles/power_plant/images/power_plant.png"
|
entity.body_image = "buildings/power_plant/power_plant.png"
|
||||||
entity.shell_image = "vehicles/power_plant/images/power_plant.png"
|
entity.shell_image = "buildings/power_plant/power_plant_shell.png"
|
||||||
|
entity.overlay_image = "buildings/power_plant/power_plant_overlay.png"
|
||||||
|
|
||||||
|
position = entity.position.clone
|
||||||
|
position.z = IMICRTS::ZOrder::OVERLAY
|
||||||
|
emitters = []
|
||||||
|
|
||||||
|
p1 = position.clone
|
||||||
|
p1.y -= 14
|
||||||
|
p2 = p1.clone
|
||||||
|
p2.y += 40
|
||||||
|
|
||||||
|
emitters.push(p1, p2)
|
||||||
|
|
||||||
|
|
||||||
|
emitters.each do |pos|
|
||||||
|
entity.particle_emitters << IMICRTS::SmokeEmitter.new(position: pos)
|
||||||
|
end
|
||||||
|
|
||||||
entity.on_tick do
|
entity.on_tick do
|
||||||
entity.produce_power
|
# entity.produce_power
|
||||||
end
|
end
|
||||||
|
|
||||||
define_singleton_method(:produce_power) do
|
# define_singleton_method(:produce_power) do
|
||||||
@player.power += 10
|
# @player.power += 10
|
||||||
end
|
# end
|
||||||
end
|
end
|
||||||
|
|||||||
20
lib/entities/buildings/refinery.rb
Normal file
20
lib/entities/buildings/refinery.rb
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
IMICRTS::Entity.define_entity(:refinery, :building, 1_400, "Generates credits") do |entity|
|
||||||
|
entity.radius = 44
|
||||||
|
entity.max_health = 100.0
|
||||||
|
|
||||||
|
entity.body_image = "buildings/refinery/refinery.png"
|
||||||
|
entity.shell_image = "buildings/refinery/refinery_shell.png"
|
||||||
|
entity.overlay_image = "buildings/refinery/refinery_overlay.png"
|
||||||
|
|
||||||
|
position = entity.position.clone
|
||||||
|
position.z = IMICRTS::ZOrder::OVERLAY
|
||||||
|
|
||||||
|
p1 = position.clone
|
||||||
|
p1.x += 2
|
||||||
|
p1.y += 12
|
||||||
|
|
||||||
|
entity.particle_emitters << IMICRTS::SmokeEmitter.new(position: p1)
|
||||||
|
|
||||||
|
entity.on_tick do
|
||||||
|
end
|
||||||
|
end
|
||||||
22
lib/entities/buildings/war_factory.rb
Normal file
22
lib/entities/buildings/war_factory.rb
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
IMICRTS::Entity.define_entity(:war_factory, :building, 2_000, "Generates credits") do |entity|
|
||||||
|
entity.radius = 48
|
||||||
|
entity.max_health = 100.0
|
||||||
|
|
||||||
|
entity.shell_image = "buildings/war_factory/war_factory_shell.png"
|
||||||
|
entity.overlay_image = "buildings/war_factory/war_factory_overlay.png"
|
||||||
|
|
||||||
|
position = entity.position.clone
|
||||||
|
position.z = IMICRTS::ZOrder::OVERLAY
|
||||||
|
|
||||||
|
p1 = position.clone
|
||||||
|
p1.x += 32
|
||||||
|
p1.y -= 9
|
||||||
|
p2 = p1.clone
|
||||||
|
p2.y += 31
|
||||||
|
|
||||||
|
entity.particle_emitters << IMICRTS::SmokeEmitter.new(position: p1)
|
||||||
|
entity.particle_emitters << IMICRTS::SmokeEmitter.new(position: p2)
|
||||||
|
|
||||||
|
entity.on_tick do
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -83,6 +83,30 @@ class IMICRTS
|
|||||||
position: CyberarmEngine::Vector.new(spawnpoint.x - 64, spawnpoint.y + 64, ZOrder::GROUND_VEHICLE),
|
position: CyberarmEngine::Vector.new(spawnpoint.x - 64, spawnpoint.y + 64, ZOrder::GROUND_VEHICLE),
|
||||||
angle: 0
|
angle: 0
|
||||||
)
|
)
|
||||||
|
@player.entities << Entity.new(
|
||||||
|
name: :power_plant,
|
||||||
|
director: @director,
|
||||||
|
player: @player,
|
||||||
|
id: @player.next_entity_id,
|
||||||
|
position: CyberarmEngine::Vector.new(spawnpoint.x + 64, spawnpoint.y + 64, ZOrder::BUILDING),
|
||||||
|
angle: 0
|
||||||
|
)
|
||||||
|
@player.entities << Entity.new(
|
||||||
|
name: :refinery,
|
||||||
|
director: @director,
|
||||||
|
player: @player,
|
||||||
|
id: @player.next_entity_id,
|
||||||
|
position: CyberarmEngine::Vector.new(spawnpoint.x + 130, spawnpoint.y + 64, ZOrder::BUILDING),
|
||||||
|
angle: 0
|
||||||
|
)
|
||||||
|
@player.entities << Entity.new(
|
||||||
|
name: :war_factory,
|
||||||
|
director: @director,
|
||||||
|
player: @player,
|
||||||
|
id: @player.next_entity_id,
|
||||||
|
position: CyberarmEngine::Vector.new(spawnpoint.x + 130, spawnpoint.y - 64, ZOrder::BUILDING),
|
||||||
|
angle: 0
|
||||||
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
def draw
|
def draw
|
||||||
|
|||||||
Reference in New Issue
Block a user