CPParticle

org.cosplay.CPParticle
trait CPParticle

Programmable particle.

Particle is part of the particle effect animation support. Particle effect support consists of three key components:

Particle defines a single-pixel element (a-la mini-sprite) that has its own lifecycle and gets updated on each frame update. Particle emitter is a components that is responsible for creating particles. And particle sprite ties all that together into single renderable component. Particle sprite can have one or more particle emitters and each emitter can create multiple particles. One of the key features of particle effect support is its modularity: particle implementation can be reused by multiple emitters, and an emitter implementation can be reused by multiple independent particle sprites.

Attributes

Example

See CPParticleExample class for the example of using particle effect.

Source
CPParticle.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes

Members list

Value members

Abstract methods

Gets pixel for this particle.

Gets pixel for this particle.

Attributes

Source
CPParticle.scala
def getX: Int

Gets current X-coordinate of this particle.

Gets current X-coordinate of this particle.

Attributes

Source
CPParticle.scala
def getY: Int

Gets current Y-coordinate of this particle.

Gets current Y-coordinate of this particle.

Attributes

Source
CPParticle.scala
def getZ: Int

Gets current Z-index of this particle.

Gets current Z-index of this particle.

Attributes

Source
CPParticle.scala
def isAlive: Boolean

Tests whether or not this particle is alive. Dead particles will be discarded by the particle sprite and won't be rendered anymore. This method is used to check every particle on each frame update.

Tests whether or not this particle is alive. Dead particles will be discarded by the particle sprite and won't be rendered anymore. This method is used to check every particle on each frame update.

Attributes

Source
CPParticle.scala
def update(ctx: CPSceneObjectContext): Unit

This method is called on each frame update. Technically, a particle sprite call this method when it itself receives CPSceneObject.update callback passing its own scene context to this callback.

This method is called on each frame update. Technically, a particle sprite call this method when it itself receives CPSceneObject.update callback passing its own scene context to this callback.

Value parameters

ctx

Scene object context of the particle sprite.

Attributes

Source
CPParticle.scala