Daniel Nguyen
Dependencies: 4DGL-uLCD-SE mbed
ScreenAliens.cpp@0:7d7f6032c719, 2017-11-02 (annotated)
- Committer:
- dnguyen314
- Date:
- Thu Nov 02 19:15:07 2017 +0000
- Revision:
- 0:7d7f6032c719
hi
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
dnguyen314 | 0:7d7f6032c719 | 1 | #include "ScreenAliens.h" |
dnguyen314 | 0:7d7f6032c719 | 2 | #define ALIEN_HEIGHT 8 |
dnguyen314 | 0:7d7f6032c719 | 3 | #define ALIEN_WIDTH 11 |
dnguyen314 | 0:7d7f6032c719 | 4 | #include <iostream> |
dnguyen314 | 0:7d7f6032c719 | 5 | #include "uLCD_4DGL.h" |
dnguyen314 | 0:7d7f6032c719 | 6 | #include "Speaker.h" |
dnguyen314 | 0:7d7f6032c719 | 7 | |
dnguyen314 | 0:7d7f6032c719 | 8 | extern uLCD_4DGL uLCD; |
dnguyen314 | 0:7d7f6032c719 | 9 | extern Speaker mySpeaker; |
dnguyen314 | 0:7d7f6032c719 | 10 | ScreenAliens::ScreenAliens() |
dnguyen314 | 0:7d7f6032c719 | 11 | { |
dnguyen314 | 0:7d7f6032c719 | 12 | move = true; |
dnguyen314 | 0:7d7f6032c719 | 13 | speed = 5; |
dnguyen314 | 0:7d7f6032c719 | 14 | } |
dnguyen314 | 0:7d7f6032c719 | 15 | void ScreenAliens::update() |
dnguyen314 | 0:7d7f6032c719 | 16 | { |
dnguyen314 | 0:7d7f6032c719 | 17 | |
dnguyen314 | 0:7d7f6032c719 | 18 | } |
dnguyen314 | 0:7d7f6032c719 | 19 | void ScreenAliens::isLeft(int x) |
dnguyen314 | 0:7d7f6032c719 | 20 | { |
dnguyen314 | 0:7d7f6032c719 | 21 | moveLeft = x; // So that some moves right first and others move left |
dnguyen314 | 0:7d7f6032c719 | 22 | } |
dnguyen314 | 0:7d7f6032c719 | 23 | |
dnguyen314 | 0:7d7f6032c719 | 24 | int ScreenAliens::getPosX() |
dnguyen314 | 0:7d7f6032c719 | 25 | { |
dnguyen314 | 0:7d7f6032c719 | 26 | return pos_x; |
dnguyen314 | 0:7d7f6032c719 | 27 | } |
dnguyen314 | 0:7d7f6032c719 | 28 | |
dnguyen314 | 0:7d7f6032c719 | 29 | int ScreenAliens::getPosY() |
dnguyen314 | 0:7d7f6032c719 | 30 | { |
dnguyen314 | 0:7d7f6032c719 | 31 | return pos_y; |
dnguyen314 | 0:7d7f6032c719 | 32 | } |
dnguyen314 | 0:7d7f6032c719 | 33 | |
dnguyen314 | 0:7d7f6032c719 | 34 | void ScreenAliens::collide() |
dnguyen314 | 0:7d7f6032c719 | 35 | { |
dnguyen314 | 0:7d7f6032c719 | 36 | uLCD.filled_rectangle(pos_x, pos_y, pos_x + ALIEN_WIDTH, pos_y + ALIEN_HEIGHT, BLACK); |
dnguyen314 | 0:7d7f6032c719 | 37 | pos_x = 128; |
dnguyen314 | 0:7d7f6032c719 | 38 | pos_y = 128; |
dnguyen314 | 0:7d7f6032c719 | 39 | move = false; |
dnguyen314 | 0:7d7f6032c719 | 40 | uLCD.filled_rectangle(pos_x, pos_y, pos_x + ALIEN_WIDTH, pos_y + ALIEN_HEIGHT, BLACK); |
dnguyen314 | 0:7d7f6032c719 | 41 | } |