mirror of
https://github.com/cyberarm/i-mic-rts.git
synced 2025-12-15 15:52:34 +00:00
TileMap parser can now load spawn locations, added construction yard building, added particle emitters, added smoke sprite and svg.
This commit is contained in:
@@ -18,7 +18,7 @@ class IMICRTS
|
||||
attr_reader :player, :id, :name, :type, :speed
|
||||
attr_accessor :position, :angle, :radius, :target, :state,
|
||||
:movement, :health, :max_health,
|
||||
:turret, :center
|
||||
:turret, :center, :particle_emitters
|
||||
def initialize(name:, player:, id:, position:, angle:, director:)
|
||||
@player = player
|
||||
@id = id
|
||||
@@ -27,10 +27,13 @@ class IMICRTS
|
||||
@director = director
|
||||
@speed = 0.5
|
||||
|
||||
@radius = 32 / 2
|
||||
@sight_radius = 5 # tiles
|
||||
@range_radius = 3 # tiles
|
||||
@radius = 32 / 2 # pixels
|
||||
@target = nil
|
||||
@state = :idle
|
||||
@center = CyberarmEngine::Vector.new(0.5, 0.5)
|
||||
@particle_emitters = []
|
||||
|
||||
@components = {}
|
||||
|
||||
@@ -101,7 +104,7 @@ class IMICRTS
|
||||
end
|
||||
|
||||
def render
|
||||
@render = Gosu.render(32, 32, retro: true) do
|
||||
@render = Gosu.render(@shell_image.width, @shell_image.height, retro: true) do
|
||||
@body_image.draw(0, 0, 0) if @body_image
|
||||
@shell_image.draw(0, 0, 0, 1, 1, @player.color)
|
||||
@overlay_image.draw(0, 0, 0) if @overlay_image
|
||||
@@ -113,6 +116,7 @@ class IMICRTS
|
||||
@render.draw_rot(@position.x, @position.y, @position.z, @angle, @center.x, @center.y)
|
||||
|
||||
component(:turret).draw if component(:turret)
|
||||
@particle_emitters.each(&:draw)
|
||||
end
|
||||
|
||||
def update
|
||||
@@ -123,6 +127,11 @@ class IMICRTS
|
||||
|
||||
component(:movement).follow_path
|
||||
end
|
||||
|
||||
@particle_emitters.each do |emitter|
|
||||
@particle_emitters.delete(emitter) if emitter.die?
|
||||
emitter.update
|
||||
end
|
||||
end
|
||||
|
||||
def tick(tick_id)
|
||||
|
||||
Reference in New Issue
Block a user