I am making the transition from Game Maker to Unity, but I feel lost when I look at Unity's programming.
When I followed a tutorial to make basic movements, I had this code:
public Vector3 playerPos;
void Update ()
{
float V_X = transform.position.x;
V_X += Input.GetAxis("Horizontal") / 2;
playerPos = new Vector3(V_X, 0, 0);
transform.position = playerPos;
}
A few things are confusing me here:
What is
transform
? And why isposition
something that is a part of it? Why not have the position of the objects represented by justx
rather thantransform.position.x
?Is
GetAxis(...)
a command that has a return value? Why is in "sub-categorized" underInput
? And why not detect the key presses directly?
No comments:
Post a Comment