2.2.3 Cycle 3 - Screen Boundaries
Design
Objectives
In this cycle I aim to add boundaries to the game so that the player doesn't move off the edge of the screen as this causes issues when playing, as the player can't see their sprite.
Usability Features
Key Variables
collideWorldBounds
This is a part of Phaser 2 that allows you to set so the player doesn't move out of bounds.
Pseudocode
procedure create
...
player collides with WorldBounds = true; //player cannot leave world bounds
...
end procedure
Development
Outcome
From this I was able to create the code that allowed my player to move more fluidly and predictably, whilst being natural to use, and remaining similar to movement in a low gravity environment.
function create(){
...
player.body.collideWorldBounds = true; //player cannot leave world bounds
...
}
Challenges
I didn't find this part of the program too difficult as it was well documented and there were lots of examples online.
Testing
Evidence for testing
Tests
1
Press the arrow keys or WASD.
The player to move to the edge of the screen and go no further
As expected
Evidence

What next?
I'd like to add the enemies to the game as they are a key part that I need to continue development of other features
Last updated