Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs

Grayt Apps - Orbit dev log

A topic by Grayt Apps created Jan 15, 2016 Views: 579 Replies: 2
Viewing posts 1 to 3
Submitted

The game i made is an awesome casual game where the user controls the speed of their space ship orbiting earth, in order to avoid incoming asteroids.

The basic components specific to my game are as follows:

when user touches anywhere on screen, start game

Have ship going around earth

when user touches screen slow down ship

when user is not touching screen make sure ship gets back to normal speed

Have asteroid coming from top and bottom of screen (not right and left because not so much reaction time)

Since i started using libGdx recently, i haven't got a chance to experiment with the Scene2d skin library, and viewport library, so i created my own makeshift button library, and scaling system. But i look forward to learning more about of libGdx's skin, and scaling libraries.

The other visual components (i.e. buttons, text) are maintained as follows:

Assets class that scales images properly

have a class to handle text on screen at different stages of game

have a class to handle which buttons should appear at different stages of game

Submitted

SPECIFIC GAME COMPONENTS


I created a SpaceShip class, an Asteroid class, an AsteroidHandler class, and a StateHandler class to monitor the different states of the game i.e. START, RUNNING.

SpaceShip

There is a begin method that when called, adds a forever action to the space ship that will rotate it around the origin that was set in it's constructor.

In it's act method, it checks whether screen has a touch event.

If it does it sets a timer to slowly slow down the space ship to make it look more realistic.

If the current speed is less than the fall back speed, the space ship sets a timer to do the opposite of the previous.

Additionally SpaceShip records the current score, every time it completes an orbit around earth. At finishing its rotation should be a multiple of 360.

Asteroid

Is added to stage via a parent - AsteroidHandler.

Requires for its constructor a place to start, and a place to finish. The place to start, and end have to be on the edge of screen, because asteroids travel from one end to the other end of the screen.Asteroid then takes these values, and sets a moveTo action with the respective values.

In its act method it tests whether it still has actions assigned to it. If not, then it removes itself from its parent - AsteroidHandler.

AsteroidHandler

Responsible for creating asteroids, and testing if there is collision between any of its children (asteroids), and the space ship.

There is a begin method that when called, creates a timer that runs forever adding asteroids every second.

Asteroids are added with a random number seed. The random number generates its start position, and is required to make the asteroid's end position more than or less than its start position respectively. This ensures that it will have a general diagonal direction, which will not create impossible scenarios with the space ships travel.

StateHandler

Hosts an enum with the game states: START, RUNNIG, PAUSE, GAMEOVER. (note PAUSE is not used)

Is responsible for setting state to RUNNING when user touches anywhere outside of the earth, or spaceship. If user touches one of those, they handle it and call the StateHanlder's startGame() method.

Aside for that responsibility, it is the central point to make state changes, meaning AsteroidHandler will set the current state held within StateHandler, when there is a collision.

Submitted (2 edits)

GENERAL UI COMPONENTS


ScalingUtil

Contains static method that is used globally.

Wherever an x or y coordinate is needed to define a location, the object that requires so, calls on the static scaling method to scale the value to the current screens ratio.

There is an option to scale by the height or width.


Assets

Holds all game assets.

The way i designed my scaling system, is that each asset has an option to be scaled by height, or width. Once decided, that value is then applied to the Sprite's width and height.

For example the earth image in the middle of the screen is scaled by width because i don't ever want it exceeding the boundaries of the screen's width.

Also has a dispose method which is called when the game is disposed.