Ask Your Question

Revision history [back]

That seems fairly simple to me

  1. Segment the red blob and add a tracker to it. A helpfull tutorial can be this one
  2. In your program define crossing borders, for example vertical lines.
  3. Now just do simple checks at each frame with if statements, checking if the position of your tracked ball is somewhere crossing a border.

For example if you have a border at x=15, x =100 and x=250 (all vertical lines), then you can apply these if loops

if(position.x < 15){
   //execute first code
}elseif( 15 < position.x && position.x < 100){
   //execute second code
}elseif( 100 < position.x && position.x < 250){
   //excute third code
}else{
  //you are in the fourth code part
}