Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #define length 10
- int main() {
- //strzal dolatuje natychmiastowo
- int win = 0;
- int objectPositionX = 0;
- int cannonPositionX = length/2;
- char choice;
- int shoots = 0;
- while(win != 1) {
- objectPositionX++;
- printf("strzel(spacja) lub zaczekaj(w)\n");
- scanf("%c", &choice);
- if(choice == ' ') {
- shoots++;
- if(cannonPositionX == objectPositionX) {
- win = 1;
- printf("zestrzeliles obiekt, wygrana!");
- } else {
- printf("pudlo!");
- }
- } else {
- printf("odczekano kolejke");
- }
- if(objectPositionX == length) {
- printf("obiekt uciekl, przygotuj sie na kolejny");
- objectPositionX = 0;
- }
- }
- printf("oddales %d strzalow", shoots);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement