i have a prog with a bitmap bouncen around the screen at 45 degrees all the time (x+1;y+1) is there any way to make the bitmap bounce at acurate angles?
as in:
not
-----------|
/
/
but -----<--->--|
to keep at 90 degrees
i have a prog with a bitmap bouncen around the screen at 45 degrees all the time (x+1;y+1) is there any way to make the bitmap bounce at acurate angles?
as in:
not
-----------|
/
/
but -----<--->--|
to keep at 90 degrees
In a perfect world every dog would have a home and every home would have a dog.
Visit My Web Site, Canine Programming
I use Win32 API
I am not sure I exactly know what you are asking, but I will give it a guess. When I made a program like this I used vectors. I kept a x value and a y value. When the ball hits a side wall the x value switches signs. When the ball hits the top or bottom the y value changes signs.
This is what it should look like:Code://hit side wall x = -x; //hit top or bottom y = -y; //This is where: //Current X Position = Last X + x //Current Y Position = last Y + y
- SeanCode:\ | \| <- Wall - The ball changes signs in X direction /| / | \ / \/ Ball changes signs in Y direction ---------- Wall
If cities were built like software is built, the first woodpecker to come along would level civilization.
Black Frog Studios