- Home /
Problem with 2D tutorial- character won't move
Hi, hopefully this is the right place for this request. I have been following this tutorial: http://www.rocket5studios.com/tutorials/make-a-2d-game-with-unity3d-using-only-free-tools-part-3/
I feel like I've learned a lot. I've made it up to the end of the Hooking up the Scripts section. The tutorial tells me "if you press left and right on the keyboard the player should move and the run animations should play."
My player's run animation plays, he can shoot, etc. However, he (or she) always snaps back to the same place- on the x-axis- at the end of the move left or move right animation cycle. Can someone offer a suggestion as to why this might be and how I can fix it? Thanks! James Sharman.
Answer by rbrain_lbrain · Dec 03, 2012 at 03:22 AM
I figured out a solution! I created a cube and shaped it to the X and Y scale of my character, placed my character (an Orthello OT animating Sprite) inside the cube in the hierarchy. Then gave the cube a relevant name " Player Container" and added my movement script to the cube instead of the OT Animating Sprite. Now it works like it should! I dont think having the cube around it will effect anything, I will still have collisions controlled by the sprite itself, and with no mesh renderer, the cube is only my little secret. Heres a screenshot: https://www.evernote.com/shard/s7/sh/b2e5a0ba-b9c2-4e19-8885-3ec94991b0f6/8ac6208187c5e563c5884ac721d50417 Hope this helps! I am a total noob at Unity, so I bet there are a dozen better ways to do this, but eh worked for me!
Your answer
Follow this Question
Related Questions
Extend time by picking up object problem 1 Answer
2D Tutorial Importing problem 2 Answers
How to open 2D tutorial project? 1 Answer
2d tutorial error 2 Answers