Thread: Pool Game
View Single Post
Stage 4: rebound angles
Old
davidghemer
Member
 
Status: Offline
Posts: 38
Join Date: Nov 2011
Default Stage 4: rebound angles - 12-01-2011, 07:49 PM

This version uses a bit of trig to calculate the angle of the cue ball when it hits a cushion and then to rebound at an appropriate angle. It is similar to the compass except I compare the current position of the cue ball with a previously marked position. The previous position is stored each time the cue ball changes direction and the end of a shot.

Rebounding for the one ball has not been changed yet, but the same principle could be applied.

Does anybody know if there is some way of adding properties to the balls? At the moment I have to put properties for the cue ball in the table class, which is getting pretty messy.
Attached Files
File Type: a2w PoolGame_Stage5.a2w (746.9 KB, 68 views)


For video tutorials on programming in Alice 2.2 check out my YouTube channel

http://www.youtube.com/user/drdave785

Also check out my Programming in Alice blog at

http://programminginalice.com

Last edited by davidghemer; 12-02-2011 at 03:44 AM. Reason: Added comments to the code
   
Reply With Quote