I have a class that has been entitled as Ball. Within said class I have an instance of java.awt.Rectangle.
package com.ncagle.angles;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Rectangle;
public class Ball {
public Rectangle rect;
public Ball() {
rect = new Rectangle(10, 10, 16, 16);
}
public void tick() {
}
public void draw(Graphics g) {
g.setColor(Color.WHITE);
g.fillRect(rect.x, rect.y, rect.width, rect.height);
}
}
What I'm wishing to accomplish is to have said Rectangle move at a specific angle (ex: 35°). I haven't tried anything because I have no idea how I would go at this. I'm in 8th Grade. I just learned what Pythagorean Theorem is about two weeks ago. If anybody could show me how this would be done, that would be great. Thank you.