LibGDX, here I am.

This commit is contained in:
minjaesong
2017-06-22 02:31:07 +09:00
parent 1ecbc57f83
commit ad481853bb
356 changed files with 3125 additions and 21138 deletions

View File

@@ -1,7 +1,7 @@
package net.torvald.terrarum.console
import net.torvald.terrarum.worlddrawer.FeaturesDrawer
import net.torvald.terrarum.Terrarum
import net.torvald.terrarum.TerrarumGDX
import net.torvald.terrarum.gameactors.ActorWithPhysics
/**
@@ -23,7 +23,7 @@ internal object Teleport : ConsoleCommand {
return
}
Terrarum.ingame!!.player!!.setPosition(x.toDouble(), y.toDouble())
TerrarumGDX.ingame!!.player!!.setPosition(x.toDouble(), y.toDouble())
}
else if (args.size == 4) {
if (args[2].toLowerCase() != "to") {
@@ -35,20 +35,20 @@ internal object Teleport : ConsoleCommand {
try {
val fromActorID = args[1].toInt()
val targetActorID = if (args[3].toLowerCase() == "player")
Terrarum.ingame!!.player!!.referenceID
TerrarumGDX.ingame!!.player!!.referenceID
else
args[3].toInt()
// if from == target, ignore the action
if (fromActorID == targetActorID) return
if (Terrarum.ingame!!.getActorByID(fromActorID) !is ActorWithPhysics ||
Terrarum.ingame!!.getActorByID(targetActorID) !is ActorWithPhysics) {
if (TerrarumGDX.ingame!!.getActorByID(fromActorID) !is ActorWithPhysics ||
TerrarumGDX.ingame!!.getActorByID(targetActorID) !is ActorWithPhysics) {
throw IllegalArgumentException()
}
else {
fromActor = Terrarum.ingame!!.getActorByID(fromActorID) as ActorWithPhysics
targetActor = Terrarum.ingame!!.getActorByID(targetActorID) as ActorWithPhysics
fromActor = TerrarumGDX.ingame!!.getActorByID(fromActorID) as ActorWithPhysics
targetActor = TerrarumGDX.ingame!!.getActorByID(targetActorID) as ActorWithPhysics
}
}
catch (e: NumberFormatException) {
@@ -79,11 +79,11 @@ internal object Teleport : ConsoleCommand {
y = args[4].toInt() * FeaturesDrawer.TILE_SIZE + FeaturesDrawer.TILE_SIZE / 2
val actorID = args[1].toInt()
if (Terrarum.ingame!!.getActorByID(actorID) !is ActorWithPhysics) {
if (TerrarumGDX.ingame!!.getActorByID(actorID) !is ActorWithPhysics) {
throw IllegalArgumentException()
}
else {
actor = Terrarum.ingame!!.getActorByID(actorID) as ActorWithPhysics
actor = TerrarumGDX.ingame!!.getActorByID(actorID) as ActorWithPhysics
}
}
catch (e: NumberFormatException) {