src/GameObj.java
/**
     * Update the velocity of the object in response to hitting an obstacle in the given direction.
     * If the direction is null, this method has no effect on the object.
     *
     * @param d The direction in which this object hit an obstacle
     */
Update the velocity of the object in response to hitting an obstacle in the given direction.
If the direction is null, this method has no effect on the object.

@param d The direction in which this object hit an obstacle
Update the velocity of the object in response to hitting an obstacle in the given direction . If the direction is null this method has no effect on the object . @param d The direction in which this object hit an obstacle
public void bounce(Direction d) {
        if (d == null) {
            return;
        }
        switch (d) {
            case UP:
                this.vy = Math.abs(this.vy);
                break;  
            case DOWN:
                this.vy = -Math.abs(this.vy);
                break;
            case LEFT:
                this.vx = Math.abs(this.vx);
                break;
            case RIGHT:
                this.vx = -Math.abs(this.vx);
                break;
            default:
                break;
        }
    }
public void bounce ( Direction d ) { if ( d == null ) { return ; } switch ( d ) { case UP : this . vy = Math . abs ( this . vy ) ; break ; case DOWN : this . vy = - Math . abs ( this . vy ) ; break ; case LEFT : this . vx = Math . abs ( this . vx ) ; break ; case RIGHT : this . vx = - Math . abs ( this . vx ) ; break ; default : break ; } }
Update the velocity of the object in response to hitting an obstacle in the given direction.
Update the velocity of the object in response to hitting an obstacle in the given direction .