hole in one, demo android/dekstop scala game using libgdx

libgdx

I’ve produced this very simple game

source code available here https://github.com/bernardjason/holeinone

I’ve pulled together some code I had to show how to put together something using libgdx and scala that can run on either desktop or android platform. I’ve not tried it with a Mac. This wont work with HTML flavour libgdx as it’s scala.

The game uses the arrow keys, mouse or screen press to move the gun. Press and hold the spacebar, mouse button or screen then release to fire a missile at the bouncing ball.

The intention of this code is something to pick the bones out of or use as a start for something else.

Things of note
file local.properties contains the location of the android sdk. So this needs to be changed to where you’ve installed it.

core/build.gradle has been changed to build scala source

class FlatTerrain extends class BaseTerrain. This class supports an uneven terrain as well as the simple flat terrain shown in the game.

class bernardcjason.gdx.basic.shape.Cuboid shows mapping parts of a texture to a cube. This is a change to the usual mapping of a texture shape which is

to a linear

For collision detection I’ve not used Bullet physics but rather sphere collision bernardcjason.gdx.basic.shape.CollideSphere.