Phaser 3 Most common functions

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/16

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

17 Terms

1
New cards

this.add.image(x, y, key)

Adds a static image

2
New cards

preload()

Loads assets like images, sounds, and spritesheets BEFORE creation

3
New cards

create()

Sets up the game objects after loading assets

4
New cards

update(time, delta)

Runs every frame to update game logic. Parameters in this function are optional.

5
New cards

this.add.sprite(x, y, key)

Adds a sprite (for animation)

6
New cards

this.add.text(x, y, ‘text‘, {text options like fontSize, color, etc})

Adds text

7
New cards

this.physics.add.sprite(x, y, key)

Adds a physics-enabled sprite

8
New cards

this.physics.add.collider(obj1, obj2)

Adds collision between objects

9
New cards

this.physics.add.overlap(obj1, obj2, callback)

Detects overlap without stopping movement. A callback can be used to tell the program what should happen after overlap is detected

10
New cards

this.input.keyboard.createCursorKeys()

Creates a cursor that captures arrow key input

11
New cards

this.player.setVelocity(x, y)

Moves a physics sprite

12
New cards

this.tweens.add({ targets, props })

Animates properties like position, scale, alpha

13
New cards

this.cameras.main.shake(duration)

Adds a camera shake effect

14
New cards

this.time.addEvent({ delay, callback, loop })

Creates timed events

15
New cards

this.scene.start(‘SceneKey‘)

Switches to another scene

16
New cards

this.input.on(‘pointerdown‘, callback)

Detects mouse/touch input. A callback is needed to tell the function what to do when it detects either the mouse or touch input

17
New cards

this.input.keyboard.addKey(‘SPACE‘)

Captures specific key presses