-
Notifications
You must be signed in to change notification settings - Fork 22.9k
Update Phaser in "2D breakout game using Phaser" #40581
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
… the live sample)
…3.90 (except for the live sample)
…r the live sample
…aser 3.90 I'm going to add the asset images later
I revised the root path in mdn/shared-assets#55
Thanks @igrep I am removing my assignment as I am not familiar with this code or games in particular. There are a lot of reviewers on holiday at the moment, so this may not be picked up in a short timeframe. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry I had a review but looks like I failed to commit it. I'm happy to take this on.
function preload() { | ||
// … | ||
game.load.image("brick", "img/brick.png"); | ||
preload () { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This kind of code doesn't parse correctly, so as you can see it's not correctly formatted and will make my linter choke. You would need to wrap it with any necessary context. What I usually do is
class Example extends Phaser.Scene {
// ...
preload() {
// ...
this.load.image("brick", "img/brick.png");
}
// ...
}
You would need to update all other cases like this as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! Fixed it by a5e4b71
Thank you. @igrep You're in the safest of hands. |
files/en-us/games/tutorials/2d_breakout_game_phaser/randomizing_gameplay/index.md
Outdated
Show resolved
Hide resolved
files/en-us/games/tutorials/2d_breakout_game_phaser/the_score/index.md
Outdated
Show resolved
Hide resolved
files/en-us/games/tutorials/2d_breakout_game_phaser/win_the_game/index.md
Outdated
Show resolved
Hide resolved
😕Weird. Why did the formatter suggest only 3 blocks to change even after fixing the syntax errors pointed out by #40581 (comment)? I tried |
I'm working on this locally and I think it's safe to remove all of the repo links, because the code is inside the live samples anyway. External repos, whether hosted somewhere else or in the |
} | ||
</style> | ||
<script src="js/phaser.min.js"></script> | ||
</head> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(In the line above) Should we consistently use the CDN version instead of a local version? (No strong opinions)
You can check the finished code for this lesson in the live demo below, and play with it to understand better how it works: | ||
|
||
{{JSFiddleEmbed("https://jsfiddle.net/end3r/436bckb7/","","400")}} | ||
_NOTE_: Due to the limitations of the live demo, you will not see the alert. The game will immediately reload when the ball goes out of bounds. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI here's how you allow alert()
:
{{EmbedLiveSample("compare your code", "", 480, , , , , "allow-modals")}}
I'm going to remove the alert()
anyway because it's quite annoying.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've verified that everything works as intended. Thank you so, so much! You really deserve a big medal for all this work.
@igrep I just realized we have another page using Phaser 2: https://developer.mozilla.org/en-US/docs/Games/Tutorials/HTML5_Gamedev_Phaser_Device_Orientation wondering if you are interested in updating that one as well. No pressure though. |
Thank you very much for modifying and merging!
I agree. However, we should consider the difference between the local version and the live sample:
If I remember, after Phaser 4 gets stabilized enough (currently it's in RC) 😅 |
Description
I migrated all the examples and the descriptions in the "2D breakout game using Phaser" tutorial to Phaser 3. I also migrated the live samples from JSFiddle.
Motivation
Same as #35578
Additional details
Related issues and pull requests
Fixes #35578
Part of #40520