Skip to content

Obstacle Minigame ‐ Sprint 1

Anshul Dadhwal edited this page Sep 14, 2023 · 6 revisions

Introduction

The obstacle minigame feature is implemented in the game as an immersive experience for the player to solve problems when exiting one planet to another (i.e. transitioning from one map to another map). The obstacle minigame, at its core, is a short time-based minigame where the player must navigate their spaceship along a maze and figure their way out to the exit point which is represented in the form of a wormhole in the map.

Members

Anshul Dadhwal (@AnshulDadhwal)
Arsh Upadhyaya (@mr-popo123)
Manpreet Singh (@Manpreetingh)
Zhen Feng (@Foref)

Player Guide

The player can do basic movements with the ship using the arrow keys as follows:

D and -- Move Right
A and -- Move Left
W and -- Move Up
A and -- Move Down

Code Documentation

Method for creating asteroids

private void spawnAsteroids() {
//Extra Spicy Asteroids
GridPoint2 posAs = new GridPoint2(22, 10);
spawnEntityAt(ObstacleFactory.createAsteroid(ASTEROID_SIZE,ASTEROID_SIZE), posAs, false, false);
}

Method for spawning asteroids to the right recursively

private void spawnStaticAsteroidsRight(int n, GridPoint2 pos){
        if (n <= 0) {
            return;
        }

        spawnEntityAt(
                ObstacleFactory.createStaticAsteroid(STATIC_ASTEROID_SIZE, STATIC_ASTEROID_SIZE), pos, false, false);

        // Increment the position for the next asteroid
        pos.x += 1;
        pos.y += 0;
        spawnStaticAsteroidsRight(n - 1, pos); // Recursive call
}

Method for spawning exit point

private void spawnGoal(){
        GridPoint2 position = new GridPoint2(24,10);
        spawnEntityAt(
        ObstacleFactory.createObstacleGameGoal(WORMHOLE_SIZE,WORMHOLE_SIZE), position,false,false);
}

Method for spawning ship

private void spawnShip(){
        Entity newShip = ShipFactory.createShip();
        spawnEntityAt(newShip, SHIP_SPAWN, true, true);
        targetables.add(newShip);
}

Assets/Design Decisions

Design of Spaceship

We collaborated with Team 5 for the design of this ship and agreed on the ship design given below:

mainship03-2

Design of Asteroids

Asteroids

Design of Wormhole

Wormhole

Design of Map tile

Map

Design of Enemy

Obstacle-Enemy

Camera Movement

Uses setPosition() function of the Entity Class in render()<> CameraBasic

UML Diagram

Clone this wiki locally