Hi everyone,

Could you please take 5 minutes to read through my problem, it's not even that hard (I dont think) but I only have high school programming knowledge and I'm stuck. It's kindof lengthy but bear with me


as my title states, I am a high school student and I'm making a project for my programming class. Im making an iPhone game that essentially lets the user pull back a ball from a given point and once they let go, the ball will move in the other direction of their pull. The ball has to hit a target and the next level(s) will be the same except with obstacles and differently placed targets.

I have already completed the majority of the project, i.e. I have figured out how to calculate an angle and the ball moves beautifully in my desired direction, HOWEVER, since I am using triangles to move my ball, whenever I hit the left or right side of the wall and I flip the angle, the ball moves in the right direction but it starts at a lower or higher part of the screen. I have figured out how to fix this problem and I figured out that the ball is being offset due to the triangle, and every time it hits the left or right wall I simply add the offset to it's y value.

now my problem is that as soon as I hit the top or bottom wall, the offset that was previously calculated alters where the ball will go and I can't make it hit the top or bottom with a smooth bounce. Can anybody help me with this problem??

If needed I can post my flash file and you can look through the code, it's about 200 lines long.

Thanks in advance