mardi 31 mars 2015

Hinge joint 2D in Unity

I've been playing lately with a nice function in Unity, Hinge Joint 2D.

It's a feature which allows to joint multiple objects together. I can show how to use it in a simple way. I won't tell all the details as all this is quite easy to figure out and to do.

In the Unity editor, I put all my objects. Here, we're talking about two electric poles, and a stick (a simple rectangle of a few pixels) duplicated a lot of time.

On the first electric pole object, as you can see below, the usual components on a 2D object in Unity : Sprite Renderer to show the graphics, a BoxCollider 2D on pole's upper area (where the cable will be jointed) and a RigidBody 2D set as kinematic (so the object won't move).

And of course, a Hinge Joint 2D component, connected with the first cable object (just drag and drop the target object in the Connected Rigid Body box).

The stick-cable object (see below) is set as a child of the electric pole.

Same Components than before. The hinge joint is set to the next cable object (the same we're on, duplicated and moved to the left).

I repeat this for all cable objects needed, each one connected to the next one, except for the last one, connected to the second electric pole.

It's time to pray the pink unicorn and press play.

The result is good. This behavior (more or less bouncy) can be changed by tweaking the Rigidbody2D datas of every object.

In the game view :


jeudi 19 mars 2015

The process of making a golem

I've made big progress in programming the monster AI and player character's moves lately. Now I want to add new enemies, especially huge ones I could use as boss, mid boss or just tougher-than-usual monsters.

Designing new characters is hard! I can't do it in one step. So I draw a character, and make successive new versions until it sucks a little less. Below you can see the document I'm working on, with tileset and background from the current version of the game, which allows me - hopefully - to draw new things in the same ambiance, atmosphere or color scope (this is hard but extremely important).

3 tries of new monsters.  A rough draw of a golem, a blob and a spider. Blob and spider are in their third or fourth version, but not finished yet.
Let's focus on the golem. Below is the second version where I add a light-emitting heart and redraw the sprite (the previous version is used only as a shape) with 3 brown colors.

 Below is the next version, adding one color and refining shadows and lights.

Here is where it's useful to work on a document with other elements from the game for reference : I change each color (mostly about saturation) to have a character better fitted in his world.

The result is below :

Next thing to do : animate this pile of rock.

mardi 10 mars 2015

boar running & karateka

I'm currently reworking some graphics and adding a few new elements. Here are some of the WIP new stuff.

The boar, an enemy without IA : he just runs from one side of the screen to the other. The player will have to jump over or slash it.

A karateka, friendly NPC who unlocks player's abilities in exchange for gold.

vendredi 6 mars 2015

Parallax backgrounds

I'm currently working on backgrounds. I want to use scrolling parallax (the main idea of this technique is to have multiple layers moving at different speed, related to their distance from the camera) to create a depth effect. I hope this effect will make less boring the simple backgrounds I'm able to draw.

My first try at parallax in Cape Bleue was this :

It's better than nothing, but not by far. The 2 big flaws are colors (it should be less saturated) and drawing (these trees look like bushes on a stick... and they seem to be viewed from a very high place).

When in motion, the parallax look like this :

I like it. The background art is still bad, but my parallax script is working.

So I decided to work again on these backgrounds. Here is a version with better colors, and a first try on a personal blue sky.

A rework of the previous version, without trees and with the adding of grass on top of the first three layers: 

It begins to look like something acceptable. Really empty, but I like the global atmosphere, and it makes the gameplay areas on screen more readable. Later, and using this version as a start, I did two other tries. A background for the player's village, and a forest : 

 I don't hate it, but I'm still not fully convinced. The village background could become good, but it may need huge amount of work to avoid feeling too empty.

mercredi 4 mars 2015

treasure chest opening

Very small post today, because I'm currently working on the user interface & doing boring stuff like debugging. But I did some pixel art too, mainly a re-work on the backgrounds, and some small elements like the chest below.

So, here is a chest opening animation I did a few days ago. I hope it looks like the kind of chest the player will strongly want to open. I still have to add some particles to make it more rewarding or something like that.