C

C code posted
created at 15 Feb 09:21

Edit | Back
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#define BODY_FROM   100

#include "chain.c"

#include "objects.c"

#include "levels.c"

clock_t now;
int level = 0; // počáteční level, u prvního se hned zvýší
int score;
int gameover; // 0 = PLAY, 1 = DEAD, 2 = WIN, 3 = EXIT
int rem_objects; // remaining objects


/*
  Vytiskne hrací pole.
  w,h = skuteèná šíøka a výška pole
  all = 0/1 = pøetisknout vše nebo jen pohyblivé vìci?
*/
void print_area(int a[][MAX_W], int w, int h, int all)
{
  int x, y;
  time_t t;
  int i, o;
  int link;

  gotoxy(1, 1);
  for (y = 0; y < h; y++) {
    for (x = 0; x < w; x++) {
      if (a[y][x] == WALL) {
        if (all)
          printf("\xDB");
      }
      else if (a[y][x] == HEAD) {
        if (!all)
          gotoxy(x+1, y+1);
        setColor(LIGHTRED);
        printf("\x01");
        setColor(GREY);
      }
      else if (a[y][x] >= BODY_FROM) {
        if (!all)
          gotoxy(x+1, y+1);
        link = a[y][x] - BODY_FROM;
        setColor((link % 2 == 0) ? CHAIN_COLOR1 : CHAIN_COLOR2);
        printf("%s", chain[link].s);
        setColor(GREY);
      }
      else if (a[y][x]
1.11 KB in 6 ms with coderay