0

HOW to create javascript for unity

I tried to make a game but I couldn't make the character move

4th Nov 2017, 1:42 PM
stanley romanov
2 Answers
+ 3
It requires you to be understand how the script and API work out in unity, since you can't simply create variable to move the character. Unity have something called "Transform" and "Rigidbody" and "AddForce" Because i don't know how javascript syntax looks like, procedure below will help you out 1. You need to instantiate the rigid body and assign the character rigidbody to it & create integer value to be used for the AddForce() statement 2. Define the character transform.position and assign it to the transform of character 3. use the AddForce statement to make the character behave and move according to values that have been given if you're making 2d games, that's all you need Moving character can be complex and a lot of solution to make it works i recommend check the API or tutorial outside there https://docs.unity3d.com/ScriptReference/Rigidbody.AddForce.html
5th Nov 2017, 1:13 AM
Elvin Auresius
Elvin Auresius - avatar