colorutil update, some code cleanup

Former-commit-id: 47b13e7e899dc9151f7a1ae71977ed8d4b403345
Former-commit-id: 136f9c787b76aec75d76535891cf264170bd3b04
This commit is contained in:
Song Minjae
2017-01-15 20:51:42 +09:00
parent e7276513d7
commit 1f1e2f6899
17 changed files with 227 additions and 168 deletions

View File

@@ -20,10 +20,10 @@ class SpriteAnimation(val parentActor: ActorWithBody) {
private set
var width: Int = 0
private set
private var currentFrame = 1
private var currentRow = 1
private var nFrames: Int = 0
private var nRows: Int = 0
private var currentFrame = 1 // one-based!
private var currentRow = 1 // one-based!
private var nFrames: Int = 1
private var nRows: Int = 1
private var delay = 200
private var delta = 0
private val looping = true
@@ -46,11 +46,14 @@ class SpriteAnimation(val parentActor: ActorWithBody) {
* *
* @throws SlickException
*/
@Throws(SlickException::class)
fun setSpriteImage(imagePath: String) {
spriteImage = SpriteSheet(imagePath, this.width, this.height)
}
fun setSpriteImage(image: Image) {
spriteImage = SpriteSheet(image, this.width, this.height)
}
/**
* Sets animation delay. Will default to 200 if not called.
* @param delay in milliseconds
@@ -60,10 +63,9 @@ class SpriteAnimation(val parentActor: ActorWithBody) {
}
/**
* Sets sprite dimension. This is necessary.
* @param w
* *
* @param h
* Sets sprite dimension. This is necessary for this to work.
* @param w width of the animation frame
* @param h height of the animation frame
*/
fun setDimension(w: Int, h: Int) {
width = w