Bouncing Block: Single

We consider a block with position (x,y) moving inside a square with constant velocity (vx,vy) with time stepping

  • y=y+vy,
  • x=x+vx,

and elastic bouncing on the walls modeled with reverse of velocity.

Watch the code and play.

To do

  • Change velocities and time step.
  • Change bouncing with a damping parameter decreasing the velocity after bounce.