Quantcast
Channel: Latest Questions on Unity Answers
Viewing all articles
Browse latest Browse all 171066

2D Background Stop Moving on Collision.

$
0
0
Hello everyone, I currently have an Object that's moving around a background(which is a sprite.) This is how the object moves. The idea of movement is Gameboy Zelda style. I've created a small HUD with arrows. (the movement script is attached to the player...) If up arrow is clicked transform.Translate (Vector3.up * speed * Time.deltaTime); If down arrow is clicked transform.Translate (Vector3.down * speed * Time.deltaTime); If left arrow is clicked transform.Translate (Vector3.left * speed * Time.deltaTime); and so on.... Now I want to accomplish 2 tasks. - Don't move the player if it collides with a sprite. - Don't move the player if the limits of the bounding box of the Background sprite are reached. I haven't started to do any scripts because I honestly am blank on how to start tackling this problem thats why I come to you for help. If you think I should change the way the object moves please let me know why, and what to modify it to. Thank you for your time and hope hearing for your answers.

Viewing all articles
Browse latest Browse all 171066

Trending Articles



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