Analysis update
This commit is contained in:
+2
-4
@@ -108,10 +108,8 @@ query = tag(:enemy) & component(:health, true) & anti(name("Trap Preview", true)
|
||||
world.system :health_regen, for: query do |match, dt| # no trigger means always
|
||||
# example of a simple health regeneration system that regenerates health for all entities with a health component
|
||||
healths = match[0]
|
||||
healths.each do |health|
|
||||
health.health += 1 * dt # regenerate 1 health per second, dt is the delta time since the last update frame, so this will regenerate 1 health per second regardless of the frame rate
|
||||
health.health = [health.health, 100].min # cap health at 100
|
||||
end
|
||||
healths.add_scalar! :health, 1 * dt
|
||||
healths.clamp! :health, 0, 100
|
||||
end
|
||||
|
||||
trigger = [:place]
|
||||
|
||||
Reference in New Issue
Block a user