mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-14 23:56:07 +09:00
visible actors are defaulted to Visible, SpriteAnimations now has "parent" actors and uses its Visible property
Former-commit-id: 0e240de4ca38a59724f364df4624c8dc79c0112d Former-commit-id: b017b24ab7591ea2fd2518308bd5656597c14f47
This commit is contained in:
@@ -7,13 +7,13 @@ package net.torvald.spriteanimation
|
||||
import net.torvald.terrarum.StateInGame
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import com.jme3.math.FastMath
|
||||
import net.torvald.terrarum.gameactors.ActorWithBody
|
||||
import org.newdawn.slick.Graphics
|
||||
import org.newdawn.slick.Image
|
||||
import org.newdawn.slick.SlickException
|
||||
import org.newdawn.slick.SpriteSheet
|
||||
|
||||
class SpriteAnimation @Throws(SlickException::class)
|
||||
constructor() {
|
||||
class SpriteAnimation(val parentActor: ActorWithBody) {
|
||||
|
||||
private var spriteImage: SpriteSheet? = null
|
||||
var height: Int = 0
|
||||
@@ -30,7 +30,8 @@ constructor() {
|
||||
private var animationRunning = true
|
||||
private var flipHorizontal = false
|
||||
private var flipVertical = false
|
||||
private var visible = false
|
||||
private val visible: Boolean
|
||||
get() = parentActor.isVisible
|
||||
|
||||
private val offsetX = 0
|
||||
private val offsetY = 0
|
||||
@@ -81,14 +82,6 @@ constructor() {
|
||||
nFrames = frames
|
||||
}
|
||||
|
||||
fun setAsVisible() {
|
||||
visible = true
|
||||
}
|
||||
|
||||
fun setAsInvisible() {
|
||||
visible = false
|
||||
}
|
||||
|
||||
fun update(delta: Int) {
|
||||
if (animationRunning) {
|
||||
//skip this if animation is stopped
|
||||
|
||||
Reference in New Issue
Block a user