-
Notifications
You must be signed in to change notification settings - Fork 9
Obstacle Minigame ‐ Sprint 1
Anshul Dadhwal edited this page Sep 14, 2023
·
6 revisions
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
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);
}
Camera Movement - Uses setPosition() function of the Entity Class in render()
We collaborated with Team 5 for the design of this ship and agreed on the ship design given below:
Escape Earth Game
Interaction Controller and Interactable Components
Game and Entity Configuration Files
Loading Game Configuration Files