CPBubbleSprite

class CPBubbleSprite(id: String, img: CPImage, initX: Int, initY: Int, z: Int, dxf: CPSceneObjectContext => Float, dyf: CPSceneObjectContext => Float, bgPx: CPPixel, durMs: Long, onFinish: CPSceneObjectContext => Unit, autoDelete: Boolean, tags: String*) extends CPImageSprite

Image sprite that provides moving and fading out image effect. This typically can be used for word or speech bubbles in the game and such.

Value parameters:
autoDelete

Optional flag on whether or not to auto-delete the sprite from its scene when the effect is finished. Default value is true.

bgPx

Background pixel to fade out to.

durMs

Duration of the shader effect in milliseconds.

dxf

Function providing per-frame X-coordinate delta. Defines speed of movement on X-axis.

dyf

Function providing per-frame Y-coordinate delta. Defines speed of movement on Y-axis.

id

Optional ID of the sprite.

img

The image to render. It can be changed later.

initX

Initial X-coordinate of the sprite.

initY

Initial Y-coordinate of the sprite.

onFinish

Optional callback to call when the effect is finished. Default is a np-op.

tags

Optional set of organizational or grouping tags. By default, the empty set is used.

z

Z-index at which to render the image.

Source:
CPBubbleSprite.scala
class Object
trait Matchable
class Any

Value members

Concrete methods

override def getShaders: Seq[CPShader]
override def update(ctx: CPSceneObjectContext): Unit
Definition Classes
Source:
CPBubbleSprite.scala

Inherited methods

override def equals(obj: Any): Boolean
Definition Classes
Inherited from:
CPGameObject
Source:
CPGameObject.scala
override def getCollisionRect: Option[CPRect]

Gets optional collision shape or hit box for this sprite.

Gets optional collision shape or hit box for this sprite.

Definition Classes
Inherited from:
CPImageSprite
Source:
CPImageSprite.scala
override def getDim: CPDim

Gets current dimension (width and height) of this object.

Gets current dimension (width and height) of this object.

Definition Classes
Inherited from:
CPImageSprite
Source:
CPImageSprite.scala
inline def getHeight: Int

Gets current height of this object.

Gets current height of this object.

See also:
Inherited from:
CPSceneObject
Source:
CPSceneObject.scala
def getId: String

Gets unique ID of this game object.

Gets unique ID of this game object.

Inherited from:
CPGameObject
Source:
CPGameObject.scala

Gets current image to render.

Gets current image to render.

Returns:

Current image to render.

Inherited from:
CPImageSprite
Source:
CPImageSprite.scala
override def getRect: CPRect

Gets rectangular shape of this sprite. It is basically a combination of its top-left corner XY-coordinate and sprite's dimension.

Gets rectangular shape of this sprite. It is basically a combination of its top-left corner XY-coordinate and sprite's dimension.

Definition Classes
Inherited from:
CPImageSprite
Source:
CPImageSprite.scala
final def getState: State

Gets current lifecycle state.

Gets current lifecycle state.

Inherited from:
CPLifecycle
Source:
CPLifecycle.scala
def getTags: Set[String]

Gets optional set of organizational tags. Note that by default the set of tags is empty.

Gets optional set of organizational tags. Note that by default the set of tags is empty.

See also:
Inherited from:
CPGameObject
Source:
CPGameObject.scala
inline def getWidth: Int

Gets current width of this object.

Gets current width of this object.

See also:
Inherited from:
CPSceneObject
Source:
CPSceneObject.scala
override def getX: Int

Gets current X-coordinate of this object within dimensions of its scene. Note that returned value is allowed to be outside scene's dimension (e.g. negative value). In such cases, the clipping of the scene rendering will result in showing only portion or none of the object.

Gets current X-coordinate of this object within dimensions of its scene. Note that returned value is allowed to be outside scene's dimension (e.g. negative value). In such cases, the clipping of the scene rendering will result in showing only portion or none of the object.

Definition Classes
Inherited from:
CPImageSprite
Source:
CPImageSprite.scala
override def getY: Int

Gets current Y-coordinate of this object within dimensions of its scene. Note that returned value is allowed to be outside scene's dimension (e.g. negative value). In such cases, the clipping of the scene rendering will result in showing only portion or none of the object.

Gets current Y-coordinate of this object within dimensions of its scene. Note that returned value is allowed to be outside scene's dimension (e.g. negative value). In such cases, the clipping of the scene rendering will result in showing only portion or none of the object.

Definition Classes
Inherited from:
CPImageSprite
Source:
CPImageSprite.scala
override def getZ: Int

Gets Z-index or order to use in rendering of this object. A pixel with higher Z-index visually overrides the overlapping pixel in the same XY-coordinate with equal or smaller Z-index.

Gets Z-index or order to use in rendering of this object. A pixel with higher Z-index visually overrides the overlapping pixel in the same XY-coordinate with equal or smaller Z-index.

Definition Classes
Inherited from:
CPImageSprite
Source:
CPImageSprite.scala
def hide(): Unit

Shortcut method for hiding this object. Note that by default all scene objects are visible.

Shortcut method for hiding this object. Note that by default all scene objects are visible.

See also:
Inherited from:
CPSceneObject
Source:
CPSceneObject.scala
def isVisible: Boolean

Checks the visibility flag.

Checks the visibility flag.

If object is invisible than only update method will be called on each frame. If object is visible and in camera frame - method render will be called as well to render itself. Note that shaders are called regardless of whether the object visible, in camera frame or invisible.

See also:
Inherited from:
CPSceneObject
Source:
CPSceneObject.scala
def onActivate(): Unit

Callback on lifecycle object activation. Default implementation is no-op.

Callback on lifecycle object activation. Default implementation is no-op.

See also:

CPLifecycle.State.LF_ACTIVE

Inherited from:
CPLifecycle
Source:
CPLifecycle.scala
def onDeactivate(): Unit

Callback on lifecycle object deactivation. Default implementation is no-op.

Callback on lifecycle object deactivation. Default implementation is no-op.

See also:

CPLifecycle.State.LF_INACTIVE

Inherited from:
CPLifecycle
Source:
CPLifecycle.scala
def onStart(): Unit

Callback on lifecycle object start. Default implementation is no-op.

Callback on lifecycle object start. Default implementation is no-op.

See also:

CPLifecycle.State.LF_STARTED

Inherited from:
CPLifecycle
Source:
CPLifecycle.scala
def onStop(): Unit

Callback on lifecycle object stop. Default implementation is no-op.

Callback on lifecycle object stop. Default implementation is no-op.

See also:

CPLifecycle.State.LF_STOPPED

Inherited from:
CPLifecycle
Source:
CPLifecycle.scala
override def render(ctx: CPSceneObjectContext): Unit

Called to render this scene object. Only visible and in camera frame objects will receive this callback. This callback is called on scene object after all scene objects received update callback. Note that unlike update callbacks and shaders that are called for all scene objects on each frame, this callback is only called for scene objects that are visible and, at least partially, in camera frame.

Called to render this scene object. Only visible and in camera frame objects will receive this callback. This callback is called on scene object after all scene objects received update callback. Note that unlike update callbacks and shaders that are called for all scene objects on each frame, this callback is only called for scene objects that are visible and, at least partially, in camera frame.

Definition Classes
Inherited from:
CPImageSprite
Source:
CPImageSprite.scala
def reset(): Unit

Resets this sprite to its initial XYZ-coordinates and the initial image.

Resets this sprite to its initial XYZ-coordinates and the initial image.

Inherited from:
CPImageSprite
Source:
CPImageSprite.scala
def setImage(img: CPImage): Unit

Changes the image this sprite is rendering.

Changes the image this sprite is rendering.

Value parameters:
img

New image to render.

Inherited from:
CPImageSprite
Source:
CPImageSprite.scala
def setVisible(vis: Boolean): Unit

Sets visibility flag. Note that by default all scene objects are visible.

Sets visibility flag. Note that by default all scene objects are visible.

Value parameters:
vis

true to make this object visible, false otherwise.

See also:
Inherited from:
CPSceneObject
Source:
CPSceneObject.scala
def setX(d: Int): Unit

Sets current X-coordinate. This coordinate will be returned from getX method.

Sets current X-coordinate. This coordinate will be returned from getX method.

Value parameters:
d

X-coordinate to set.

Inherited from:
CPImageSprite
Source:
CPImageSprite.scala
def setXY(a: Int, b: Int): Unit

Sets both current XY-coordinates.

Sets both current XY-coordinates.

Value parameters:
a

X-coordinate to set.

b

Y-coordinate to set.

Inherited from:
CPImageSprite
Source:
CPImageSprite.scala
def setY(d: Int): Unit

Sets current Y-coordinate. This coordinate will be returned from getY method.

Sets current Y-coordinate. This coordinate will be returned from getY method.

Value parameters:
d

Y-coordinate to set.

Inherited from:
CPImageSprite
Source:
CPImageSprite.scala
def setZ(d: Int): Unit

Sets current Z-index. This index will be returned from getZ method.

Sets current Z-index. This index will be returned from getZ method.

Value parameters:
d

Z-index to set.

Inherited from:
CPImageSprite
Source:
CPImageSprite.scala
def show(): Unit

Shortcut method for showing this object. Note that by default all scene objects are visible.

Shortcut method for showing this object. Note that by default all scene objects are visible.

See also:
Inherited from:
CPSceneObject
Source:
CPSceneObject.scala

Inherited fields

final val initImg: CPImage

Initial image of the sprite.

Initial image of the sprite.

See also:
Inherited from:
CPImageSprite
Source:
CPImageSprite.scala
final val initZ: Int

Initial Z-index of the sprite.

Initial Z-index of the sprite.

See also:
Inherited from:
CPImageSprite
Source:
CPImageSprite.scala