mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-12 19:44:05 +09:00
Former-commit-id: 851e141fc91b170190d6027f42f59906dda0f31f Former-commit-id: 03dbb9da1788e1c50e84ae33d95f76194ad9a08d
39 lines
1.1 KiB
Kotlin
39 lines
1.1 KiB
Kotlin
package net.torvald.terrarum.console
|
|
|
|
import net.torvald.terrarum.gameactors.Actor
|
|
import net.torvald.terrarum.gameactors.ActorWithBody
|
|
import net.torvald.terrarum.gameactors.PhysTestBall
|
|
import net.torvald.terrarum.mapdrawer.MapCamera
|
|
import net.torvald.terrarum.Terrarum
|
|
|
|
/**
|
|
* Created by minjaesong on 16-03-05.
|
|
*/
|
|
internal object SpawnPhysTestBall : ConsoleCommand {
|
|
@Throws(Exception::class)
|
|
override fun execute(args: Array<String>) {
|
|
if (args.size == 2) {
|
|
val mouseX = Terrarum.appgc.input.mouseX
|
|
val mouseY = Terrarum.appgc.input.mouseY
|
|
|
|
val elasticity = args[1].toDouble()
|
|
|
|
val ball = PhysTestBall()
|
|
ball.setPosition(
|
|
(mouseX + MapCamera.cameraX).toDouble(),
|
|
(mouseY + MapCamera.cameraY).toDouble()
|
|
)
|
|
ball.elasticity = elasticity
|
|
|
|
Terrarum.ingame.addActor(ball)
|
|
}
|
|
else {
|
|
printUsage()
|
|
}
|
|
}
|
|
|
|
override fun printUsage() {
|
|
Echo("usage: spawnball [elasticity]")
|
|
}
|
|
}
|