mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-11 02:54:04 +09:00
pick and hammer spawns particles
This commit is contained in:
@@ -11,10 +11,13 @@ import net.torvald.terrarum.gameactors.ActorWithBody
|
||||
import net.torvald.terrarum.gameitems.GameItem
|
||||
import net.torvald.terrarum.gameitems.ItemID
|
||||
import net.torvald.terrarum.gameitems.mouseInInteractableRangeTools
|
||||
import net.torvald.terrarum.gameparticles.createRandomBlockParticle
|
||||
import net.torvald.terrarum.itemproperties.Calculate
|
||||
import net.torvald.terrarum.modulebasegame.TerrarumIngame
|
||||
import net.torvald.terrarum.modulebasegame.gameactors.DroppedItem
|
||||
import net.torvald.terrarum.modulebasegame.gameitems.PickaxeCore.BASE_MASS_AND_SIZE
|
||||
import net.torvald.terrarum.modulebasegame.gameitems.PickaxeCore.TOOL_DURABILITY_BASE
|
||||
import org.dyn4j.geometry.Vector2
|
||||
import kotlin.math.roundToInt
|
||||
|
||||
/**
|
||||
@@ -90,6 +93,17 @@ object PickaxeCore {
|
||||
if (drop.isNotBlank()) {
|
||||
INGAME.queueActorAddition(DroppedItem(drop, (x + 0.5) * TILE_SIZED, (y + 1.0) * TILE_SIZED))
|
||||
}
|
||||
|
||||
repeat(9) {
|
||||
val pos = Vector2(
|
||||
x * TILE_SIZED + 2 + (4 * (it % 3)),
|
||||
y * TILE_SIZED + 4 + (4 * (it / 3))
|
||||
)
|
||||
createRandomBlockParticle(tile, pos, 1.0 * (if (Math.random() < 0.5) -1 else 1)).let {
|
||||
it.despawnUponCollision = false
|
||||
(Terrarum.ingame as TerrarumIngame).addParticle(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,10 +10,14 @@ import net.torvald.terrarum.gameactors.ActorWithBody
|
||||
import net.torvald.terrarum.gameitems.GameItem
|
||||
import net.torvald.terrarum.gameitems.ItemID
|
||||
import net.torvald.terrarum.gameitems.mouseInInteractableRangeTools
|
||||
import net.torvald.terrarum.gameparticles.createRandomBlockParticle
|
||||
import net.torvald.terrarum.itemproperties.Calculate
|
||||
import net.torvald.terrarum.modulebasegame.TerrarumIngame
|
||||
import net.torvald.terrarum.modulebasegame.gameactors.DroppedItem
|
||||
import net.torvald.terrarum.modulebasegame.gameitems.SledgehammerCore.BASE_MASS_AND_SIZE
|
||||
import net.torvald.terrarum.modulebasegame.gameitems.SledgehammerCore.TOOL_DURABILITY_BASE
|
||||
import net.torvald.terrarum.worlddrawer.CreateTileAtlas
|
||||
import org.dyn4j.geometry.Vector2
|
||||
import kotlin.math.roundToInt
|
||||
|
||||
/**
|
||||
@@ -95,6 +99,18 @@ object SledgehammerCore {
|
||||
if (drop.isNotBlank()) {
|
||||
INGAME.queueActorAddition(DroppedItem("wall@$drop", (x + 0.5) * TILE_SIZED, (y + 1.0) * TILE_SIZED))
|
||||
}
|
||||
|
||||
repeat(9) {
|
||||
val pos = Vector2(
|
||||
x * TILE_SIZED + 2 + (4 * (it % 3)),
|
||||
y * TILE_SIZED + 4 + (4 * (it / 3))
|
||||
)
|
||||
createRandomBlockParticle(wall, pos, 1.0 * (if (Math.random() < 0.5) -1 else 1)).let {
|
||||
it.despawnUponCollision = false
|
||||
it.drawColour.set(App.tileMaker.wallOverlayColour)
|
||||
(Terrarum.ingame as TerrarumIngame).addParticle(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user