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:
Song Minjae
2016-12-23 20:49:29 +09:00
parent 106afb4f49
commit 944c71d691
22 changed files with 712 additions and 88 deletions

View File

@@ -2,6 +2,7 @@ package net.torvald.terrarum.gameactors
import net.torvald.spriteanimation.SpriteAnimation
import net.torvald.terrarum.gameactors.ActorHumanoid
import net.torvald.terrarum.gameactors.ai.scripts.PokemonNPCAI
import net.torvald.terrarum.mapdrawer.MapDrawer
/**
@@ -9,25 +10,25 @@ import net.torvald.terrarum.mapdrawer.MapDrawer
*/
object PlayerBuilderCynthia {
fun create(): Player {
val p: Player = Player(GameDate(100, 143)) // random value thrown
CreatureRawInjector.inject(p.actorValue, "CreatureHuman.json")
operator fun invoke(): ActorWithBody {
//val p: Player = Player(GameDate(100, 143)) // random value thrown
val p: HumanoidNPC = HumanoidNPC(PokemonNPCAI(), GameDate(100, 143)) // random value thrown
InjectCreatureRaw(p.actorValue, "CreatureHuman.json")
p.actorValue[AVKey.__PLAYER_QUICKBARSEL] = 0
p.actorValue["__selectedtile"] = 16
p.makeNewSprite(26, 42)
p.sprite!!.setSpriteImage("assets/graphics/sprites/test_player_2.png")
p.sprite!!.setDelay(200)
p.sprite!!.setRowsAndFrames(1, 1)
p.sprite!!.setAsVisible()
p.setHitboxDimension(15, p.actorValue.getAsInt(AVKey.BASEHEIGHT) ?: ActorHumanoid.BASE_HEIGHT, 9, 0)
p.setPosition((4096 * MapDrawer.TILE_SIZE).toDouble(), (300 * 16).toDouble())
p.setPosition(4096.0 * MapDrawer.TILE_SIZE, 300.0 * MapDrawer.TILE_SIZE)
return p
}
}