Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
bb6e329
Update lesson 1 "Initialize the framework" to Phaser 3.90 (except for…
igrep Jul 13, 2025
ccb6b7f
Forgot to update the URL to the example
igrep Jul 13, 2025
d3ae4c6
Update lesson 2 "Scaling" to Phaser 3.90 (except for the live sample)
igrep Jul 13, 2025
4064490
Update lesson 3 "Load the assets and print them on screen" to Phaser …
igrep Jul 15, 2025
d3e834a
Update lesson 4 "Move the ball" to Phaser 3.90 (except for the live s…
igrep Jul 16, 2025
6c4d861
Update lesson 5 "Physics" to Phaser 3.90 (except for the live sample)
igrep Jul 17, 2025
cda4007
Update lesson 6 "Bounce off the walls" to Phaser 3.90 (except for the…
igrep Jul 19, 2025
3a1c01e
(WIP) Update lesson 7 "Player paddle and controls" to Phaser 3.90
igrep Jul 20, 2025
3deac1b
Update lesson 7 "Player paddle and controls" to Phaser 3.90 except fo…
igrep Jul 21, 2025
19a5a93
Update the live sample in lesson 7 "Player paddle and controls" to Ph…
igrep Jul 21, 2025
5eadc1e
Correct the path to the assets in the live sample
igrep Jul 23, 2025
753cf50
Update lesson 8 "Game over" to Phaser 3.90
igrep Jul 23, 2025
0ce3ffd
Update lesson 9 "Build the brick field" to Phaser 3.90
igrep Jul 26, 2025
083a83a
Update lesson 10 "Collision detection" to Phaser 3.90
igrep Jul 26, 2025
a557f4b
Update lesson 11 "The score" to Phaser 3.90
igrep Jul 26, 2025
3014535
Modify lesson 11 "The score" to Phaser 3.90
igrep Jul 26, 2025
32d2919
Modify lesson 11 "The score" to Phaser 3.90
igrep Jul 26, 2025
6429f21
Modify lesson 12 "Win the game" to Phaser 3.90
igrep Jul 26, 2025
14b3dcd
(WIP) Modify lesson 13 "Extra lives" to Phaser 3.90
igrep Jul 27, 2025
5b37cab
Modify lesson 13 "Extra lives" to Phaser 3.90
igrep Jul 28, 2025
e40e328
Modify lesson 14 "Extra lives" to Phaser 3.90
igrep Jul 28, 2025
b3e64ab
(WIP) Modify lesson 15 "Buttons" to Phaser 3.90
igrep Jul 29, 2025
59be5d9
Modify lesson 15 "Buttons" to Phaser 3.90
igrep Jul 31, 2025
26ec9c4
Modify lesson 16 "Randomizing gameplay" to Phaser 3.90
igrep Jul 31, 2025
4ef696f
Migrate all the lessons to live sample from JSFiddle
igrep Jul 31, 2025
a5e4b71
Fix syntax errors in the example code and several parts I forgot to fix
igrep Aug 1, 2025
854560b
Apply formatter
igrep Aug 2, 2025
a186193
Updates
Josh-Cena Aug 2, 2025
16fdcc0
Fix grammar
Josh-Cena Aug 2, 2025
3287b45
Final tweaks
Josh-Cena Aug 2, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update lesson 7 "Player paddle and controls" to Phaser 3.90 except fo…
…r the live sample
  • Loading branch information
igrep committed Jul 31, 2025
commit 3deac1b83ebef5015eb6762e7eecdba762bcff93
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@ this.paddle = this.add.sprite(

We can use the `scale.width` and `scale.height` values to position the paddle exactly where we want it: `this.scale.width * 0.5` will be right in the middle of the screen. Typically, the `scale.width` and `scale.height` are the same as those in the `config` object, which represent the canvas's size before the scale factor is applied.

// TODO: Phaser 3's default origin is 0.5, 0.5, so we don't need to set it explicitly here.
As you'll notice if you reload your `index.html` at this point, the paddle is currently not exactly in the middle. Why? Because the origin from which the position is calculated always starts from the top left edge of the object. We can change that to have the origin in the middle of the paddle's width and at the bottom of its height, so it's easier to position it against the bottom edge. Add the following line below the previous new one:
As you'll notice if you reload your `index.html` at this point, the paddle is currently at the complete bottom of the screen, too low for the paddle. Why? Because the origin from which the position is calculated starts from the center of the object. We can change that to have the origin in the middle of the paddle's width and at the bottom of its height, so it's easier to position it against the bottom edge. Add the following line below the previous new one:

```js
this.paddle.setOrigin(0.5, 1);
Expand Down