Skip to content

Commit

Permalink
add damage functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
Quillraven committed Mar 24, 2024
1 parent f43a2ad commit 0f387fc
Showing 1 changed file with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.quillraven.github.quillyjumper.system

import com.github.quillraven.fleks.Entity
import com.github.quillraven.fleks.IteratingSystem
import com.github.quillraven.fleks.World
import com.quillraven.github.quillyjumper.component.Invulnerable

class InvulnerableSystem : IteratingSystem(World.family { all(Invulnerable) }) {

override fun onTickEntity(entity: Entity) {
val invuCmp = entity[Invulnerable]
invuCmp.time -= deltaTime
if (invuCmp.time <= 0f) {
entity.configure { it -= Invulnerable }
}
}

}

0 comments on commit 0f387fc

Please sign in to comment.