- Home /
Move Sprite few steps from current location on tap
I'm new in Unity.I want to move my 2d sprite few steps in random direction on tap but within the screen bounds(for mobile).Random direction is not a problem but I haven't found any "Move" method that gives functionality to move sprite.
Answer by magnussolidus · Mar 10, 2014 at 08:27 PM
If the sprite isn't the player and/or the camera isn't following it you can use the Camera.ScreenToWorldPoint in the boundaries to check if it's outside or not.
Another way, but may not fill your need, it's to put colliders on the edges of the camera view. Note that this is recommended only if the game you are making don't want to make things go outside of the camera range (an roll the dice game for sample).
Hope it helps.
Your answer
Follow this Question
Related Questions
My character isn't moving 0 Answers
Move objects with mouse while paused (2D) 1 Answer
Moving arrows far away from object 1 Answer
C# trying to move a object 2 Answers
Object moving to mouse 0 Answers