Last change
on this file since 12 was
12,
checked in by Sam Hocevar, 18 years ago

 First commit. Scrolling works, some weaponry, controls, tunnel blowing,
the nuke is still ugly, almost no collision detection. Nice demo :)

File size:
1.1 KB

Line  

1  

2  #include <stdlib.h> 

3  

4  #include "common.h" 

5  

6  void init_weapons( game *g, weapons *wp ) 

7  { 

8  int i; 

9  

10  for( i = 0; i < SHOTS; i++ ) 

11  { 

12  wp>x[i] = 1; 

13  wp>y[i] = 1; 

14  wp>v[i] = 0; 

15  } 

16  } 

17  

18  void draw_weapons( game *g, weapons *wp ) 

19  { 

20  int i; 

21  

22  for( i = 0; i < SHOTS; i++ ) 

23  { 

24  if( wp>x[i] >= 0 ) 

25  { 

26  GFX_COLOR( WHITE ); 

27  GFX_GOTO( wp>x[i], wp>y[i] ); 

28  GFX_WRITE( '' ); 

29  GFX_COLOR( CYAN ); 

30  GFX_GOTO( wp>x[i], wp>y[i] + 1 ); 

31  GFX_WRITE( '' ); 

32  } 

33  } 

34  } 

35  

36  void update_weapons( game *g, weapons *wp ) 

37  { 

38  int i; 

39  

40  for( i = 0; i < SHOTS; i++ ) 

41  { 

42  if( wp>y[i] < 0 ) 

43  { 

44  wp>x[i] = 1; 

45  wp>y[i] = 1; 

46  } 

47  else 

48  { 

49  wp>y[i] += wp>v[i]; 

50  

51  /* Check collisions */ 

52  } 

53  } 

54  } 

55  

56  void add_weapon( game *g, weapons *wp, int x, int y ) 

57  { 

58  int i; 

59  

60  for( i = 0; i < SHOTS; i++ ) 

61  { 

62  if( wp>y[i] < 0 ) 

63  { 

64  wp>x[i] = x; 

65  wp>y[i] = y; 

66  wp>v[i] = 2; 

67  break; 

68  } 

69  } 

70  } 

71  

Note: See
TracBrowser
for help on using the repository browser.