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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
|
-
|
|
|
!
-
|
|
!
-
|
|
!
-
|
|
|
|
|
|
|
!
-
|
|
|
|
!
| ASTEROIDS BASE
自機の移動
弾の発射
#define RADS 0.017453 #define ROTATE_STEP 0.7 #define SPEED 0.0002 #define xMAX 510.0 #define yMAX 330.0 #define ROOM 30.0
screen 0,xMAX,yMAX
cls 4
*Main
gosub *Init
repeat
redraw 0
gosub *Cleanup
gosub *SpaceShip
redraw 1
await
gosub *Control
loop
*Init
count = 8
rotation = 0.0
Shape_x = 0.0, -7.0, 7.0, -5.0, 5.0, -3.0, 0.0, 3.0
Shape_y = -14.0, 7.0, 7.0, 2.0, 2.0, 2.0, 10.0, 2.0
Screen_x = Shape_x
Screen_y = Shape_y
ddim Fire_x, 50
ddim Fire_y, 50
ddim F_Rads, 50
Radians = 0.0
Loc_x = 100.0
Loc_y = 100.0
Direction_x = 0.0
Direction_y = 0.0
speed_c = 1.0
friction = 0.998
return
*SpaceShip
gosub *Translate
gosub *Draw
gosub *Move
gosub *Shot
gosub *Compute
return
*Translate
i = 0
while i < count
Screen_x(i) = Shape_x(i) * cos(Radians) - Shape_y(i) * sin(Radians)
Screen_y(i) = Shape_y(i) * cos(Radians) + Shape_x(i) * sin(Radians)
Screen_x(i) += Loc_x
Screen_y(i) += Loc_y
i++
wend
return
*Draw
color 255,255,255
line Screen_x( 1 ) , Screen_y( 1 ) , Screen_x( 0 ) , Screen_y( 0 )
line Screen_x( 2 ) , Screen_y( 2 ) , Screen_x( 0 ) , Screen_y( 0 )
line Screen_x( 3 ) , Screen_y( 3 ) , Screen_x( 4 ) , Screen_y( 4 )
if (boost < 0) {
line Screen_x( 5 ) , Screen_y( 5 ) , Screen_x( 6 ) , Screen_y( 6 )
line Screen_x( 7 ) , Screen_y( 7 ) , Screen_x( 6 ) , Screen_y( 6 )
boost = 0
} return
*Move
Direction_x *= friction
Direction_y *= friction
Loc_x += Direction_x
Loc_y += Direction_y
if Loc_x < 0.0 - ROOM : Loc_x += xMAX + ROOM
if Loc_x > xMAX + ROOM : Loc_x -= xMAX + ROOM
if Loc_y < 0.0 - ROOM : Loc_y += yMAX + ROOM
if Loc_y > yMAX + ROOM : Loc_y -= yMAX + ROOM
return
*Shot
i = 0
while i < 50
Fire_x(i) += sin( F_rads(i) )
Fire_y(i) -= cos( F_rads(i) )
pset Fire_x(i) , Fire_y(i)
i++
wend
return
*Compute
Radians = rotation * RADS
switch j
case 0
speed_c = 1.0
friction = 0.998
swbreak
case 200
speed_c = 3.0
friction = 0.999
swbreak
case 950
speed_c = 5.0
friction = 0.999
swbreak
case 970
speed_c = 10.0
friction = 0.9999
swbreak
case 1000
speed_c = 10.0
friction = 0.998
swbreak
swend
if j > 1000 : j = 1000
if j < 0 : j = 0
return
*Control
stick key,1+2+4
if key&1 {
rotation -= ROTATE_STEP
if rotation < 0.0 : rotation = 360.0 - ROTATE_STEP
}
if key&4 {
rotation += ROTATE_STEP
if rotation > 359.0 : rotation = 0.0 + ROTATE_STEP
}
if key&2 {
Direction_x += sin( Radians ) * SPEED * speed_c
Direction_y -= cos( Radians ) * SPEED * speed_c
j++
if boost == 0 : boost = 1 :else : boost *= -1
}else : j--
if key&16 {
Fire_x(fire_stock) = Screen_x(0)
Fire_y(fire_stock) = Screen_y(0)
F_rads(fire_stock) = Radians
if fire_stock == 50 :fire_stock = 0 : else : fire_stock++
}
return
*Cleanup
color 0,0,0
boxf
return
|