Options
All
  • Public
  • Public/Protected
  • All
Menu
classdesc

Creates a DuckEngine GameObject

description

The RoundRect Class. Represents a smooth cornered rect

since

1.0.0-beta

Hierarchy

Index

Constructors

constructor

  • new RoundRect(x: number, y: number, w: number, h: number, r: number, fillColor: string, game: Game, scene: Scene): RoundRect

Properties

attachOffset

attachOffset: Vector2
memberof

PhysicsBody

description

The offset between the PhysicsBody that self is attached to

since

2.0.0

attachedChildren

attachedChildren: PhysicsBody<Duck.Types.Texture.Type>[]
memberof

PhysicsBody

description

PhysicsBodies that are attached

since

2.0.0

bounds

bounds: BoundsLike
memberof

PhysicsBody

description

The bounds of the PhysicsBody

since

2.0.0

collider

collider: undefined | Collider
memberof

PhysicsBody

description

The Collider instance of the PhysicsBody

since

2.0.0

collidesWith

memberof

PhysicsBody

description

An array or group of GameObjects that can collide with the PhysicsBody

since

2.0.0

culled

culled: boolean
memberof

GameObject

description

Determines if the GameObject should be visible by the current scene's current camera

since

2.1.0

enabled

enabled: boolean
memberof

PhysicsBody

description

Determines if the PhysicsBody._update is called by the Scene.physicsServer used by Scene.physicsList , changing this value does nothing, must use PhysicsBody.setEnabled

since

2.0.0

game

game: Game
memberof

PhysicsBody

description

The Game instance

since

2.0.0

h

h: number
memberof

PhysicsBody

description

The height of the GameObject

since

2.0.0

hitbox

hitbox: undefined | Hitbox
memberof

PhysicsBody

description

The Collider Hitbox of the PhysicsBody

since

2.0.0

Readonly id

id: string
memberof

PhysicsBody

description

The unique identifier for a GameObject

since

2.0.0

isAttached

isAttached: boolean
memberof

PhysicsBody

description

Determines if the PhysicsBody is attached to another PhysicsBody

since

2.0.0

options

memberof

PhysicsBody

description

PhysicsBody config, includes: type - KinematicBody | RigidBody | StaticBody

defaults: { type: 'KinematicBody'}

since

2.0.0

physics

physics: { addCollider: any; addHitbox: any; setBounds: any }
memberof

PhysicsBody

description

Object that has all the physics method

since

2.0.0

Type declaration

position

position: Vector2
memberof

PhysicsBody

description

The current global position of the GameObject

since

2.0.0

r

r: number
memberof

PhysicsBody

description

The radius of the GameObject

since

2.0.0

scene

scene: Scene
memberof

PhysicsBody

description

The Scene instance

since

2.0.0

Readonly shape

memberof

PhysicsBody

description

The shape of the GameObject, 'rect', 'circle', 'roundrect', or 'sprite'

since

2.0.0

texture

texture: Texture<"color">
memberof

GameObject

description

The texture of the GameObject

since

1.0.0-beta

velocity

velocity: Vector2
memberof

PhysicsBody

description

The velocity of the PhysicsBody

since

2.0.0

visible

visible: boolean
memberof

GameObject

description

Determines if a GameObject should be rendered or not (note: Camera.cull and autoCull overwrite this property)

since

2.0.0

w

w: number
memberof

PhysicsBody

description

The width of the GameObject

since

2.0.0

zIndex

zIndex: number
memberof

GameObject

description

Determines the depth or zIndex of a GameObject

since

2.0.0

Methods

_draw

  • _draw(): void

_update

  • _update(): void
  • memberof

    PhysicsBody

    description

    Updates the PhysicsBody's position by the velocity. Sets velocity to 0 on every tick. Clamps position to bounds if exists. Rounds pixels if roundPixels game config is set to true. Updates hitbox.collisionState if hitbox exists.

    DO NOT CALL MANUALLY, CALLED IN SCENE.__tick

    since

    2.0.0

    Returns void

accelerateVelocity

  • accelerateVelocity(target: Vector2, amount: number): void

applyFriction

  • applyFriction(frictionAmount: Vector2): void
  • memberof

    PhysicsBody

    description

    Applies friction to the velocity by an amount, PhysicsBody.options.type must be KinematicBody or RigidBody

    since

    2.0.0

    Parameters

    • frictionAmount: Vector2

      The value to decrease the velocity by

    Returns void

applyGravity

  • applyGravity(gravity: Vector2): void
  • memberof

    PhysicsBody

    description

    Applies gravity to the velocity by a Vector2, PhysicsBody.options.type must be KinematicBody or RigidBody

    since

    2.0.0

    Parameters

    • gravity: Vector2

      The Vector2 to add to the velocity by

    Returns void

attachChild

attachTo

autoFitHitbox

  • autoFitHitbox(offset?: Vector2): void

bounceVelocityBounds

  • bounceVelocityBounds(bounds?: BoundsLike, restitution?: number): void

detachChild

detachFrom

getBottom

  • getBottom(): number

getCenter

getCenterX

  • getCenterX(): number

getCenterY

  • getCenterY(): number

getLeft

  • getLeft(): number

getRight

  • getRight(): number

getTop

  • getTop(): number

isColliding

isCollidingGroup

reflectVelocity

  • reflectVelocity(): void
  • memberof

    PhysicsBody

    description

    Reflects the velocity, sets the velocity as the opposite value of the velocity, PhysicsBody.options.type must be KinematicBody or RigidBody

    example

    myPhysicsBody.setVelocity('x', 3); myPhysicsBody.reflect(); // velocity: 0, -3

    since

    2.0.0

    Returns void

scaleHitbox

setEnabled

  • setEnabled(enabled: boolean): boolean

setFillColor

  • setFillColor(fillColor: string): void

setScale

  • setScale(scale: number | Scale): void

setType

setVelocity

  • setVelocity(axis: "x" | "y", pxPerSecond: number): void
  • memberof

    PhysicsBody

    description

    Sets the velocity based on an axis, PhysicsBody.options.type must be KinematicBody

    since

    2.0.0

    Parameters

    • axis: "x" | "y"

      The axis to set the velocity of

    • pxPerSecond: number

      The value to set the velocity axis as, in pixels per second

    Returns void

setVelocityX

  • setVelocityX(pxPerSecond: number): void
  • memberof

    PhysicsBody

    description

    Sets the velocity.x, PhysicsBody.options.type must be KinematicBody

    since

    2.0.0

    Parameters

    • pxPerSecond: number

      The value to set the velocity axis as, in pixels per second

    Returns void

setVelocityY

  • setVelocityY(pxPerSecond: number): void
  • memberof

    PhysicsBody

    description

    Sets the velocity.y, PhysicsBody.options.type must be KinematicBody

    since

    2.0.0

    Parameters

    • pxPerSecond: number

      The value to set the velocity.y as, in pixels per second

    Returns void

setVisible

  • setVisible(visible: boolean): void
  • memberof

    GameObject

    description

    Sets the visible property and calls the game.renderer.pipeline.pool method to immediately update the visibility

    Note: this calls Game.renderer.pipeline.pool to immediately update the visibility

    since

    2.1.0

    Parameters

    • visible: boolean

      What to set the visible property to

    Returns void

Generated using TypeDoc