How to drop a box
Hello. I need a little help from someone who knows to code. I try to do a game same like TOWER BLOXX, and i'm stuck at this part. I don't know how to drop the box by pressing 'space' and after the first box hits the ground to spawn another one in the same place.
the pendul script for the box : public class Pendul : MonoBehaviour { public Rigidbody2D rd; public static float leftPushRange; public static float rightPushRange; public float velocityThreshold; public static float valoare=0; void Start() { %|-824960062_1|% rd.angularVelocity = velocityThreshold; } void Update() { %|39500676_3|% } public void Push() { if (transform.rotation.z > 0 && transform.rotation.z < rightPushRange && (rd.angularVelocity > 0) && rd.angularVelocity < velocityThreshold) %|1994215378_6|% %|1444934207_7|% } else if (transform.rotation.z < 0 && transform.rotation.z > leftPushRange %|1123771234_11|% && rd.angularVelocity > velocityThreshold * -1) { %|-2078971037_14|% } } }