-
Notifications
You must be signed in to change notification settings - Fork 4
Scrolling Background Explanation
In sprint 2 we decided to design the game background and finish the implementation according to the Gamestory. Current background image is here.
Under the com/deco2800/game/rendering
package. We created a new BackgroundRenderComponent.java
class. The aim of creating this class is to create an object which can render the background image texture.
- The texture path is required in the constructor. This will be efficient for adding different background images(p.s. could be helpful in multiple maps)
public BackgroundRenderComponent(String texturePath) {
this.texturePath = texturePath;
}
2.Considering that the background image needs to be rendered repeatedly during the game. We came out with the solution by creating a global variable private float horizontal
and set it default to zero. Then create a public function to allow changing the horizontal
variable manually.
/**
* Set the horizontal start point for the background texture
* @param x horizontal value
*/
public void setHorizontal(float x) {
horizontal = x;
}
Then, override the following function so that the background image can be drew from different horizontal start point.
@Override
public void draw(SpriteBatch batch) {
batch.draw(texture, -30, 0, 30, 15);
batch.draw(texture, horizontal, 0, 30, 15);
}
3.Under com/deco2800/game/areas/ForestGameArea.java
, two core functions have been added.
The showBackground()
can be called to render the background from the beginning.
private void showBackground() {
Entity gameBg = new Entity();
gameBg.addComponent(new BackgroundRenderComponent("images/background.png"));
spawnEntity(gameBg);
}
And the showScrollingBackground(int counter)
need to be passed into a count number, which will render the background again and again.
public void showScrollingBackground(int counter) {
Entity gameBg = new Entity();
BackgroundRenderComponent newBg = new BackgroundRenderComponent("images/background.png");
newBg.setHorizontal(30f * counter);
gameBg.addComponent(newBg);
spawnEntity(gameBg);
}
4.Under the render()
function in com/deco2800/game/screens/MainGameScreen.java
, the background will be rendered repeatedly until the loop terminate.
...
// infinite loop for terrain and obstacles
if(screenVector.x > (2*counter+1)*10) {
counter+=1;
forestGameArea.showScrollingBackground(counter);
...
Camera Angle and The Player's Perspective
Achievements Trophies and Cards
πΎ Obstacle/Enemy
βMonster Manual
βObstacles/Enemies
ββ- Alien Plants
ββ- Variation thorns
ββ- Falling Meteorites
ββ- FaceHugger
ββ- AlienMonkey
βSpaceship & Map Entry
βParticle effect
[code for debuff animations](code for debuff animations)
Main Character Movement, Interactions and Animations - Code Guidelines
ItemBar & Recycle system
πΎ Obstacle/Enemy
βObstacle/Enemy
βMonster Manual
βSpaceship Boss
βParticle effects
βOther Related Code
βUML & Sequence diagram of enemies/obstacles
Scoring System Implementation Explanation
Buff and Debuff Implementation
Infinite generating terrains Implementation Explanation
Game Over Screen and functions explaination
Buffer timer before game start
Rocks and woods layout optimization
Magma and nails code implementation
Guide: Adding Background music for a particular screen
History Scoreboard - Score Details
Listening for important events in the Achievements ecosystem
Hunger and Thirst icon code guidelines
Hunger and Thirst User Testing
Buff and Debuff Manual User Testing
The New Button User Test in Setting Page
The Main Menu Buttons User Testing
Infinite loop game and Terrain Testing
https://github.com/UQdeco2800/2021-ext-studio-2.wiki.git
πΎ Obstacle/Enemy
βObstacle testing
ββ- Alien Plants & Variation Thorns
ββ- Falling Meteorites
βEnemy testing
ββ- Alien Monkeys & Facehugger
ββ- Spaceship Boss
βMonster Manual
βParticle-effect
βPlayer attack testing
ββ- Player Attack
Sprint 1
Sprint 2
Sprint 3
Sprint 4
Changeable background & Buffer time testing
Game over screen test sprint 4
New terrain textures on bonus map test sprint 4
Achievements System, Game Records and Unlockable Chapters
Musics Implementation Testing plan