Angle collision question

Okay, so I got this collision algorithm for angle 180 (down) and I wanna know what I got to do to make it work for all angles.

if(new Rectangle((int)ball.x, (int) ball.y, ball.size, ball.size).intersects(new Rectangle(wall[i].x, wall[i].y, wall[i].width, wall[i].height))){
				ball.y -= (ball.y + ball.size) - wall[i].y;
				ball.angle = 0 //up
			}

Vectors should be much easier. You can just invert the direction when you hit the wall.

This should help:
http://www.java-gaming.org/index.php/topic,23930

Okay, so so far I got this:


@Override
    public void update(GameContainer gc, int delta) 
			throws SlickException     
    {
    	ball.position.add(ball.velo);
    	ball.velo.add(ball.accel);
    	ball.accel = ball.velo.scale(0.5f);
    }

This is slowly moving this ball towards my paddle:


public class Ball {
	int size = 30;
	float speed = 0.2f;
	float maxSpeed = 6;
	
	float angle;
	
	Vector2f position;
	Vector2f velo;
	Vector2f accel;
	
	public Ball(){
		velo = new Vector2f(0,speed);
		position = new Vector2f(640/2 - size/2, 200);
		accel = new Vector2f(0,speed);
	}
}

But how would I apply my collision algorithm to this?

I wonder why it’s “ball.position.add(ball.velo);” ? there is posistion class inside your ball class? or what?

It’s a Vector2f (Slick lib).