Wednesday, 22 May 2013

NavMesh Layer causing my sprites/agents to kinda vanish

I've encountered a weird problem. When I add a NavMeshAgent to an entity then place this on my NavMesh terrain then I can't see the NavMeshAgent. Well...kinda.

It's like I'm losing one of the six sides that make up the gif map.

My solution: since I'm working on a 2D game I hacked it so my units are shaped a bit differently and have a different side facing up...far from graceful, but it works.

Friday, 17 May 2013

Moving around


NavMesh seems to provide 'layers' which I can specify which sprites (/agents) can 'walk' on these. 
There is then some cool stuff built in to Unity which allows these sprites to auto-path to a location; really handy stuff to have out of the can*
*only available in pro version. 

I have also started exploring the concept of Terrain. I'm still not 100% sure on how to get my wonderful GIF in to a world that I can use. Still, I shall experiment around making a terrain a layer and seeing if I can leave it two dimensional. 

Very simple moving and rotation

Moving an object:

float y = (float) speed * Time.deltaTime;
transform.Translate(new Vector3(0, y, 0));

Rotation, where Bearing is an Enum I created:
Quaternion target = Quaternion.Euler (0, 0, (float)bearing);
        // Dampen towards the target rotation
        transform.rotation = Quaternion.Slerp(transform.rotation, target, Time.deltaTime * speed);;

Maps

So I've created my world as a GIF.
My current challenge: telling what is land and what is water.
My real challenge: creating a path algorithm on where I can and cannot tread. And avoiding other sprites en route.


What next. From a brief google on 'Unity' and 'getPixel' I suspect Texture 2D might have something to help offer.

The goal

So I want to create a 2D game which has elements from my favourite games growing up. I don't want to discuss content in a public forum, but merely how I have approached certain coding challenges as I go along. This is intended slightly more as a self-wiki in case of early onset dementia rather than a guide to all other noobs out there, but I am happy to share.

My goal:
2D game.

Graphic editor for sprites. I'll have relatively static sprites at this stage, changing state very rarely and with cheap graphics when they do. For this I have selected Pixen, an easy, powerful, and surprisingly fun* pixel art tool.

*It's kinda like Minecraft without the 3D, or the hours of mining.

Game editor: Unity 3D. It seems powerful and trusted with a solid physics engine (not that I need that). Only downside is the hefty price tag. Demo for now. Le sigh.

More anon.