Rocks and woods layout optimization - UQdeco2800/2021-ext-studio-2 GitHub Wiki

Overview

From sprint 3's user testing, we discovered that the character will stuck between some rocks and woods, so we made some rocks and layout changes in sprint4

Code implementation

Create line of 5 woods in the sky

 Create the game "wood" obstacle
 A row of 5 woods in a straight line suspended in the air
 The spawnWoodssone function will be called at MainGameScreen.java and will appear when switching to a new map.
 "spawnEntityAt" function helps us choose the coordinate position of the center of the wood, from there using wood.png and will scale the size of the rock horizontally and vertically.
public void spawnWoodsone(int xValue) {

        for (int i = 0; i < 5; i++) {
            GridPoint2 pos = new GridPoint2(xValue +i, 55);
            Entity wood = ObstacleFactory.createWood();
            spawnEntityAt(wood, pos, true, false);
        }
    }

Create line of 3 woods in the sky

 Create the game "wood" obstacle
 A row of 5 woods in a straight line suspended in the air
 The spawnWoodssone function will be called at MainGameScreen.java and will appear when switching to a new map.
 "spawnEntityAt" function helps us choose the coordinate position of the center of the wood, from there using wood.png and will scale the size of the rock horizontally and vertically.
public void spawnWoodstwo(int xValue) {

        for (int i = 0; i < 3; i++) {
            GridPoint2 pos = new GridPoint2(xValue -5 +i, 55);
            Entity wood = ObstacleFactory.createWood();
            spawnEntityAt(wood, pos, true, false);
        }
    }

Create line of 2 woods in the sky

 Create the game "wood" obstacle
 A row of 5 woods in a straight line suspended in the air
 The spawnWoodsthree function will be called at MainGameScreen.java and will appear when switching to a new map.
 "spawnEntityAt" function helps us choose the coordinate position of the center of the wood, from there using wood.png and will scale the size of the rock horizontally and vertically.
public void spawnWoodsthree(int xValue) {

        for (int i = 0; i < 2; i++) {
            GridPoint2 pos = new GridPoint2(xValue +6 +i, 53);
            Entity wood = ObstacleFactory.createWood();
            spawnEntityAt(wood, pos, true, false);
        }
    }

Create line of 2 woods in the sky

 Create the game "wood" obstacle
 A row of 5 woods in a straight line suspended in the air
 The spawnWoodsfour function will be called at MainGameScreen.java and will appear when switching to a new map.
 "spawnEntityAt" function helps us choose the coordinate position of the center of the wood, from there using wood.png and will scale the size of the rock horizontally and vertically.
public void spawnWoodsfour(int xValue) {

        for (int i = 0; i < 2; i++) {
            GridPoint2 pos = new GridPoint2(xValue +9 +i, 54);
            Entity wood = ObstacleFactory.createWood();
            spawnEntityAt(wood, pos, true, false);
        }
    }

Create line of 5 woods in the sky

 Create the game "wood" obstacle
 A row of 5 woods in a straight line suspended in the air
 The spawnWoodsfive function will be called at MainGameScreen.java and will appear when switching to a new map.
 "spawnEntityAt" function helps us choose the coordinate position of the center of the wood, from there using wood.png and will scale the size of the rock horizontally and vertically.
public void spawnWoodsfive(int xValue) {

        for (int i = 0; i < 2; i++) {
            GridPoint2 pos = new GridPoint2(xValue +12 +i, 56);
            Entity wood = ObstacleFactory.createWood();
            spawnEntityAt(wood, pos, true, false);
        }
    }

Create rock pyramid.

public void spawnRockstwo(int xValue) {

        GridPoint2 Pos = new GridPoint2(xValue + 10, 50);
        Entity rock = ObstacleFactory.createRock();
        spawnEntityAt(rock, Pos, true, false);
        GridPoint2 PosTwo = new GridPoint2(xValue + 11, 51);
        Entity rockTwo = ObstacleFactory.createRock();
        spawnEntityAt(rockTwo, PosTwo, true, false);
        GridPoint2 PosThree = new GridPoint2(xValue + 12, 52);
        Entity rockThree = ObstacleFactory.createRock();
        spawnEntityAt(rockThree, PosThree, true, false);
        GridPoint2 PosFour = new GridPoint2(xValue + 12, 51);
        Entity rockFour = ObstacleFactory.createRock();
        spawnEntityAt(rockFour, PosFour, true, false);
        GridPoint2 PosFive = new GridPoint2(xValue + 12, 50);
        Entity rockFive = ObstacleFactory.createRock();
        spawnEntityAt(rockFive, PosFive, true, false);
        GridPoint2 PosSix = new GridPoint2(xValue + 11, 50);
        Entity rockSix = ObstacleFactory.createRock();
        spawnEntityAt(rockSix, PosSix, true, false);
    }