- Home /
TopDown View like, Age of Empire, Age of Mythologi
If you ever played Aom or Aoe you know what i mean. I want a top down view of my scene and move around with a,s,d,w (you are not ''one'' person you ae many like a god so thats why i need a top down view. I created my scene and now i just need that function. Im trying to find someone who i can join and make levels, maps, and then he scripts. Im not a big fan of scripting, im focusing on making maps and stuff like that. But if anyone knows a way to do it then it would be awesome! Excuse my english, its not my mother language but i try as best as i can. Example from AoM http://www.youtube.com/watch?v=_C7UrrsOphY Well actually he controls with a mouse but i want it with asdw¨.
If you want to check out some of my work, here is a link to a platformer i made. http://www.youtube.com/watch?v=yufrEOqLQHw Thx.
Answer by robertbu · Mar 10, 2013 at 01:57 PM
Here is a script for the motion I saw on the video. I saw no rotation or easing, just translation. The scrip uses the arrow keys, but you can easy change the KeyCode values to anything you want:
#pragma strict
var distancePerSecond = 1.0;
private var pos : Vector3;
function Start () {
pos = transform.position;
}
function Update () {
if (Input.GetKey(KeyCode.UpArrow))
pos.z += distancePerSecond;
if (Input.GetKey(KeyCode.DownArrow))
pos.z -= distancePerSecond;
if (Input.GetKey(KeyCode.LeftArrow))
pos.x -= distancePerSecond;
if (Input.GetKey(KeyCode.RightArrow))
pos.x += distancePerSecond;
// Add code to check the bounds here;
transform.position = pos;
}
Hmm.. Is it a JavaScript? Cause when i paste it into JavaScript i get this warning: Assets/arrow mov.js(1,16): BCE0044: unexpected char: 'v'.
Looks great! But how do i add it? To a new gameobject, the main camera?
I assume you got your script error figured out? If not, past the actual error into a comment. As for using it, just drag and drop it on the camera.
Answer by NinjaRubberBand · Mar 10, 2013 at 07:17 PM
Well when i used C# i didn't get an error, but when drag it to my camera it says i can't add it.