-
Notifications
You must be signed in to change notification settings - Fork 0
/
myshiplib.as
146 lines (114 loc) · 2.46 KB
/
myshiplib.as
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
; myshiplib.as
; program: Hisao ookubo,
#module
myxpos_ = 0
myypos_ = 0
myspped_ = 0
myvec_ = 0
dim myoptionxpos_, 256
dim myoptionypos_, 256
myoptioncount_ = 0
dim mymissilexpos_, 4
dim mymissileypos_, 4
rensyaflag_ = 0
#deffunc myship_init
buffer 3
picload "res/ship.bmp"
buffer 4
picload "res/m.bmp"
myxpos_ = 100
myypos_ = 100
myspped_ = 1
repeat 256
myoptionxpos_(cnt) = myxpos_
myoptionypos_(cnt) = myypos_
loop
repeat 4
mymissilexpos_(cnt) = 0
mymissileypos_(cnt) = -100
loop
rensyaflag_ = 0
return
#deffunc myship_move
myvec_ = 0
stick keybuf, 15 ;キー入力情報
// my ship move.
if (keybuf & 1) {
myxpos_ = myxpos_ - myspped_ ;[←]
myvec_ = 1
}
if (keybuf & 4) {
myxpos_ = myxpos_ + myspped_ ;[→]
myvec_ = 2
}
if keybuf & 2 : myypos_ = myypos_ - myspped_ ;[↑]
if keybuf & 8 : myypos_ = myypos_ + myspped_ ;[↓]
if myxpos_ < 9 : myxpos_ = 9 : myvec_ = 0
if myxpos_ > 247 : myxpos_ = 247 : myvec_ = 0
if myypos_ < 9 : myypos_ = 9
if myypos_ > 234 : myypos_ = 234
// ミサイル処理
if keybuf & 16 {
if (rensyaflag_ == 0){
repeat 4
if (mymissileypos_(cnt) == -100) {
mymissilexpos_(cnt) = myxpos_
mymissileypos_(cnt) = myypos_ - 10
rensyaflag_ = 1
break
}
loop
}
} else {
rensyaflag_ = 0
}
repeat 4
if (mymissileypos_(cnt) != -100) {
mymissileypos_(cnt) -= 4
if mymissileypos_(cnt) < 0 : mymissileypos_(cnt) = -100
}
; グロバール変数化
mymissilexpos_out_@(cnt) = mymissilexpos_(cnt)
mymissileypos_out_@(cnt) = mymissileypos_(cnt)
loop
; options.
repeat 255
myoptionxpos_(255 - cnt) = myoptionxpos_(254 - cnt)
myoptionypos_(255 - cnt) = myoptionypos_(254 - cnt)
loop
myoptionxpos_(0) = myxpos_
myoptionypos_(0) = myypos_
return
#deffunc myship_put
; fps
color 255, 255, 255
pos 0,0
mes "FPS:" + fps_get()
; options.
/* repeat 6
tempi = (5 - cnt) * 16 + 16
tempx = myoptionxpos_(tempi) - 9
tempy = myoptionypos_(tempi) - 9
pos tempx, tempy
gcopy 3, 0, 0, 16, 16
loop
*/
; missiles
repeat 4
if (mymissileypos_(cnt) != -100) {
pos mymissilexpos_(cnt) - 4, mymissileypos_(cnt) - 4
gcopy 4, 0, 0, 8, 8
}
loop
; my ship.
pos myxpos_ - 9, myypos_ - 9
gcopy 3, myvec_ * 16, 0, 16, 16
return
#deffunc missiledel int a
mymissileypos_(a) = -100
return
#deffunc myship_exit onexit
return
#global
dim mymissilexpos_out_, 4
dim mymissileypos_out_, 4