- Home /
Character drop footprint 2d RPG.
Hello, I need to create a C# script for a 2d game that makes my character object generate a footprint every 1 second when walking. Any Idea on how to make my character generate a gameobject with a sprite render of the image I need?
Thanks.
Answer by KurtGokhan · Jan 30, 2014 at 07:57 AM
Just Instantiate the footprints under the character every 1 second. You can achieve every 1 second with Coroutine and WaitForSeconds. The footprint's position will be something relative to the character. I assume it will be something like:
Vector3 pos = transform.position + Vector3.up * offset;
offset may vary depending on your setup. Also it must be lying on the ground so you have to set your rotation. You can assign Instantiated object to a variable so you can Destroy it later. Like:
Transform footprint = GameObject.Instantiate(clone);
GameObject.Destroy(footprint,5) //Destroy after 5 seconds
Also you must check if the character is walking and if 1 second is passed.
Your answer

Follow this Question
Related Questions
My character is really jumpy/laggy 1 Answer
Footsteps in Character System 1 Answer
how to add a walking animation when character is moving? 3 Answers