Phaser Press Any Key to Continue

A generic Key object which can be passed to the Process functions (and so on) keycode must be an integer

Constructor:

          new Key(plugin, keyCode)                  

Parameters:

Extends

  • Phaser.Events.EventEmitter

Members

<private> _justDown: boolean

Focus

Focus

Description:

True if the key has just been pressed (NOTE: requires to be reset, see justDown getter)

Default: false

Focus

Focus

<private> _justUp: boolean

Focus

Focus

Description:

True if the key has just been pressed (NOTE: requires to be reset, see justDown getter)

Default: false

Focus

Focus

<private> _tick: number

Focus

Focus

Description:

Internal tick counter.

Focus

Focus

altKey: boolean

Focus

Focus

Description:

The down state of the ALT key, if pressed at the same time as this key.

Default: false

Focus

Focus

ctrlKey: boolean

Focus

Focus

Description:

The down state of the CTRL key, if pressed at the same time as this key.

Default: false

Focus

Focus

duration: number

Focus

Focus

Description:

The number of milliseconds this key was held down for in the previous down - up sequence. This value isn't updated every game step, only when the Key changes state. To get the current duration use the getDuration method.

Default: 0

Focus

Focus

emitOnRepeat: boolean

Focus

Focus

Description:

When a key is held down should it continuously fire the down event each time it repeats?

By default it will emit the down event just once, but if you wish to receive the event for each repeat as well, enable this property.

Default: false

Focus

Focus

enabled: boolean

Focus

Focus

Description:

Can this Key be processed?

Default: true

Focus

Focus

isDown: boolean

Focus

Focus

Description:

The "down" state of the key. This will remain true for as long as the keyboard thinks this key is held down.

Default: false

Focus

Focus

isUp: boolean

Focus

Focus

Description:

The "up" state of the key. This will remain true for as long as the keyboard thinks this key is up.

Default: true

Focus

Focus

keyCode: number

Focus

Focus

Description:

The keycode of this key.

Focus

Focus

location: number

Focus

Focus

Description:

The location of the modifier key. 0 for standard (or unknown), 1 for left, 2 for right, 3 for numpad.

Default: 0

Focus

Focus

metaKey: boolean

Focus

Focus

Description:

The down state of the Meta key, if pressed at the same time as this key. On a Mac the Meta Key is the Command key. On Windows keyboards, it's the Windows key.

Default: false

Focus

Focus

originalEvent: KeyboardEvent

Focus

Focus

Description:

The original DOM event.

Focus

Focus

Focus

Focus

Description:

The Keyboard Plugin instance that owns this Key object.

Type:

Focus

Focus

repeats: number

Focus

Focus

Description:

If a key is held down this holds down the number of times the key has 'repeated'.

Default: 0

Focus

Focus

shiftKey: boolean

Focus

Focus

Description:

The down state of the SHIFT key, if pressed at the same time as this key.

Default: false

Focus

Focus

timeDown: number

Focus

Focus

Description:

The timestamp when the key was last pressed down.

Default: 0

Focus

Focus

timeUp: number

Focus

Focus

Description:

The timestamp when the key was last released.

Default: 0

Focus

Focus

Methods

addListener(event, fn, [context])

Focus

Focus

Description:

Add a listener for a given event.

Parameters:

name type arguments Default description
event string | symbol

The event name.

fn function

The listener function.

context * <optional> this

The context to invoke the listener with.

Returns:

Focus

Focus

destroy()

Focus

Focus

Description:

Removes any bound event handlers and removes local references.

Focus

Focus

emit(event, [args])

Focus

Focus

Description:

Calls each of the listeners registered for a given event.

Parameters:

name type arguments description
event string | symbol

The event name.

args * <optional>

Additional arguments that will be passed to the event handler.

Returns:
Description:

true if the event had listeners, else false.

Focus

Focus

eventNames()

Focus

Focus

Description:

Return an array listing the events for which the emitter has registered listeners.

Type:
  • Array.<(string
  • symbol)>

Focus

Focus

getDuration()

Focus

Focus

Description:

Returns the duration, in ms, that the Key has been held down for.

If the key is not currently down it will return zero.

The get the duration the Key was held down for in the previous up-down cycle, use the Key.duration property value instead.

Returns:
Description:

The duration, in ms, that the Key has been held down for if currently down.

Focus

Focus

listenerCount(event)

Focus

Focus

Description:

Return the number of listeners listening to a given event.

Parameters:

name type description
event string | symbol

The event name.

Returns:
Description:

The number of listeners.

Focus

Focus

listeners(event)

Focus

Focus

Description:

Return the listeners registered for a given event.

Parameters:

name type description
event string | symbol

The event name.

Returns:
Description:

The registered listeners.

Focus

Focus

off(event, [fn], [context], [once])

Focus

Focus

Description:

Remove the listeners of a given event.

Parameters:

name type arguments description
event string | symbol

The event name.

fn function <optional>

Only remove the listeners that match this function.

context * <optional>

Only remove the listeners that have this context.

once boolean <optional>

Only remove one-time listeners.

Returns:

Focus

Focus

on(event, fn, [context])

Focus

Focus

Description:

Add a listener for a given event.

Parameters:

name type arguments Default description
event string | symbol

The event name.

fn function

The listener function.

context * <optional> this

The context to invoke the listener with.

Returns:

Focus

Focus

onDown(event)

Focus

Focus

Description:

Processes the Key Down action for this Key. Called automatically by the Keyboard Plugin.

Parameters:

name type description
event KeyboardEvent

The native DOM Keyboard event.

Focus

Focus

onUp(event)

Focus

Focus

Description:

Processes the Key Up action for this Key. Called automatically by the Keyboard Plugin.

Parameters:

name type description
event KeyboardEvent

The native DOM Keyboard event.

Focus

Focus

once(event, fn, [context])

Focus

Focus

Description:

Add a one-time listener for a given event.

Parameters:

name type arguments Default description
event string | symbol

The event name.

fn function

The listener function.

context * <optional> this

The context to invoke the listener with.

Returns:

Focus

Focus

removeAllListeners([event])

Focus

Focus

Description:

Remove all listeners, or those of the specified event.

Parameters:

name type arguments description
event string | symbol <optional>

The event name.

Returns:

Focus

Focus

removeListener(event, [fn], [context], [once])

Focus

Focus

Description:

Remove the listeners of a given event.

Parameters:

name type arguments description
event string | symbol

The event name.

fn function <optional>

Only remove the listeners that match this function.

context * <optional>

Only remove the listeners that have this context.

once boolean <optional>

Only remove one-time listeners.

Returns:

Focus

Focus

reset()

Focus

Focus

Description:

Resets this Key object back to its default un-pressed state.

Returns:
Description:

This Key instance.

Focus

Focus

setEmitOnRepeat(value)

Focus

Focus

Description:

Controls if this Key will continuously emit a down event while being held down (true), or emit the event just once, on first press, and then skip future events (false).

Parameters:

name type description
value boolean

Emit down events on repeated key down actions, or just once?

Returns:
Description:

This Key instance.

Focus

Focus

shutdown()

Focus

Focus

Description:

Removes all listeners.

Focus

Focus

greeneoned1998.blogspot.com

Source: https://newdocs.phaser.io/docs/3.54.0/Phaser.Input.Keyboard.Key

0 Response to "Phaser Press Any Key to Continue"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel