particles when actors collide the world

This commit is contained in:
minjaesong
2023-10-14 02:26:13 +09:00
parent d8abec381b
commit 65997764e6
3 changed files with 110 additions and 11 deletions

View File

@@ -95,7 +95,7 @@ class EntryPoint : ModuleEntryPoint() {
private fun makeNewItemObj(tile: BlockProp, isWall: Boolean) = object : GameItem(
if (isWall) "wall@"+tile.id else tile.id
) {
override var baseMass: Double = tile.density / 1000.0
override var baseMass: Double = tile.density / 100.0
override var baseToolSize: Double? = null
override var inventoryCategory = if (isWall) Category.WALL else Category.BLOCK
override var isDynamic = false

View File

@@ -58,7 +58,7 @@ open class DroppedItem : ActorWithBody {
isVisible = true
avBaseMass = (ItemCodex[itemID]?.mass ?: 2.0).coerceAtMost(2.0)
avBaseMass = ((ItemCodex[itemID]?.mass) ?: 2.0).coerceAtLeast(2.0)
actorValue[AVKey.SCALE] = ItemCodex[itemID]?.scale ?: 1.0
@@ -84,9 +84,18 @@ open class DroppedItem : ActorWithBody {
externalV.set(spawnVelo)
}
actorValue.set(AVKey.FALLDAMPENMULT, 0.1)
printdbg(this, "DroppedItem with itemID '${itemID}'")
}
override fun reload() {
super.reload()
actorValue.set(AVKey.FALLDAMPENMULT, 0.1)
}
override fun drawBody(batch: SpriteBatch) {
// deserialiser won't call setter of the fields
if (visualItemID == "") {