launchBubblePosition variable in Frozen Bubble

Hi all
Can anyone explain launchBubblePosition variable in FrozenGame.java in Frozen Bubble Game
And when i touch on screen launchBubblePosition = (Math.PI - Math.atan2(yy, xx)) * 40.0 / Math.PI (xx = touch_x - 318, yy = 406 - touch_y) (FrozenGame.java file line 761), what’s this line mean? I don’t understand that code what doing.
Many thank!

It is calculating the trajectory angle to fire the launch bubble at based on the fixed position of the bubble launcher coordinates versus the player screen touch location.

launchBubbleAngle would possibly have been a better name in retrospect, but since there are multiple modes of changing the bubble launcher firing angle, it kind of helps keep the purpose of the variable clearer when considering that you can use the tilt position of your device, a trackball such as is on older phones, etc., all to change the angle.

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.

Mastodon