Nine Levels (Now available on Google Play)

I have decided to build a platformer game for Android.

Finally released!

Puyjvx7gFe4

In past posts here on JGO I’ve stated multiple times (like this, this or even this) that I will never do another game that requires me to design levels but I think that if I limit the number of levels to a ridiculously low number, like nine, I should be fine.

Link to Google Play;


https://upload.wikimedia.org/wikipedia/commons/thumb/c/cd/Get_it_on_Google_play.svg/320px-Get_it_on_Google_play.svg.png

So I’m going to call this game Nine Levels, it will be a 2D platformer where the objective is to collect all the collectables (most likely gems or coins) as fast as possible. To add replay-value I’ll keep track of the best times and the plan is to also include Google Play leaderboards so that the players can compare their time to other players.

Right now the game is a very early stage and I am trying out some core mechanics that I would like to implement:

  • Basic jumping (obviously)
  • Enemies patrolling between two points
  • Enemies that walk until they hit an obstacle and then turn
  • Enemies that fly and attack when spotting the player
  • Enemies that can be killed by jumping on them
  • Enemies that can be hurt by jumping on them
  • Two way platforms (i.e. platforms that you can jump up through them, but down fall through them)

Additional things

  • Google Play leader board integration
  • Google Play achievements (not sure if this really adds anything)

I am using libGDX for the game library and Box2D for the physics, not because it is necessarily a good fit for platform physics but becuase I really like it and want to get better at it.
Rendered using the debug renderer it right now looks like this:

For graphics and audio I’ll try to find some CC0 licensed assets, which likely will mean I’ll turn to Kenney again as he is awesome.

I’ll try to post somewhat regular updates on my progress here and any comments you guys might have is greatly appreciated.

Thanks.

To implement one-way platforms (that is a platform the player can jump up through, but will not fall down through) I hook into the Box2D contact listener.
My game entities can be either Contactable or Collidable, they’re both sort of similar but have slightly different capabilities:

  • Contactable
    The entities are notified when a contact occurs, at which point they’re given the other object and their Fixture that was involved in the contact.

  • Collidable
    The entities are notified when a collision occurs and can tell Box2D to cancel the collision before any collision response have been applied.


		world.setContactListener(new ContactListener() {
			@Override
			public void preSolve(Contact contact, Manifold oldManifold) {
				Fixture fixtureA = contact.getFixtureA();
				Fixture fixtureB = contact.getFixtureB();
				
				Object userObjectA = fixtureA.getUserData();
				Object userObjectB = fixtureB.getUserData();
				
				boolean disableContact = false;
				if (userObjectA instanceof Collidable)
					disableContact |= ((Collidable)userObjectA).collides(userObjectB);

				if (userObjectB instanceof Collidable)
					disableContact |= ((Collidable)userObjectB).collides(userObjectA);
				
				contact.setEnabled(contact.isEnabled() && !disableContact);
			}
			
			@Override
			public void postSolve(Contact contact, ContactImpulse impulse) {
				contact.setEnabled(true);
			}
			
			@Override
			public void endContact(Contact contact) {
			}
			
			@Override
			public void beginContact(Contact contact) {
				Fixture fixtureA = contact.getFixtureA();
				Fixture fixtureB = contact.getFixtureB();
				Object userObjectA = fixtureA.getUserData();
				Object userObjectB = fixtureB.getUserData();
				
				if (userObjectA instanceof Contactable)
					((Contactable)userObjectA).handleContact(fixtureA, userObjectB);

				if (userObjectB instanceof Contactable)
					((Contactable)userObjectB).handleContact(fixtureB, userObjectA);			
			}
		});

Using these interfaces the Player entity can check when the collision occurs if it is with a part of the terrain that has been marked as one-way, and if it is, cancel it.

			if (terrain.isOneWay()) {
				if (isFallThroughOneWayPlatformsEnabled())
					return true;
				
				if (isMovingUp())
					return true;
				else {
					float py = body.getPosition().y;
					float ty = terrain.getVerticalPosition();
					boolean playerCenterIsBelowTerrain = py < ty;
					
					if (playerCenterIsBelowTerrain)
						return true;
					else {
						boolean playerCenterIsMostlyAboveTerrain = py - ty < Player.bodyRadius * 0.975f;
						if (playerCenterIsMostlyAboveTerrain)
							return true;
					}
				}
			}

It requires a bit of logic to determine if the Player is sufficiently above the platform (in my case 2.5% of the size radius of the player) to enable it, also to allow the player to drop down through a platform on command.

I thought it would be tricky to-get one-way platforms to work but it turned out to be a lot easier than dealing with other edge-cases of the implementation.

So I am using TileD to create the levels and for past project I’ve built the visual parts as tiles and the physics world as geometric shapes in a object layer rather than a tile layer. That approach give great flexibility but it also means that the world has to be defined twice, first visually then physically, it can get a bit messy if the levels have many things going on as can be seen in this gif from a previous project of mine:

For this project I’ve opted for a different approach, this time I’ve applied metadata to the tiles in the tile set used in TileD, and then my level loader reads that and build the physical world from the visual parts.
I’m not sure it’s a better approach yet but so far it seems to be working Ok and I am getting levels built and tested faster than before.

The gif below shows what the first test level looks like with and without the visual parts on top of the physical Box2D world:

I am using a tile set from an artist called GrafxKid, I think it looks cool and it’ll probably be the one I use for the final version.

So I playing around implementingan an enemy, if it walks into the player then the player dies:

Initially I thought I was going to use a Kenney sprite-sheet and my plan was to make the player jump twice on the little alien guys that Kenney has so many of, first jump to knock off their helmet and the second jump to kill them.
I am now leaning towards using this sprite-sheet from GrafxKid instead and as luck would have it he has a character that can be dispatched using two jumps as well:

I am not sure it’s clever to have an NPC that is taller than one tile, but I guess if I design the levels so that they never occupy an area where the available height is just one tile it should be ok.

As this game uses an on-screen joystick and the feel of it is important I wanted to give the player the ability to customize the size a bit.
I’ve added a settings screen where this can be configured and the way it is previewed is by showing the controls as they would appear in game when the user change the size, and then fade them out to avoid them cluttering and making the settings screen confusing:

Update!

I’ve added a HUD showing the number of coins left to collect and the elapsed time (the font used was part of the graphics pack I am using for the levels).

I’ve also fixed it so that spinning coins are displayed and there’s a new type of enemy, a blue slime thingie that right now cannot be destroyed but I am thinking I’ll probably make it so it can be jumped on and squashed or something.

Next task will probably be different materials for the ground as the tile-set comes with this cool winter theme and I want to have slippery ice in the game.

Another update!

I’ve added breakable brick blocks that can be destroyed in a very Marioesq manner by jumping into them from below, each consecutive hit earns one coin and after 4 coins the brick breaks, the idea being that it will provide a choice in some situations; either break the brick as soon as it’s encountered or use is as a step to reach another place first, then come back and break it.

I’ve also added a new enemy, a bird that sits perched until the player gets close then it starts chasing the player, if it gets really close it dashes towards the player at a slightly higher speed.

Next update will be adding music and completing all the levels, after that it’s really only Google Play integration for the leaderboards that remain.

It looks really nice. Can’t wait to play it. =)

Thank you, hopefully it shouldn’t be that much longer until it’s finished.

In the meantime; I’ve added another enemy, this time an exploding pumpkin because what game is complete without one of those:

They drop at a configured interval and walk until they hit another Box2D body, they have a set life-span and at the end they stop and explode.
The explosion causes a small shockwave that might push the player off a ledge if he/she is close enough.

The pumpkins cannot be killed.

Also, posting this gif I realize that the parallax background for this level is wrong, it should be a snowy one instead of grassy hills :emo:

Good work so far, I like it! I’ve made some platformers in the past and found really fun to do and to play :smiley:

Hope you will release soon as desktop/web too so I can try it :smiley:

Idea: add some mid/final bosses and some puzzles, my 2 requests :stuck_out_tongue:

Thank you for the feedback @Gornova, it’s very much appreciated!

Are any of them available somewhere where I can try them?

It’s very likely I’ll disappoint you on both requests I am afraid. :’(

When I did Grapple, I found out that I am not very good at creating platform puzzles. In Nine Levels the only puzzle will be figuring out the fastest way to beat the level.

As for bosses, initially I hadn’t planned on adding any since the game doesn’t really progress like a platformer with an over-arching goal (like saving the Princess in Super Mario Brothers).
Having said that; I also like to incorporate feedback I get as I post the progress here (which is part of the reason I post about my games), so let me get back to you on that one. I just might add some sort of boss :slight_smile: .

Sure, feel free do give us a demo too :stuck_out_tongue:

You can find my games on my blog:

So progress on this is fairly slow but I’m close to a point where I’ve got all the levels playable and most (if not all) of the game mechanics done.

Next large piece of work is Google Play leaderboard integration and creating the store listing, two tasks that are boring and therefore likely to take a lot longer than they should :frowning:

In the meantime; here’s a game-play video that includes the music for the game (the music is made by Sketchylogic):

Puyjvx7gFe4

Apologies for the dodgy frame-rate in the video, capturing it proved more than my old laptop could handle :persecutioncomplex:

Leaderboards are mostly done and I’ve also added an achievement for each level that is unlocked when the level is completed.
As all the levels are named after video game characters the achievements are quotes from those characters:

Here we go!

To the edge of the universe and back.

I’ll always have a minute for you.

Colder than a walk-in fridge.

I hate tombs.

Hiya!

Muscle and motion.

Is that a popcorn machine?

Having completed these means that the game is now feature complete. I’ll spend some time testing it and then I’ll release it to Google Play.

If anyone who’s on Android is interested in helping me test this, feel free to send me your gmail address and I’ll add you to the list of alpha testers.

I’ve created an attempt at a Google Play store trailer for the game, any feedback you guys might have is greatly appreciated.

w1iV6nbeaZw

The recording feels like the game was lagging big time. A little painful to watch actually. I wouldn’t recommend using it on the store page. Content wise, It was lovely, but hard to watch.

I’m on a crappy old laptop that struggles with capturing at a decent frame-rate, I’ve created a new version where I’ve tried to address this to a certain extent.
I’ve also compressed it in time and tried to be more visible about the fact that it is not an auto-runner (so I have more footage of the player running to the left).

New version of the trailer:

3-uzczmH2to

Thanks for your comment @zngga, I very much appreciate it.

That is so much better!

Yes, much better.

Only one tip:
All in all imho you should make the trailer a little bit shorter. There are sequences where you are running or collecting coins. And you have seen it some seconds before too. You know most players “have no time” and they dont like repetition.

Fair point, I’ll cut some parts out and see if I can’t get the whole thing to be around45 seconds long.

Thank you for the helpful hints, @Apo.

I like trailer, well done and I agree on a shorter version, 45 seconds for me is enough

This looks like a really nice project, I’m looking forward to see the final product.

BTW, the google play link is not working, are you gonna release any alpha/beta version any time soon? I would really like to test it.

Cheers.