mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-13 03:54:06 +09:00
new gem on worldgen
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
package net.torvald.terrarum.modulebasegame.gameactors
|
||||
|
||||
import net.torvald.terrarum.INGAME
|
||||
import net.torvald.terrarum.Second
|
||||
import net.torvald.terrarum.gameactors.ActorWithBody
|
||||
import net.torvald.terrarum.modulebasegame.ExplosionManager
|
||||
import org.dyn4j.geometry.Vector2
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 2024-02-13.
|
||||
*/
|
||||
open class ActorPrimedBomb : ActorWithBody {
|
||||
|
||||
protected constructor() {
|
||||
renderOrder = RenderOrder.MIDTOP
|
||||
}
|
||||
|
||||
private var explosionPower: Float = 1f
|
||||
private var fuse: Second = 1f
|
||||
|
||||
constructor(
|
||||
initialPos: Vector2,
|
||||
initialVelo: Vector2,
|
||||
power: Float,
|
||||
fuse: Second
|
||||
) {
|
||||
renderOrder = RenderOrder.MIDTOP
|
||||
|
||||
this.explosionPower = power
|
||||
this.fuse = fuse
|
||||
}
|
||||
|
||||
override fun updateImpl(delta: Float) {
|
||||
super.updateImpl(delta)
|
||||
|
||||
fuse -= delta
|
||||
|
||||
if (fuse <= 0f) {
|
||||
physProp.usePhysics = false
|
||||
ExplosionManager.goBoom(INGAME.world, intTilewiseHitbox.centeredX.toInt(), intTilewiseHitbox.centeredY.toInt(), explosionPower)
|
||||
flagDespawn()
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user