42 Commits

Author SHA1 Message Date
Joe
c6b5788bae Changed start level back to 1 (accidentally left in with previous commit) 2018-04-09 17:36:33 +01:00
Joe
45f6759baf Added support for WASD controls as well as arrow keys 2018-04-09 17:34:30 +01:00
a0a70d69ed Changed paddle speed 2018-01-12 10:44:04 +00:00
Joe
ee23f2756a GLU case typo 2018-01-12 10:26:34 +00:00
Joe
7f39731cb7 Fixed some includes, syntax, increased frame rate 2018-01-12 10:25:01 +00:00
51c9eae76f Updated makefile for Linux 2018-01-12 08:59:46 +00:00
Joe
bed7e9a8c1 Added game end logic check, made sure bricks are working 2018-01-12 08:48:38 +00:00
Joe
6be9da289c Added a sticky paddle flag on death and new level, spacebar to (re)start game, ESC to exit, combined brick layouts (levels) into one function 2018-01-12 04:24:35 +00:00
Joe
bf52ead7cc Started to split sections of the program into their own header / source files 2018-01-12 01:32:31 +00:00
Joe
f29f78e634 Added second brick initialisation function, added 'stickToPaddle' flag to allow the ball to be aimed after it is reset 2018-01-12 00:34:16 +00:00
daa48a0e6d Added text rendering using SDL_TTF, level counter, game over message, and if statement to stop the game updating once the game is over 2018-01-11 14:14:58 +00:00
Joe
8082423e0c Forgot to add font to repo 2018-01-11 12:18:54 +00:00
c2f215f555 Updated makefile 2018-01-11 11:55:54 +00:00
Joe
0d5153ea57 Added playerLives variable that is updated when the ball is reset, and used SDL_Image to load bitmaps of heart icons and function to visually represent the lives
SDL Surface to GL Texture code in loadTextures function used from http://www.sdltutorials.com/sdl-tip-sdl-surface-to-opengl-texture
2018-01-11 11:49:34 +00:00
a8898fe13a Merged Scoring_and_Text into master 2018-01-11 09:38:04 +00:00
Joe
a155ce320f Implemented a scoring system, added SDL_ttf addon in order to render text. Attempted rendering some test text (surface->GL texture->drawing quad), but was unsuccessful. May or may not remove in favour of spritemaps in the future 2018-01-11 09:29:28 +00:00
d274b674e5 Added 'clean' to makefile to make removing binaries before commits easier and fixed logic error in breakout.c 2018-01-10 12:30:45 +00:00
841efab5eb Updated makefile to compile on Linux (math wasn't linked) 2018-01-10 12:12:09 +00:00
Joe
589b989b36 Fixed collision detection (game-breaking bug)
Fixed an issue with the ball occasionally clipping through the paddle/bricks or bouncing from a position inside the paddle/bricks
This should never happen, as the ball should be updated to move in a different direction if the ball is clipping in the next frame
This was being caused by a rounding error in the vertexWithinQuad function, where adding the compared volumes introduced a small imprecision and meant the test volume and original volume were not always exactly equal
Cast the two areas as integers when comparing, such that only a discrepancy > 1px would be considered a collision (perfect since we are ultimately rendering bitmaps). Could also be solved by adding a percentage margin of error or increasing precision (both more costly)
2018-01-09 18:36:05 +00:00
Joe
a40944d189 Added collision detection for bricks as well as a parameter to track whether a brick has been destroyed. Fixed an issue where the ball's position on the next frame did not incorporate tickrate compensation (mismatch between predicted next value and actual). Added 'substeps' (iterations of main function that do not draw to screen, to allow for more precise calculation of movement by performing the calculations more frequently) and SDL_Delay to reduce FPS if it exceeds a given value (to prevent very high CPU usage with 1000+fps where not at all necessary) 2018-01-07 15:41:35 +00:00
Joe
d233f15f34 Added in a coordinate struct (containing x and y), created function for testing whether given vertex is within a quad (coordinate array) by calculation of volume. Added in bricks and a chunk of code to populate some bricks in a grid 2018-01-05 13:35:40 +00:00
Joe
2e61b6b9e4 Testing some code for storing brick information in mutli-dimensional arrays as leaf nodes in a tree. This approach is chosen with a view to introducting space partitioning for collision detection at a later date 2017-12-15 17:00:07 +00:00
a3017b0774 Added radius compensation to collision detection with paddle, within updateBall function 2017-12-14 10:05:58 +00:00
96b2380036 Changed colours to neutral, added check to updateBall() to prevent ball 'colliding' with the area beneath the paddle when not in contact with the paddle 2017-12-13 15:27:55 +00:00
Joe
862973e4c2 File added: Alternative colour schemes 2017-12-13 10:17:39 +00:00
Joe
7c66002c7a Rewritten to use structs for ball and paddle variables, thereby grouping everything together and keeping the functions simple/easy to read 2017-12-13 10:12:21 +00:00
Joe
00a089f6f9 Applied tickrate to updateBall function and introduced updatePaddle function (also using tickrate) to keep timing consistent across platforms/launch scenarios - not yet tested on Linux 2017-12-13 09:03:35 +00:00
c2bb045d5e Fixed issue with function definition mismatch. Created a basic timer; starting work on issue #1 2017-12-11 11:37:17 +00:00
Joe
f08b0d5b75 Added some comments and changed X velocity post paddle-collision to be proportional to the relative position of the ball and paddle 2017-12-10 20:39:34 +00:00
Joe
54b9eb14f0 Modified paddle to move in non-integer steps, created a ball with a function for updating based off of position relative to walls and paddle plus function to draw the ball 2017-12-10 20:24:28 +00:00
Joe
2f7a81dd9f Re-wrote to use OpenGL (based off glboilerplate/glboilerplate.c), modified window size and colour scheme to match the design doc. Implemented colour struct and background drawing function 2017-12-10 19:44:04 +00:00
Joe
ca55281463 Added a compiler condition so we can play on Windows too 2017-12-10 17:55:35 +00:00
5af07e88f0 Started to create GL boilerplate 2017-12-08 14:05:37 +00:00
86611c5bee Added pongy code 2017-12-07 17:13:16 +00:00
134d5c87a1 Fixed that typo again 2017-12-07 14:37:12 +00:00
8b2c58b1c8 Fixed a typo and swapped a few perrors for fprintfs 2017-12-07 14:33:49 +00:00
Joe Adams
c36c56373b Edited readme 2017-12-07 14:28:29 +00:00
Joe Adams
27be4c3fcb Edited readme 2017-12-07 14:23:35 +00:00
Joe Adams
1ff74704cd Edited readme 2017-12-07 14:21:49 +00:00
Joe Adams
36ae4ef06f Edited readme 2017-12-07 14:20:54 +00:00
Joe Adams
74b15c7b7b Edited readme 2017-12-07 14:20:11 +00:00
Adams Joseph
70ff7e3386 Initial commit 2017-12-07 14:17:02 +00:00