@VTZ
It's pretty easy and fast, because you can use colliders and they don't need animation. So the "follow terrain" part will be done here. The only thing you need to code are the controls.
So get your tank and import it. Import your wanted terrain. I guess a modified Box is doing good for your 2D Game. Add a Mesh Collider to your Box, so it will have a Collider fitting the model. Your Tank will need this too, beside of a rigidbody. (Those steps are easy, you can add them via the Physics Tab and choose Collider.
As for the movement I can provide some simple Script (create -> Script -> C# so you get a .cs file, rename it to "walkScript.cs"):
Code:
[color=green]// This is the name and class of our "walkScript"[/color]
public class walkScript : MonoBehaviour
{
[color=green]// before we do anything we should set up some variables (public will make it viewable in the Inspector and you can simply change the value there. float is the type so we can use numbers with decimals and you need to at a "f" behind the number to make it clear)[/color]
public float moveSpeed = 10f;
[color=green]// Function: "Update" runs every frame in the game (void just says we have a new function here)[/color]
[color=lightblue]void[/color] Update ()
{
[color=green]// this sets up our movementspeed (Horizontal and Vertical are by default the arrow keys. but you could easily change them in the settings) we multiply our moveSpeed with the direction we hit and multiply it with smoothDeltaTime so we get a smooth movement over time[/color]
float moveForward = moveSpeed * Input.GetAxis("Horizontal") * Time.smoothDeltaTime;
[color=green]// This will make our Object move forward (Vector3.forward gives us the direction, here it's in front of our tank)[/color]
transform.Translate(Vector3.forward * moveForward);
[color=green]// checks if we press the button (0 = no action, -1 & +1 = button pressed (right & left))[/color]
if(Input.GetAxis("Horizontal") != 0)
{
[color=green]// if it's not 0 we press a button, therefore we need some kind of animation
// play your walk animation here[/color]
}
else
{
[color=green]// play your idle animation here[/color]
}
}
}
Notice: I've not highlighted everything in here.
This is done with C#, it's not that easy as JavaScript, but it has some better stuff to code with. It's not really harder than learning the other, but I suggest to use C# instead.
The only thing to do is just place the camera aside the tank so you get your 2D-View. Also change it to Orthographic view and drag&drop it over the tank so it get's a child of it and the camera will follow whereever the tank is (without any coding).
So that are the basics ^^ You should now look at the tank from the side, can move it forth and back, and it will stay on the box moving up and down the hills on it and also the camera will follow your tank.