Icehocky-table ice hockey game feature introduction
Desktop : the desktop coordinate system's origin is set in the positive center, the x-axis to the right, the y-axis downward, the four-axis frame is the border, the ice hockey bounce back (after the collision speed about the collision surface normal symmetry), up and down two hole for the ball hole.
ice hockey : With the parameters speed and angle, respectively, the size and direction of the ice hockey movement.
Display Parts : Displays the position speed information of ice hockey, batter, etc.
To Add features : Change the desktop, ice hockey and other size parameters to add the start, End interface;
Increase the scoring function;
The velocity calculation after the collision between the batter and the ice hockey player;
Consider simplifying the function, just to accept information such as location speed and then visualize it;
animated schematic :
(Desktop video GIF animation made by software screentogif)
Summary :
Involved in more details, need to try more practice to master the various modules of QT function;
There are many errors in the whole function, the speed of the calculation is not strict, collision detection is not dependent on the physical engine, no mathematical physical model support, only rely on the QT item Collision detection implementation;
The idea of a data interface is important, and if you have two classes that need access to every other when you use them, you can simply create pointers to the other class in your own class, passing pointers as constructor arguments when instantiated. Private members that cannot be accessed directly should add additional interface functions, and the transmission of data and information can be realized by means of signals and slots, shared memory, Dbus, etc.
Code GitHub Link: https://github.com/tangyuanjie/iceHocky
Job 4-desktop ice hockey game Software Design (Preliminary)