-
Notifications
You must be signed in to change notification settings - Fork 54
fix: readme + phaser recs example #287
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -85,7 +85,7 @@ export default class SceneMain extends Scene { | |
return chunk; | ||
} | ||
|
||
update() { | ||
async update() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Avoid making the Making the Apply this diff to remove the - async update() {
+ update() { In each movement case, remove the if (null !== this.keyW && this.keyW.isDown) {
this.followPoint.y -= this.cameraSpeed;
this.cameras.main.centerOn(this.followPoint.x, this.followPoint.y);
- await this.dojo.systemCalls.move(this.dojo.account, Direction.Up);
+ this.dojo.systemCalls.move(this.dojo.account, Direction.Up);
return;
} Consider handling the promises returned by
|
||
if (this.followPoint === null || this.followPoint === undefined) { | ||
throw new Error("failed to initialize followPoint"); | ||
} | ||
|
@@ -135,25 +135,28 @@ export default class SceneMain extends Scene { | |
if (null !== this.keyW && this.keyW.isDown) { | ||
this.followPoint.y -= this.cameraSpeed; | ||
this.cameras.main.centerOn(this.followPoint.x, this.followPoint.y); | ||
this.dojo.systemCalls.move(this.dojo.account, Direction.Up); | ||
await this.dojo.systemCalls.move(this.dojo.account, Direction.Up); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add error handling for asynchronous movement commands When calling Apply this diff to add error handling: // Up direction
if (null !== this.keyW && this.keyW.isDown) {
this.followPoint.y -= this.cameraSpeed;
this.cameras.main.centerOn(this.followPoint.x, this.followPoint.y);
- await this.dojo.systemCalls.move(this.dojo.account, Direction.Up);
+ try {
+ await this.dojo.systemCalls.move(this.dojo.account, Direction.Up);
+ } catch (error) {
+ console.error('Failed to move Up:', error);
+ }
return;
}
// Down direction
if (null !== this.keyS && this.keyS.isDown) {
this.followPoint.y += this.cameraSpeed;
this.cameras.main.centerOn(this.followPoint.x, this.followPoint.y);
- await this.dojo.systemCalls.move(this.dojo.account, Direction.Down);
+ try {
+ await this.dojo.systemCalls.move(this.dojo.account, Direction.Down);
+ } catch (error) {
+ console.error('Failed to move Down:', error);
+ }
return;
}
// Left direction
if (null !== this.keyA && this.keyA.isDown) {
this.followPoint.x -= this.cameraSpeed;
this.cameras.main.centerOn(this.followPoint.x, this.followPoint.y);
- await this.dojo.systemCalls.move(this.dojo.account, Direction.Left);
+ try {
+ await this.dojo.systemCalls.move(this.dojo.account, Direction.Left);
+ } catch (error) {
+ console.error('Failed to move Left:', error);
+ }
return;
}
// Right direction
if (null !== this.keyD && this.keyD.isDown) {
this.followPoint.x += this.cameraSpeed;
this.cameras.main.centerOn(this.followPoint.x, this.followPoint.y);
- await this.dojo.systemCalls.move(
- this.dojo.account,
- Direction.Right
- );
+ try {
+ await this.dojo.systemCalls.move(
+ this.dojo.account,
+ Direction.Right
+ );
+ } catch (error) {
+ console.error('Failed to move Right:', error);
+ }
return;
} This ensures that any errors during the movement calls are handled appropriately, preventing potential crashes. Also applies to: 143-143, 149-149, 155-158 |
||
return; | ||
} | ||
if (null !== this.keyS && this.keyS.isDown) { | ||
this.followPoint.y += this.cameraSpeed; | ||
await this.dojo.systemCalls.move(this.dojo.account, Direction.Down); | ||
this.cameras.main.centerOn(this.followPoint.x, this.followPoint.y); | ||
this.dojo.systemCalls.move(this.dojo.account, Direction.Down); | ||
return; | ||
} | ||
if (null !== this.keyA && this.keyA.isDown) { | ||
this.followPoint.x -= this.cameraSpeed; | ||
await this.dojo.systemCalls.move(this.dojo.account, Direction.Left); | ||
this.cameras.main.centerOn(this.followPoint.x, this.followPoint.y); | ||
this.dojo.systemCalls.move(this.dojo.account, Direction.Left); | ||
return; | ||
} | ||
if (null !== this.keyD && this.keyD.isDown) { | ||
this.followPoint.x += this.cameraSpeed; | ||
await this.dojo.systemCalls.move( | ||
this.dojo.account, | ||
Direction.Right | ||
); | ||
this.cameras.main.centerOn(this.followPoint.x, this.followPoint.y); | ||
this.dojo.systemCalls.move(this.dojo.account, Direction.Right); | ||
return; | ||
} | ||
|
||
|
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.
Remove duplicate submodule entries
The newly added submodule entry for "worlds/dojo-starter" (lines 10-12) is a duplicate of the existing entry (lines 1-3). Additionally, there's a duplicate entry for "onchain-dash" (lines 7-9). Duplicate entries in the
.gitmodules
file can lead to confusion and potential issues with Git submodule management.To resolve this, please remove the duplicate entries. Here's the suggested change:
This change will maintain the correct submodule configurations without redundancy.
📝 Committable suggestion