Thursday, February 27, 2014

Top down 2d and map making

An interesting time wrangling my enemy NPCs this evening. They target, chase and face the player. The issue I was having was the rotation only worked in 90 degree increments.
After adjusting a few different values and methods I couldn't get it just right, endlessly bodging the angles. How hard is it to make a sprite rotate to face another sprite? Success finally came through this line:

tranform.rotation = Quaternion.FromToRotation(transform.up, target.position - transform.position) * transform.rotation;
(from: http://answers.unity3d.com/questions/590504/sprite-face-second-sprite-only-on-z-axis.html )

The differing situations appear to be in the choice I've made for top down.

I've used some of the functions from CoherentNoise (available on the Unity asset store for free) combined with modified scripts from my spherical world engines and generated a few terrain textures with normal maps that export to disk, a few seed values should create what I need and then I can test them out for placement of items. Scaling them should give a decent sized "world" to visit and run about on.

 

No comments:

Post a Comment