Added support for WASD controls as well as arrow keys
This commit is contained in:
parent
a0a70d69ed
commit
45f6759baf
@ -130,13 +130,13 @@ int main(void) {
|
||||
* ----------------
|
||||
*/
|
||||
|
||||
char subSteps = 1; // Draw every N+1 frames, thereby calculating movement more precisely
|
||||
char subSteps = 0; // Draw every N+1 frames, thereby calculating movement more precisely
|
||||
int targetFPS = 90; // Limit FPS to this value, to stop unneccessary calculations
|
||||
|
||||
char moveX=0; // Toggled between -1, 0 and 1 by keypresses later
|
||||
|
||||
int playerScore = 0;
|
||||
int level = 1;
|
||||
int level = 2;
|
||||
int playerLives = 3;
|
||||
|
||||
brick bricks[2048]; // Sets up array for the bricks to be stored in, max no. bricks is 2048
|
||||
@ -250,9 +250,15 @@ int main(void) {
|
||||
case SDLK_ESCAPE:
|
||||
go = 0;
|
||||
break;
|
||||
case SDLK_a:
|
||||
moveX = -1;
|
||||
break;
|
||||
case SDLK_LEFT:
|
||||
moveX=-1;
|
||||
break;
|
||||
case SDLK_d:
|
||||
moveX = 1;
|
||||
break;
|
||||
case SDLK_RIGHT:
|
||||
moveX=1;
|
||||
break;
|
||||
@ -272,9 +278,15 @@ int main(void) {
|
||||
case SDLK_LEFT:
|
||||
moveX = 0;
|
||||
break;
|
||||
case SDLK_a:
|
||||
moveX = 0;
|
||||
break;
|
||||
case SDLK_RIGHT:
|
||||
moveX = 0;
|
||||
break;
|
||||
case SDLK_d:
|
||||
moveX = 0;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user