Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: 4DGL-uLCD-SE EthernetInterface Game_Synchronizer MMA8452 SDFileSystem Sound mbed-rtos mbed wave_player
racket.h
00001 #ifndef RACKET_H_ 00002 #define RACKET_H_ 00003 00004 #include "misc.h" 00005 00006 typedef struct racket 00007 { 00008 int player; // PLAYER1 or PLAYER2 00009 int x, y; // center x and y positions 00010 int width, height; // width and height of racket 00011 int x0, y0; // initial positions before jump 00012 float vx0, vy0; // initial velocities of racket 00013 float time_elapsed; // cumulative time in air 00014 bool has_jumped; // if the player has jumped and is in the air 00015 int points; // points per player 00016 } racket; 00017 00018 // Initialize racket struct members. Int parameter identifies PLAYER1 or PLAYER2. 00019 void init_racket(racket*, int); 00020 00021 // Helper function to bound each racket within its boundaries. Not necessary, but 00022 // cleans up redundant code. 00023 void bound_x(racket*); 00024 00025 // Calculates next position, both running and jumping, of racket using kinematic 00026 // equations. 00027 void update_racket(racket*, float); 00028 00029 #endif
Generated on Thu Aug 4 2022 10:49:55 by
1.7.2