Skip to content

Game Background

ShiyanSu edited this page Sep 14, 2021 · 15 revisions

Purpose

The new game background is implemented to better fit the game's story setting. Therefore, to provide the player a more immersive gaming experience and more attractive visuals.

Implementation

Key Components

  • background images The images that make up the background of the game, background_rock.png, background_star.png, background_stars.png, background_sky.png, background_surface.png.
  • TerrainFactory The new background images have to be initialized in createTerrain() and give them actual position in createSideScrollTiles().

Usage

  1. Initializing the background images in createTerrain().
case SIDE_SCROLL_ER:
        TextureRegion surface =
                new TextureRegion(resourceService.getAsset("images/background_surface.png", Texture.class));
        TextureRegion underground =
                new TextureRegion(resourceService.getAsset("images/background_rock.png", Texture.class));
        TextureRegion sky =
                new TextureRegion(resourceService.getAsset("images/background_sky.png", Texture.class));
        TextureRegion star =
                new TextureRegion(resourceService.getAsset("images/background_star.png", Texture.class));
        return createSideScrollTerrain(0.5f, surface, underground, sky, star);
  1. Arrange the position of each background image in createSideScrollTiles() when they appear in the game.
fillTilesAt(layer, new GridPoint2(0, 0), new GridPoint2(100, 9), undergroundTile);
    fillTilesAt(layer, new GridPoint2(0, 9), new GridPoint2(100, 10), surfaceTile);
    fillTilesAt(layer, new GridPoint2(0, 10), new GridPoint2(100, 20), skyTile);
    fillTilesAt(layer, new GridPoint2(0, 20), new GridPoint2(10, 21), skyTile);
    fillTilesAt(layer, new GridPoint2(10, 20), new GridPoint2(11, 21), starTile);
    fillTilesAt(layer, new GridPoint2(11, 20), new GridPoint2(57, 21), skyTile);
    fillTilesAt(layer, new GridPoint2(57, 20), new GridPoint2(58, 21), starTile);
    fillTilesAt(layer, new GridPoint2(58, 20), new GridPoint2(98, 21), skyTile);
    fillTilesAt(layer, new GridPoint2(98, 20), new GridPoint2(99, 21), starTile);
    fillTilesAt(layer, new GridPoint2(99, 20), new GridPoint2(100, 21), skyTile);
    fillTilesAt(layer, new GridPoint2(0, 21), new GridPoint2(100, 22), skyTile);
    fillTilesAt(layer, new GridPoint2(0, 22), new GridPoint2(15, 23), skyTile);
    fillTilesAt(layer, new GridPoint2(15, 22), new GridPoint2(16, 23), starTile);
    fillTilesAt(layer, new GridPoint2(16, 22), new GridPoint2(18, 23), skyTile);
    fillTilesAt(layer, new GridPoint2(18, 22), new GridPoint2(19, 23), starTile);
    fillTilesAt(layer, new GridPoint2(19, 22), new GridPoint2(31, 23), skyTile);
    fillTilesAt(layer, new GridPoint2(31, 22), new GridPoint2(32, 23), starTile);
    fillTilesAt(layer, new GridPoint2(32, 22), new GridPoint2(70, 23), skyTile);
    fillTilesAt(layer, new GridPoint2(70, 22), new GridPoint2(72, 23), starTile);
    fillTilesAt(layer, new GridPoint2(72, 22), new GridPoint2(100, 23), skyTile);
    fillTilesAt(layer, new GridPoint2(0, 23), new GridPoint2(100, 24), skyTile);
    fillTilesAt(layer, new GridPoint2(0, 24), new GridPoint2(5, 25), skyTile);
    fillTilesAt(layer, new GridPoint2(5, 24), new GridPoint2(6, 25), starTile);
    fillTilesAt(layer, new GridPoint2(6, 24), new GridPoint2(87, 25), skyTile);
    fillTilesAt(layer, new GridPoint2(87, 24), new GridPoint2(88, 25), skyTile);
    fillTilesAt(layer, new GridPoint2(88, 24), new GridPoint2(100, 25), skyTile);

Table of Contents

Home

Introduction

Main Menu

Main Game Screen

Gameplay

Player Movement

Character Animations

Enemy Monster Design and Animations

Game basic functionalities

User Testing

GitHub Wiki Tutorial

Game Engine

Getting Started

Documentation

Entities and Components

Service Locator

Loading Resources

Logging

Unit Testing

Debug Terminal

Input Handling

UI

Animations

Audio

AI

Physics

Game Screens and Areas

Terrain

Concurrency & Threading

Settings

Troubleshooting

MacOS Setup Guide

Clone this wiki locally