jaevelgames Posted June 4, 2015 Share Posted June 4, 2015 Hi! I want to create graphics to use as bounds for different sprites, like this: In this case, the player sprite would be bound to move INSIDE the grey rectangle. No physics should have to be enabled, since I just want to change the x and y value of the player sprite. Is this possible? And what would be the best way to achieve this? Thanks! Link to comment Share on other sites More sharing options...
jaevelgames Posted June 4, 2015 Author Share Posted June 4, 2015 Oh, and I dont want the player sprite to be draggable, just moving with key inputs. Link to comment Share on other sites More sharing options...
jaevelgames Posted June 4, 2015 Author Share Posted June 4, 2015 Guess I'm looking for something like boundsSprite, except not restricted to dragging?? Link to comment Share on other sites More sharing options...
wayfinder Posted June 4, 2015 Share Posted June 4, 2015 Are these areas always going to be rectangular? In that case you could use Math.clamp to keep the x and y values between your desired values. Link to comment Share on other sites More sharing options...
jaevelgames Posted June 5, 2015 Author Share Posted June 5, 2015 I made some kind of collision-detection bounding me to the rectangle the player's currently on, which seem to work quite well. Haven't heard of Math.clamp, but I will check it out. Maybe it'll come in handy! Thanks! Link to comment Share on other sites More sharing options...
Recommended Posts