Android libgdx bouncy screen bounds -


i need set phone's bounds wall elements inside can bounce. physic should correct. here example :

enter image description here

i know interpolation allow bounce don't know how create physics

check collisions walls. i'm assuming you're rendering bitmaps, origin of square we'll top left corner. in case:

if (x + width >= screen_width || x <= 0) vx *= -1; if (y + height >= screen_height || y <= 0) vy *= -1; 

where vx , vy x , y velocities.


Comments