keycap font, edit on Thai font, actor can now flagged to despawn, draft for projectile "actor"

Former-commit-id: 5a46366ac1680f040fe6e5ace742b71a86982efa
Former-commit-id: 30e481f10cc8c09d4fc4ff1f52a4a45d91e3ab2d
This commit is contained in:
Song Minjae
2016-08-31 01:05:35 +09:00
parent 720df532aa
commit 6e51b0c751
59 changed files with 288 additions and 117 deletions

View File

@@ -17,8 +17,8 @@ abstract class Actor : Comparable<Actor>, Runnable {
* @return Reference ID. (32768-0x7FFF_FFFF)
*/
abstract var referenceID: Int
abstract var actorValue: ActorValue
abstract var flagDespawn: Boolean
override fun equals(other: Any?) = referenceID == (other as Actor).referenceID
override fun hashCode() = referenceID

View File

@@ -127,7 +127,9 @@ open class ActorWithBody : Actor(), Visible {
* Flags and Properties
*/
var grounded = false
override var flagDespawn = false
/** Default to 'false' */
var isVisible = false
/** Default to 'true' */
@@ -269,7 +271,7 @@ open class ActorWithBody : Actor(), Visible {
}
override fun update(gc: GameContainer, delta: Int) {
if (isUpdate) {
if (isUpdate && !flagDespawn) {
/**
* Temporary variables to reset

View File

@@ -13,7 +13,7 @@ object PBCynthia {
CreatureRawInjector.inject(p.actorValue, "CreatureHuman.json")
p.actorValue[AVKey._PLAYER_QUICKBARSEL] = 0
p.actorValue["selectedtile"] = 16
p.actorValue["__selectedtile"] = 16
p.sprite = SpriteAnimation()

View File

@@ -58,7 +58,8 @@ object PBSigrid {
p.actorValue[AVKey.BASEDEFENCE] = 141
p.actorValue["selectedtile"] = 16
p.actorValue["__selectedtile"] = 16 // test code; replace with <tile_item>.primaryUse(gc, delta)
p.actorValue["__aimhelper"] = true
p.setHitboxDimension(15, p.actorValue.getAsInt(AVKey.BASEHEIGHT)!!, 10, 0)

View File

@@ -0,0 +1,13 @@
package net.torvald.terrarum.gameactors
import org.dyn4j.geometry.Vector2
/**
* Created by minjaesong on 16-08-29.
*/
class ProjectileHoming(type: Int, position: Vector2, velocity: Vector2, luminosity: Int = 0) :
ProjectileSimple(type, position, velocity, luminosity) {
}

View File

@@ -0,0 +1,61 @@
package net.torvald.terrarum.gameactors
import net.torvald.terrarum.gameactors.ActorWithBody
import org.dyn4j.geometry.Vector2
import org.newdawn.slick.Color
import org.newdawn.slick.GameContainer
import org.newdawn.slick.Graphics
import java.util.*
/**
* Created by minjaesong on 16-08-29.
*/
open class ProjectileSimple(
type: Int,
position: Vector2,
velocity: Vector2,
override var luminosity: Int = 0) : ActorWithBody(), Luminous {
val damage: Int
val displayColour: Color
/**
* Arguments:
*
* Hitbox(x-offset, y-offset, width, height)
* (Use ArrayList for normal circumstances)
*/
override val lightBoxList = ArrayList<Hitbox>()
init {
hitbox.set(position.x, position.y, 2.0, 2.0) // 2.0: size of the hitbox in pixels
lightBoxList.add(Hitbox(0.0, 0.0, 2.0, 2.0))
this.velocity.set(velocity)
damage = bulletDatabase[type][0] as Int
displayColour = bulletDatabase[type][1] as Color
}
override fun update(gc: GameContainer, delta: Int) {
// hit something and despawn! (use ```flagDespawn = true```)
super.update(gc, delta)
}
override fun drawBody(gc: GameContainer, g: Graphics) {
// draw trail of solid colour (Terraria style maybe?)
}
companion object {
val TYPE_BULLET_BASIC = 0
val bulletDatabase = arrayOf(
arrayOf(7, Color(0xFF5429)),
arrayOf(8, Color(0xFF5429))
// ...
)
}
}