mirror of
https://github.com/cyberarm/i-mic-rts.git
synced 2025-12-16 00:02:33 +00:00
Added images for 'all' entities, added Tank
This commit is contained in:
@@ -4,7 +4,7 @@ IMICRTS::Entity.define_entity(:construction_worker, :unit, 1000, "Constructs bui
|
||||
entity.max_health = 100.0
|
||||
|
||||
entity.body_image = "vehicles/construction_worker/images/construction_worker.png"
|
||||
entity.shell_image = "vehicles/construction_worker/images/construction_worker.png"
|
||||
entity.shell_image = "vehicles/construction_worker/images/construction_worker_shell.png"
|
||||
|
||||
entity.on_tick do
|
||||
end
|
||||
|
||||
@@ -4,7 +4,7 @@ IMICRTS::Entity.define_entity(:harvester, :unit, 1400, "Harvests ore") do |entit
|
||||
entity.max_health = 100.0
|
||||
|
||||
entity.body_image = "vehicles/harvester/images/harvester.png"
|
||||
entity.shell_image = "vehicles/harvester/images/harvester.png"
|
||||
entity.shell_image = "vehicles/harvester/images/harvester_shell.png"
|
||||
|
||||
@capacity = 10.0
|
||||
@bed = 0.0
|
||||
|
||||
12
lib/entities/tank.rb
Normal file
12
lib/entities/tank.rb
Normal file
@@ -0,0 +1,12 @@
|
||||
IMICRTS::Entity.define_entity(:tank, :unit, 800, "Attacks ground targets") do |entity|
|
||||
entity.radius = 14
|
||||
entity.movement = :ground
|
||||
entity.max_health = 100.0
|
||||
|
||||
entity.shell_image = "vehicles/tank/tank_shell.png"
|
||||
|
||||
entity.turret_shell_image = "vehicles/tank/tank_turret_shell.png"
|
||||
|
||||
entity.on_tick do
|
||||
end
|
||||
end
|
||||
@@ -81,8 +81,13 @@ class IMICRTS
|
||||
end
|
||||
|
||||
def draw
|
||||
@body_image.draw_rot(@position.x, @position.y, @position.z, @angle)
|
||||
@body_image.draw_rot(@position.x, @position.y, @position.z, @angle) if @body_image
|
||||
@shell_image.draw_rot(@position.x, @position.y, @position.z, @angle, 0.5, 0.5, 1, 1, @player.color)
|
||||
@overlay_image.draw_rot(@position.x, @position.y, @position.z, @angle, 0.5, 0.5, 1, 1) if @overlay_image
|
||||
|
||||
@turret_body_image.draw_rot(@position.x, @position.y, @position.z, @angle, 0.5, 0.5, 1, 1) if @turret_body_image
|
||||
@turret_shell_image.draw_rot(@position.x, @position.y, @position.z, @angle, 0.5, 0.5, 1, 1, @player.color) if @turret_shell_image
|
||||
@turret_overlay_image.draw_rot(@position.x, @position.y, @position.z, @angle, 0.5, 0.5, 1, 1) if @turret_overlay_image
|
||||
end
|
||||
|
||||
def update
|
||||
|
||||
@@ -37,6 +37,16 @@ class IMICRTS
|
||||
angle: rand(360)
|
||||
)
|
||||
end
|
||||
@t = button("Tank", width: 1.0) do
|
||||
@player.entities << Entity.new(
|
||||
name: :tank,
|
||||
director: @director,
|
||||
player: @player,
|
||||
id: @player.next_entity_id,
|
||||
position: CyberarmEngine::Vector.new(rand(window.width), rand(window.height), ZOrder::GROUND_VEHICLE),
|
||||
angle: rand(360)
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
stack(width: 0.25, height: 1.0) do
|
||||
@@ -51,7 +61,7 @@ class IMICRTS
|
||||
end
|
||||
end
|
||||
|
||||
100.times { |i| [@c, @h].sample.instance_variable_get("@block").call }
|
||||
100.times { |i| [@c, @h, @t].sample.instance_variable_get("@block").call }
|
||||
end
|
||||
|
||||
def draw
|
||||
|
||||
Reference in New Issue
Block a user