mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-14 12:34:05 +09:00
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:
61
src/net/torvald/terrarum/gameactors/ProjectileSimple.kt
Normal file
61
src/net/torvald/terrarum/gameactors/ProjectileSimple.kt
Normal 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))
|
||||
// ...
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user