Player movement seems like back to working, res→assets

Former-commit-id: f91181caee4dabf4cb2e51d8077441c6b0f83757
Former-commit-id: 8b450303698c5c85dea9145a056b290b95a6a7b0
This commit is contained in:
Song Minjae
2016-08-02 17:32:42 +09:00
parent 5e7a95a3b9
commit 17c39c1824
248 changed files with 371 additions and 104 deletions

View File

@@ -43,7 +43,8 @@ object CommandDict {
Pair("bulletintest", SetBulletin()),
Pair("gsontest", GsonTest()),
Pair("tips", PrintRandomTips()),
Pair("langtest", LangTest())
Pair("langtest", LangTest()),
Pair("musictest", MusicTest())
)
operator fun get(commandName: String): ConsoleCommand {

View File

@@ -0,0 +1,45 @@
package net.torvald.terrarum.console
import org.newdawn.slick.Music
import org.newdawn.slick.openal.AudioLoader
import java.io.File
/**
* Created by minjaesong on 16-08-02.
*/
class MusicTest : ConsoleCommand {
var music: Music? = null
/**
* Args 0: command given
* Args 1: first argument
*
* e.g. in ```setav mass 74```, zeroth args will be ```setav```.
*/
override fun execute(args: Array<String>) {
if (args.size < 2) {
printUsage()
return
}
if (args[1] == "stop") {
music!!.stop()
return
}
val type = args[1].substringAfter('.').toUpperCase()
/*AudioLoader.getStreamingAudio(
type,
File("./assets/sounds/test/${args[1]}").absoluteFile.toURI().toURL()
).playAsMusic(1f, 1f, false)*/
music = Music("./assets/sounds/test/${args[1]}")
music!!.play()
}
override fun printUsage() {
Echo().execute("Usage: musictest filename/in/res/sounds/test")
Echo().execute("musictest stop to stop playback")
}
}