Player

abstract class Player(var initialX: Int, var initialY: Int, val invincible: Boolean = false) : Entity

The basic class of player. After reinitialize the top.kkoishi.stg.logic.ObjectPool.player, you can switch the GameStage(gameState) to STATE_PLAYING, then this class can be rendered and upgrade correctly.

You can change the events in keyEvents to override the behavior of the player, or implement actionsImpl method. Please make sure that you recreate the Player instance or set its position to the initial position.

The rest life is held by PlayerManager, so you can get it by invoking life method for upgrading the information.

Author

KKoishi_

Parameters

initialX

the initial X coordinate of the player.

initialY

the initial Y coordinate of the player.

invincible

if the player is invincible.

Inheritors

Constructors

Link copied to clipboard
constructor(initialX: Int, initialY: Int, invincible: Boolean = false)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val invincible: Boolean = false
Link copied to clipboard
Link copied to clipboard
open override val uuid: UUID

The universally unique identifier(UUID) of this object

Functions

Link copied to clipboard
fun actions()
Link copied to clipboard
abstract fun actionsImpl()
Link copied to clipboard
open override fun beingHit(o: Object)

What to do after hit.

Link copied to clipboard
abstract fun bomb()
Link copied to clipboard
abstract fun bullet(dx: Int = 0, dy: Int = 0): PlayerBullet
Link copied to clipboard
abstract fun bulletDamage(): Int
Link copied to clipboard
open override fun collide(o: Object): Boolean

Test if the object collide with another object o.

Link copied to clipboard
abstract fun dead()

Actions invoked after the entity is dead.

Link copied to clipboard
open override fun isDead(): Boolean

If the entity is dead.

Link copied to clipboard
override fun move()

How the entity move.

Link copied to clipboard
open override fun paint(g: Graphics2D)

Render the object.

Link copied to clipboard
fun power(): Float

Get the firepower of the player

Link copied to clipboard
open fun reinitialize()

Reinitialize the player's state.

Link copied to clipboard

Set the player's firepower to the given float number.

Link copied to clipboard
abstract fun shape(): Shape

The shape of the entity, used for collide test.

Link copied to clipboard
open fun shot()
Link copied to clipboard
abstract fun texture(): String
Link copied to clipboard
open override fun toString(): String
Link copied to clipboard
open override fun update(): Boolean

Check the state of the object, and if this need to be removed, true should be returned.

Link copied to clipboard
fun x(): Double

Get the X coordinate of the player in Double.

fun x(newX: Double)

Set the X coordinate of the player.

Link copied to clipboard
fun xInt(): Int

the X coordinate of the player in Integer.

Link copied to clipboard
fun y(): Double

Get the Y coordinate of the player in Double.

fun y(newY: Double)

Set the Y coordinate of the player.

Link copied to clipboard
fun yInt(): Int

the Y coordinate of the player in Integer.