-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathgame.c
More file actions
executable file
·148 lines (104 loc) · 2.52 KB
/
Copy pathgame.c
File metadata and controls
executable file
·148 lines (104 loc) · 2.52 KB
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
#include "map.h"
#include "pad.h"
#include "ppu.h"
#include "apu.h"
#define SHOTNUM 5
unsigned char player_g[]={0x9E,0x9E,0x19,0x19};
unsigned char player_a[]={0x00,0x40,0x80,0x80};
unsigned char player_color=0x36;
unsigned char shot_g=0x02;//'上矢印'
unsigned char shot_a=0x01;//反転なし
unsigned char shot_color=0x39;
unsigned char enemy_g[]={0x80,0x80,0x80,0x80};
unsigned char enemy_color=0x34;
unsigned char haikei_color=0x0f;
char count=0;
void disp_count(){
char d1,d0;
d0=count%10;
d1=(count/10)%10;
enqueueBG(26,2,'0'+d1);
enqueueBG(27,2,'0'+d0);
}
#include "game.h"
int main(){
unsigned char prev_a=0;
unsigned char scr_offset=128;
init();
player_x=40; //自機の横座標
player_y=200; //自機の縦座標
enqueueBG(20,2,'E');
enqueueBG(21,2,'N');
enqueueBG(22,2,'E');
enqueueBG(23,2,'M');
enqueueBG(24,2,'Y');
enqueueBG(25,2,':');
while(1){
waitvblank();
ppu_off();
update_sprite_all();
setBG_queue();
set_scroll();
ppu_on();
if(judge_hit()){
//---------------敵に弾があたった時----------------//
sound3(1,4,15);
}
//---------------画面の敵が全ていなくなった時----------------//
if(count==0){
sound2(5,1,0x34);
break; //ゲームを終わる
}
fetch_keys();
//---------------上ボタンが押された時----------------//
if(keys[BT_UP]==1){
//player_y-=1;
}
//---------------下ボタンが押された時----------------//
if(keys[BT_DOWN]==1){
//player_y+=1;
}
//---------------左ボタンが押された時----------------//
if(keys[BT_LEFT]==1){
player_x-=1;
}
//---------------右ボタンが押された時----------------//
if(keys[BT_RIGHT]==1){
player_x+=1;
}
//----------------Aボタンが押された時----------------//
if(keys[BT_A]==1){
//----------------弾を発射する----------------//
if(shot()){
sound1(1,2,0x7e);
}
}
//----------------STARTボタンが押された時----------------//
if(keys[BT_START]==1){
}
move_shot(1);
move_player();
}
//----------------画面を元に戻す---------------//
ppu_off();
clear_BG();
clear_SP();
//----------------メッセージを表示---------------//
enqueueBG(15,15,'E');
enqueueBG(16,15,'N');
enqueueBG(17,15,'D');
waitvblank();
setBG_queue();
setBG_queue();
set_scroll();
ppu_on();
while(1){
waitvblank();
fetch_keys();
//----------------STARTボタンが押された時----------------//
if(keys[BT_START]==1){
return 0; //始めに戻る
}
}
return 0;
}