Errors in code
Hello. I'm struggling to understand why this code has errors? Here is code: http://www.hastebin.com/okiyohuxuy.avrasm I was doing this tutorial: https://www.youtube.com/watch?v=Tpak3yIkS5M
Thank you very much.
Answer by Zephire · Oct 11, 2015 at 07:34 PM
Your curly brackets weren't on the right place in several lines of the code you linked on hastebin.
This one should have them fixed. http://www.hastebin.com/navivibamo.avrasm
Hope this helps, and always go over your curly brackets one by one just to be sure you close the right one after opening it.
Answer by KB90KB · Oct 11, 2015 at 09:07 PM
Hi. Thank you so much Zephire for your quick response, it solved most of it but now it says "Argument missing" in this line GetComponent.velocity = new Vector2 (moveVelocity, GetComponent ().velocity.y,);
That line should be fixed to the below:
GetComponent<Rigidbody2D>().velocity = new Vector2 (moveVelocity, GetComponent<Rigidbody2D>().velocity.y);
Give it a try and let me know if it's ok now.