File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -73,21 +73,21 @@ void Cell::checkSpeed(Vect2D<float>& speed)
7373
7474void Cell::checkBorder ()
7575{
76- if (position.x >= parentField->fieldSize .x ) {
76+ if (position.x >= parentField->fieldSize .x - this -> size / 2 ) {
7777 position.x = (parentField->fieldSize .x - 1 ) - this ->size / 2 ;
78- speed.x = -0.5 ;
78+ speed.x = -0.2 * speed. x ;
7979 };
80- if (position.y >= parentField->fieldSize .y ) {
80+ if (position.y >= parentField->fieldSize .y - this -> size / 2 ) {
8181 position.y = (parentField->fieldSize .y - 1 ) - this ->size / 2 ;
82- speed.y = -0.5 ;
82+ speed.y = -0.2 * speed. y ;
8383 };
84- if (position.x < 0 ) {
84+ if (position.x < 0 + this -> size / 2 ) {
8585 position.x = 0 + this ->size / 2 ;
86- speed.x = 0.5 ;
86+ speed.x = - 0.2 * speed. x ;
8787 };
88- if (position.y < 0 ) {
88+ if (position.y < 0 + this -> size / 2 ) {
8989 position.y = 0 + this ->size / 2 ;
90- speed.y = 0.5 ;
90+ speed.y = - 0.2 * speed. y ;
9191 };
9292}
9393
You can’t perform that action at this time.
0 commit comments