Tuesday, March 10, 2020

Point2D

My last foray with my gaming code tutorial brought home
the point - very visibly - that coding on key presses produces changes
that last the time of the press, and no further. Those buttons look like homies
that keep their assignment, but are not. Code is everything.

The code in this next tuto is on the button control, which does introduce
a permanent change: we are dealing with an event handler on an image required
to move. Below:




The code has interesting features: both the circle and the integer value have their
own class on their own separate page). Here is the game logic:



Found the final 'draw' instruction fascinating. It is a boolean.




The distance command is part of Point2D.

                                                    *     *     *


No comments: