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.
main.cpp@15:3f558f8b54ea, 2020-05-01 (annotated)
- Committer:
- thestudent
- Date:
- Fri May 01 12:54:25 2020 +0000
- Revision:
- 15:3f558f8b54ea
- Parent:
- 14:739115711bf8
- Child:
- 16:e2aaef863d7c
Finished with parabolic ball movement;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
thestudent | 6:33bdb54c2c88 | 1 | /* |
eencae | 0:b7f1f47bb26a | 2 | ELEC2645 Embedded Systems Project |
eencae | 0:b7f1f47bb26a | 3 | School of Electronic & Electrical Engineering |
eencae | 0:b7f1f47bb26a | 4 | University of Leeds |
eencae | 0:b7f1f47bb26a | 5 | 2019/20 |
eencae | 0:b7f1f47bb26a | 6 | |
thestudent | 1:664a272ab028 | 7 | Name:Arturs Kolovskis |
thestudent | 1:664a272ab028 | 8 | Username:el18ak |
thestudent | 1:664a272ab028 | 9 | Student ID Number: 201253737 |
thestudent | 1:664a272ab028 | 10 | Date:08.03.2020 |
eencae | 0:b7f1f47bb26a | 11 | */ |
eencae | 0:b7f1f47bb26a | 12 | |
eencae | 0:b7f1f47bb26a | 13 | // includes |
eencae | 0:b7f1f47bb26a | 14 | #include "mbed.h" |
eencae | 0:b7f1f47bb26a | 15 | #include "Gamepad.h" |
eencae | 0:b7f1f47bb26a | 16 | #include "N5110.h" |
thestudent | 2:ee6a6bcbce87 | 17 | #include "Objects.h" |
thestudent | 6:33bdb54c2c88 | 18 | #include "Functions.h" |
eencae | 0:b7f1f47bb26a | 19 | |
eencae | 0:b7f1f47bb26a | 20 | |
eencae | 0:b7f1f47bb26a | 21 | // objects |
eencae | 0:b7f1f47bb26a | 22 | Gamepad pad; |
eencae | 0:b7f1f47bb26a | 23 | N5110 lcd; |
thestudent | 2:ee6a6bcbce87 | 24 | Objects objects; |
thestudent | 6:33bdb54c2c88 | 25 | Functions functions; |
thestudent | 2:ee6a6bcbce87 | 26 | |
thestudent | 2:ee6a6bcbce87 | 27 | //functions |
thestudent | 2:ee6a6bcbce87 | 28 | void initialise(); |
eencae | 0:b7f1f47bb26a | 29 | |
thestudent | 10:f5b920a6a71a | 30 | //variables |
thestudent | 10:f5b920a6a71a | 31 | bool game_check = false; |
thestudent | 10:f5b920a6a71a | 32 | |
thestudent | 11:4722bf70b2be | 33 | |
eencae | 0:b7f1f47bb26a | 34 | int main() |
eencae | 0:b7f1f47bb26a | 35 | { |
thestudent | 2:ee6a6bcbce87 | 36 | initialise(); |
thestudent | 7:82079de8bcd6 | 37 | |
thestudent | 10:f5b920a6a71a | 38 | while(game_check == false) { |
thestudent | 12:f7dfd44569b6 | 39 | |
thestudent | 6:33bdb54c2c88 | 40 | lcd.clear(); |
thestudent | 14:739115711bf8 | 41 | objects.draw_shots(lcd,pad); |
thestudent | 15:3f558f8b54ea | 42 | //functions.ball_creater_linear(lcd, objects, pad); |
thestudent | 14:739115711bf8 | 43 | functions.ball_creater_parabolic(lcd,objects,pad); |
thestudent | 15:3f558f8b54ea | 44 | functions.collision_checker(lcd,objects); |
thestudent | 6:33bdb54c2c88 | 45 | objects.draw_base(lcd); |
thestudent | 7:82079de8bcd6 | 46 | objects.cannon_position(pad); |
thestudent | 6:33bdb54c2c88 | 47 | objects.draw_cannon(lcd); |
thestudent | 13:1dbef50789ed | 48 | |
thestudent | 10:f5b920a6a71a | 49 | game_check = functions.cannon_smash(lcd, objects); |
thestudent | 9:4b11ee1155ad | 50 | lcd.refresh(); |
thestudent | 13:1dbef50789ed | 51 | wait(0.15); |
thestudent | 9:4b11ee1155ad | 52 | |
thestudent | 11:4722bf70b2be | 53 | lcd.clear(); |
thestudent | 9:4b11ee1155ad | 54 | objects.cannon_position(pad); |
thestudent | 9:4b11ee1155ad | 55 | objects.draw_cannon(lcd); |
thestudent | 6:33bdb54c2c88 | 56 | lcd.refresh(); |
thestudent | 7:82079de8bcd6 | 57 | wait(0.005); |
thestudent | 2:ee6a6bcbce87 | 58 | } |
thestudent | 13:1dbef50789ed | 59 | printf("Score is: %d", functions.get_score()); |
thestudent | 2:ee6a6bcbce87 | 60 | } |
thestudent | 2:ee6a6bcbce87 | 61 | |
thestudent | 6:33bdb54c2c88 | 62 | void initialise() |
thestudent | 6:33bdb54c2c88 | 63 | { |
thestudent | 2:ee6a6bcbce87 | 64 | pad.init();//initialises the gamepad |
thestudent | 2:ee6a6bcbce87 | 65 | lcd.init();//initialises the N5100 screen |
thestudent | 11:4722bf70b2be | 66 | lcd.clear(); |
thestudent | 6:33bdb54c2c88 | 67 | |
eencae | 0:b7f1f47bb26a | 68 | } |
eencae | 0:b7f1f47bb26a | 69 |