💀
Adam Cleave
  • 💀Adam Cleave's A-Level Project
  • 📖Reference Page
  • 🖊️1 Analysis
    • 1.1 Problem Identification
    • 1.2 Stakeholders
    • 1.3 Research
    • 1.4a Features of Proposed Solution
    • 1.4b Computational Methods
    • 1.5 Success Criteria
    • 1.6 Hardware and Software Requirements
  • 🎨2 Design and Development
    • 2.1 Design Frame
    • 2.2.1 Cycle 1 - Player and Boundaries
    • 2.2.2 Cycle 2 - Movement
    • 2.2.3 Cycle 3 - Jumping and Perspective
    • 2.2.4 Cycle 4 - First Level
    • 2.2.5 Cycle 5 - Grunts
    • 2.2.6 Cycle 6 - Level Change
    • 2.2.7 Cycle 7 - Second Level
    • 2.2.8 Cycle 8 - Background Music
    • 2.2.9 Cycle 9 - Twines
  • 👨‍🔬3 Testing
    • 3.1 Testing for Function and Robustness
    • 3.2 Usability Testing
    • 3.3 Checking Development Tests
  • 📄4 Evaluation
    • 4.1 Evaluation of Success Criteria
    • 4.2 Evaluation of Usability Features
    • 4.3 Maintenance and Future Development
Powered by GitBook
On this page
  • Design:
  • Objectives
  • Usability Features
  • Key Variables
  • Pseudocode
  • Development:
  • Outcome
  • Challenges
  • Testing:
  • Tests
  • Evidence
  1. 2 Design and Development

2.2.2 Cycle 2 - Movement

Previous2.2.1 Cycle 1 - Player and BoundariesNext2.2.3 Cycle 3 - Jumping and Perspective

Last updated 1 year ago

Design:

Objectives

In the second cycle, my objectives are to implement the basic controls and allow the player's character to move around the screen. Completing the steps in this order should lay out a strong, progressive structure for my game. The layers don't need to be too detailed at this point, graphics quality improvements can be adjusted later on.

Usability Features

Implementing my simple game controls into the project. This will allow the user to move their character around the map as discussed in .

Key Variables

Variable Name
Use

moveSpeed

Defines the value for player movement speed.

Pseudocode

define(moveSpeed)
if up arrow pressed: { 
  move player up by moveSpeed
};
if left arrow pressed: {
  move player left by moveSpeed
};
if down arrow pressed: {
  move player down by moveSpeed
};
if right arrow pressed: {
  move player right by moveSpeed
};

Development:

Outcome

  • The player is now able to be controlled once they have been rendered, the code for this can be viewed below:

// MOVEMENT

// Define player movement speed (pixels per second)
const moveSpeed = 320

// jump when player presses "space" key
onKeyDown("space", () => {
    // .jump() is provided by the body() component
    player.jump()
})

// jump when player presses "up" key
onKeyDown("up", () => {
	player.jump()
})

// onKeyDown() registers an event that runs every frame as long as user is holding a certain key
onKeyDown("left", () => {
	// .move() is provided by pos() component, move by pixels per second
	player.move(-moveSpeed, 0)
})

onKeyDown("right", () => {
	player.move(moveSpeed, 0)
})

onKeyDown("down", () => {
	player.move(0, moveSpeed)
})

Challenges

Some challenges I faced during this cycle:

  • Finding the correct code to correspond with the selected key bindings.

  • Allowing multiple actions at once (jump and direction).

Testing:

Tests performed in this cycle are evidenced below, they were a crucial aspect of my development.

Tests

Test
Instructions
What I expect
What actually happens
Pass/Fail

1

Run code.

The game to start, boundaries still rendered and player still placed.

As expected

Pass

2

Movement keys: WASD are pressed.

The player is able to move in all directions. This includes the ability to jump.

As expected

Pass

Evidence

The screen recording below shows the rendered sprite after moving from its original position, it completes the following tasks for this cycle:

The code snippet below shows Javascript for the basic controls used, it completes the following tasks for this cycle:

// jump when player presses "space" key
onKeyDown("space", () => {
    // .jump() is provided by the body() component
    player.jump()
})

// jump when player presses "up" key
onKeyDown("up", () => {
	player.jump()
})

// onKeyDown() registers an event that runs every frame as long as user is holding a certain key
onKeyDown("left", () => {
	// .move() is provided by pos() component, move by pixels per second
	player.move(-moveSpeed, 0)
})

onKeyDown("right", () => {
	player.move(moveSpeed, 0)
})

onKeyDown("down", () => {
	player.move(0, moveSpeed)
})

Utilise basic controls for the movement as specified in .

🎨
1.5 Success Criteria
1.5 Success Criteria
1.5 Success Criteria