Quantcast
Channel: Questions in topic: "side scroller"
Viewing all articles
Browse latest Browse all 72

making boundry for sidescroller

$
0
0
hey all, im trying to make a simple script so if my player object hits the top of ther screen he stops moving up and just stays on screen at the top until he is moved down. and visa versa for the bottom. ive tried using collision on a boundry box with no luck so trying out a script, however im not sure how to go about it thanks btw my movement script so far is this public class Runner : MonoBehaviour { void Update () { transform.Translate(5f * Time.deltaTime, 0f, 0f); if ( Input.GetKey(KeyCode.UpArrow) ) transform.Translate(5f * Time.deltaTime, 20f * Time.deltaTime, 0f); if ( Input.GetKey(KeyCode.DownArrow) ) transform.Translate(5f * Time.deltaTime, -20f * Time.deltaTime, 0f); } }

Viewing all articles
Browse latest Browse all 72

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>