I'm a 9th grader in Algebra 1 right now and in my spare time I like programming, I am trying to re-create the game Pong right now but I am having a little problem. I know I am asking a question about programming and that I should be on stackoverflow.com, but I figured I would get better help here.
The problem I am having is making the dot move at a certain angle. Lets pretend that the squares on this bad drawing are pixels on the screen.

I know that if I wanted it to go at a 45° I would have it go in a path where for every pixel to the right it would go one pixel up (1:1), like this

And I am pretty sure that a 22.5° angle would go for every two pixels right it goes one pixel up (2:1).

But what equation would I use to calculate the ratio for other angles?