Asteroids game using a Gameduino
A version of the classic asteroids game for the mbed using gameduino. The game currently runs far too fast and is unplayable.
Please see http://mbed.org/users/TheChrisyd/code/Gameduino/ for more information
Revision 1:3907d67048f1, committed 2012-12-20
- Comitter:
- TheChrisyd
- Date:
- Thu Dec 20 21:51:07 2012 +0000
- Parent:
- 0:2175bf475f30
- Child:
- 2:6c07ac67dbb2
- Commit message:
- setting convention of always having joypad buttons on inputs with PullUp set.
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Thu Dec 20 20:49:21 2012 +0000 +++ b/main.cpp Thu Dec 20 21:51:07 2012 +0000 @@ -42,10 +42,10 @@ static void controller_init() { // Configure input pins with internal pullups - down.mode(PullDown); - up.mode(PullDown); - left.mode(PullDown); - right.mode(PullDown); + down.mode(PullUp); + up.mode(PullUp); + left.mode(PullUp); + right.mode(PullUp); } @@ -59,13 +59,13 @@ byte r = 0; - if (down) + if (!down) r |= CONTROL_DOWN; - if (up) + if (!up) r |= CONTROL_UP; - if (left) + if (!left) r |= CONTROL_LEFT; - if (right) + if (!right) r |= CONTROL_RIGHT; return r;