Mortal Kombat Game ELEC2645
Dependencies: mbed N5110 ShiftReg Joystick
Diff: Fighter.cpp
- Revision:
- 8:e2e2eb4ea0ca
- Parent:
- 7:737fb0c3dbef
- Child:
- 9:8c840b08a633
--- a/Fighter.cpp Thu Apr 22 01:24:12 2021 +0000 +++ b/Fighter.cpp Thu Apr 22 18:33:23 2021 +0000 @@ -242,10 +242,10 @@ // read each of the pins float x = joy_h.read(); float y = joy_v.read(); - printf("x = %.2f | y = %.2f \n",x,y); + // printf("x = %.2f | y = %.2f \n",x,y); int x_pos = get_x(); - printf("fighter x pos = %i \n", x_pos); + // printf("fighter x pos = %i \n", x_pos); /* Code idea: @@ -271,8 +271,9 @@ wait(0.3); } // Guard if user presses button C - while (buttonC.read() == 1) { + if (buttonC.read() == 1) { guard(lcd); // draw guard move frame + wait(0.5); lcd.refresh(); wait(0.3); } @@ -305,8 +306,9 @@ wait(0.3); } // Guard if user presses button C - while (buttonC.read() == 1) { // we use while not if here because user would hold to guard + if (buttonC.read() == 1) { // we use while not if here because user would hold to guard guard(lcd); // draw kick on same coordinates as the sprite + wait(0.5); lcd.refresh(); wait(0.3); } @@ -337,8 +339,9 @@ wait(0.3); } // Guard if user presses button C - while (buttonC.read() == 1) { - guard(lcd); // draw guard on same coordinates as the sprite + if (buttonC.read() == 1) { + guard(lcd); + wait(0.5); lcd.refresh(); wait(0.3); }