Hi all,
It feels great to be programming again. Some of you might remember this Space Invaders / Galaga type game I made a few years ago called Tech Invaders. Today I decided to spruce it up and make it go faster, therefore more fun to play. I added one or two other tweaks also to make it more enjoyable. As with before, there's 5 boss aliens and I'm pretty sure that if you beat all 5 bosses, it starts over again, with no end to the game. And like before, it makes the "toptentech.txt" file for the Top Ten scores. Enjoy!
-Ken
It feels great to be programming again. Some of you might remember this Space Invaders / Galaga type game I made a few years ago called Tech Invaders. Today I decided to spruce it up and make it go faster, therefore more fun to play. I added one or two other tweaks also to make it more enjoyable. As with before, there's 5 boss aliens and I'm pretty sure that if you beat all 5 bosses, it starts over again, with no end to the game. And like before, it makes the "toptentech.txt" file for the Top Ten scores. Enjoy!
-Ken
Code: (Select All)
'Tech Invaders 5 Warp Edition 'Game made on July 1, 2022 'Version 5 made on August 10, 2024. 'By SierraKen 'Freeware '----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 'Additions: Made the game a lot faster. '------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ _ScreenMove _Middle begin: _Limit 1000 Dim name$(50), nm$(50), score(50), sccc(50) Dim x As Single, y As Single, x2 As Single, y2 As Single, x5 As Single, y5 As Single, x6 As Single, y6 As Single, x7 As Single, y7 As Single, xt As Single, yt As Single Dim enemy As Single, e1 As Single, e2 As Single, e3 As Single, e4 As Single Dim lives As Single, level As Single, ushoot As Single, points As Single, level2 As Single, DD As Single, start As Single, b As Single, boss As Single Dim xx As Single, yy As Single, xx2 As Single, yy2 As Single, xx3 As Single, yy3 As Single, xx4 As Single, yy4 As Single Dim c1 As Single, c2 As Single, c3 As Single, c4 As Single, c5 As Single, c6 As Single Dim x3 As Single, y3 As Single, x4 As Single, y4 As Single Dim csaucer1 As Single, csaucer2 As Single, csaucer3 As Single Dim sz As Single, s As Single, sec As Single, mo As Single, mouth As Single, mo2 As Single, mouth2 As Single, t As Single Dim sx As Single, sy As Single, sx2 As Single, sy2 As Single, sx3 As Single, sy3 As Single, sx4 As Single, sy4 As Single, sx5 As Single, sy5 As Single Dim starx(1000), stary(1000) Dim ddx(1000), ddy(1000) Dim sz10(1000) Dim speed(1000) Dim cx As Integer, cy As Integer, r As Integer, c As _Unsigned Long _Title "Tech Invaders 5 Warp Edition - by SierraKen" Cls Screen _NewImage(800, 600, 32) Print: Print: Print For tt = 79 To 34 Step -2 Locate 3, tt + 2: Print " " Locate 3, tt: Print "T" _Delay .03 Next tt For ee = 79 To 36 Step -2 Locate 3, ee + 2: Print " " Locate 3, ee: Print "E" _Delay .03 Next ee For cc = 79 To 38 Step -2 Locate 3, cc + 2: Print " " Locate 3, cc: Print "C" _Delay .03 Next cc For hh = 79 To 40 Step -2 Locate 3, hh + 2: Print " " Locate 3, hh: Print "H" _Delay .03 Next hh For II = 79 To 54 Step -2 Locate 3, II + 2: Print " " Locate 3, II: Print "I" _Delay .03 Next II For NN = 79 To 56 Step -2 Locate 3, NN + 2: Print " " Locate 3, NN: Print "N" _Delay .03 Next NN For VV = 79 To 58 Step -2 Locate 3, VV + 2: Print " " Locate 3, VV: Print "V" _Delay .03 Next VV For AA = 79 To 60 Step -2 Locate 3, AA + 2: Print " " Locate 3, AA: Print "A" _Delay .03 Next AA For DD = 79 To 62 Step -2 Locate 3, DD + 2: Print " " Locate 3, DD: Print "D" _Delay .03 Next DD For EE2 = 79 To 64 Step -2 Locate 3, EE2 + 2: Print " " Locate 3, EE2: Print "E" _Delay .03 Next EE2 For RR = 79 To 66 Step -2 Locate 3, RR + 2: Print " " Locate 3, RR: Print "R" _Delay .03 Next RR For ss = 79 To 68 Step -2 Locate 3, ss + 2: Print " " Locate 3, ss: Print "S" _Delay .03 Next ss DD = 0 Print: Print: Print Print " F I V E" Print: Print Print " W a r p E d i t i o n" Print: Print: Print Print " by SierraKen" Print: Print: Print Print " Use the Mouse to steer your shooter left and right." Print " Use left Mouse Button to fire." Print " Esc to end anytime." Print: Print: Print Print " Press Mouse Button To Start." Do If _MouseInput Then If _MouseButton(1) Then GoTo startgame: End If Loop startgame: Cls e1 = 0 e2 = 0 e3 = 0 e4 = 0 lives = 5 points = 0 ushoot = 0 shooting = 0 level = 1 level2 = 1 start = 0 s = 0 xt = 400 yt = 560 b = 0 boss = 0 bosses = 1 sx2 = 0 sy2 = 0 tim = 4000 'Draw your shooter. For sz = .25 To 10 Step .25 Line (xt - 10 - sz, yt + 10)-(xt - sz, yt - 10), _RGB32(0, 255, 128) Line (xt + 10 + sz, yt + 10)-(xt + sz, yt - 10), _RGB32(0, 255, 128) Next sz OPENINGSOUND Randomize Timer 'This is the start of the main loop. go: 'Choose a random place for the enemy. If e1 = 0 And e2 = 0 And e3 = 0 And e4 = 0 Then xx = Int(Rnd * 200) + 100 yy = Int(Rnd * 100) + 40 xx2 = Int(Rnd * 200) + 200 yy2 = Int(Rnd * 100) + 40 xx3 = Int(Rnd * 200) + 250 yy3 = Int(Rnd * 100) + 40 xx4 = Int(Rnd * 200) + 300 yy4 = Int(Rnd * 100) + 40 End If 'Each level has its own loop so it can set a different equation and speed of the enemy. If level = 1 Then c1 = 128: c2 = 127: c3 = 255 csaucer1 = 0: csaucer2 = 0: csaucer3 = 0 one: 'sec is not time, it's related to the coordinate of the enemy and speed it goes related to the loop speed. sec = sec + .02 s = (60 - sec) * 6 + 180 x = Int(Sin(s / 360 * 3.141592) * 180) + 125 y = Int(Cos(s / 25 * 3.141592) * 180) + 225 x3 = Int(Sin(s / 360 * 3.141592) * 180) + 125 y3 = Int(Cos(s / 25 * 3.141592) * 180) + 225 x4 = Int(Sin(s / 360 * 3.141592) * 180) + 125 y4 = Int(Cos(s / 25 * 3.141592) * 180) + 225 x7 = Int(Sin(s / 360 * 3.141592) * 180) + 125 y7 = Int(Cos(s / 25 * 3.141592) * 180) + 225 'GOSUB to drawing draws the enemy robot. If e1 <> 1 Then GoSub drawing: If e2 <> 1 Then GoSub drawing3: If e3 <> 1 Then GoSub drawing4: If e4 <> 1 Then GoSub drawing5: If sec > 180 Then sec = 0 GoTo onedone: End If 'GOSUB's go to keyboard control and enemy shooting. GoSub mouse: If tim < 0 Then GoSub shoot: GoSub youshoot2: GoTo one: onedone: End If 'This level uses the spiral equation so it's a bit different than the others. If level = 2 Then c1 = 127: c2 = 216: c3 = 127 csaucer1 = 127: csaucer2 = 216: csaucer3 = 127 xx = 400: yy = 300 xx2 = 100: yy2 = 300 xx3 = 600: yy3 = 300 For d = 160 To 0 Step -.125 s = s + .2 x = Cos(s * 3.141592 / 180) * d y = Sin(s * 3.151492 / 180) * d x3 = Cos(s * 3.141592 / 180) * d y3 = Sin(s * 3.151492 / 180) * d x4 = Cos(s * 3.141592 / 180) * d y4 = Sin(s * 3.151492 / 180) * d x7 = Cos(s * 3.141592 / 180) * d y7 = Sin(s * 3.151492 / 180) * d If e1 <> 1 Then GoSub drawing: If e2 <> 1 Then GoSub drawing3: If e3 <> 1 Then GoSub drawing4: If e4 <> 1 Then GoSub drawing5: GoSub mouse: If tim < 0 Then GoSub shoot: GoSub youshoot2: Next d For d = 0 To 160 Step .125 s = s - .2 x = Cos(s * 3.141592 / 180) * d y = Sin(s * 3.151492 / 180) * d x3 = Cos(s * 3.141592 / 180) * d y3 = Sin(s * 3.151492 / 180) * d x4 = Cos(s * 3.141592 / 180) * d y4 = Sin(s * 3.151492 / 180) * d x7 = Cos(s * 3.141592 / 180) * d y7 = Sin(s * 3.151492 / 180) * d If e1 <> 1 Then GoSub drawing: If e2 <> 1 Then GoSub drawing3: If e3 <> 1 Then GoSub drawing4: If e4 <> 1 Then GoSub drawing5: GoSub mouse: If tim < 0 Then GoSub shoot: GoSub youshoot2: Next d End If If level = 3 Then c1 = 255: c2 = 0: c3 = 0 csaucer1 = 255: csaucer2 = 0: csaucer3 = 0 three: sec = sec + .02 s = (60 - sec) * 6 + 180 x = Int(Sin(s / 360 * 3.141592) * 180) + 25 y = Int(Cos(s / 65 * 3.141592) * 180) + 225 x3 = Int(Sin(s / 360 * 3.141592) * 180) + 25 y3 = Int(Cos(s / 65 * 3.141592) * 180) + 225 x4 = Int(Sin(s / 360 * 3.141592) * 180) + 25 y4 = Int(Cos(s / 65 * 3.141592) * 180) + 225 x7 = Int(Sin(s / 360 * 3.141592) * 180) + 25 y7 = Int(Cos(s / 65 * 3.141592) * 180) + 225 If e1 <> 1 Then GoSub drawing: If e2 <> 1 Then GoSub drawing3: If e3 <> 1 Then GoSub drawing4: If e4 <> 1 Then GoSub drawing5: If sec > 60 Then sec = 0 GoTo threedone: End If GoSub mouse: If tim < 0 Then GoSub shoot: GoSub youshoot2: GoTo three: threedone: End If If level = 4 Then c1 = 255: c2 = 255: c3 = 127 csaucer1 = 255: csaucer2 = 255: csaucer3 = 127 four: sec = sec + .02 s = (60 - sec) * 6 + 180 x = Int(Sin(s / 120 * 3.141592) * 180) + 25 y = Int(Cos(s / 200 * 3.141592) * 180) + 225 x3 = Int(Sin(s / 120 * 3.141592) * 180) + 75 y3 = Int(Cos(s / 200 * 3.141592) * 180) + 225 x4 = Int(Sin(s / 120 * 3.141592) * 180) + 125 y4 = Int(Cos(s / 200 * 3.141592) * 180) + 225 x7 = Int(Sin(s / 120 * 3.141592) * 180) + 325 y7 = Int(Cos(s / 200 * 3.141592) * 180) + 225 If e1 <> 1 Then GoSub drawing: If e2 <> 1 Then GoSub drawing3: If e3 <> 1 Then GoSub drawing4: If e4 <> 1 Then GoSub drawing5: If sec > 60 Then sec = 0 GoTo fourdone: End If GoSub mouse: If tim < 0 Then GoSub shoot: GoSub youshoot2: GoTo four: fourdone: End If If level = 5 Then c1 = 133: c2 = 28: c3 = 255 csaucer1 = 133: csaucer2 = 28: csaucer3 = 255 five: sec = sec + .02 s = (60 - sec) * 6 + 180 x = Int(Sin(s / 45 * 3.141592) * 180) + 25 y = Int(Cos(s / 360 * 3.141592) * 180) + 225 x3 = Int(Sin(s / 45 * 3.141592) * 180) + 75 y3 = Int(Cos(s / 360 * 3.141592) * 180) + 225 x4 = Int(Sin(s / 45 * 3.141592) * 180) + 125 y4 = Int(Cos(s / 360 * 3.141592) * 180) + 225 x7 = Int(Sin(s / 45 * 3.141592) * 180) + 200 y7 = Int(Cos(s / 360 * 3.141592) * 180) + 225 If e1 <> 1 Then GoSub drawing: If e2 <> 1 Then GoSub drawing3: If e3 <> 1 Then GoSub drawing4: If e4 <> 1 Then GoSub drawing5: If sec > 60 Then sec = 0 GoTo fivedone: End If GoSub mouse: If tim < 0 Then GoSub shoot: GoSub youshoot2: GoTo five: fivedone: End If If level = 6 Then e1 = 0: e2 = 1: e3 = 1: e4 = 1 boss = 1 c1 = 255: c2 = 0: c3 = 0 six: sec = sec + .02 s = (60 - sec) * 6 + 180 x = Int(Sin(s / 135 * 3.141592) * 180) + 325 y = Int(Cos(s / 33.75 * 3.141592) * 180) + 225 GoSub drawing2: If sec > 120 Then sec = 0 GoTo sixdone: End If GoSub mouse: If tim < 0 Then GoSub shoot: GoSub youshoot2: GoTo six: sixdone: End If If level = 7 Then bosses = bosses + 1: level = 1 GoTo go: 'GOTO goes back to the start of the main loop. 'Draws enemy ship #1. drawing: x2 = x + xx: y2 = y + yy If x2 > 775 Then x2 = 775 If x2 < 25 Then x2 = 25 For t = 15 To 20 Step .25 Circle (x2, y2), t, _RGB32(csaucer1, csaucer2, csaucer3), , , .5 Next t c1 = c1 + 1: c2 = c2 + 1: c3 = c3 + 1 If c1 > 255 Then c1 = 80 If c2 > 255 Then c2 = 80 If c3 > 255 Then c3 = 80 For t = .25 To 8 Step .25 Circle (x2, y2), t, _RGB32(c1, c2, c3), , , .5 Next t For t = .25 To 3 Step .25 Circle (x2 - 10, y2 - 5), t, _RGB32(255, 127, 0), , , .5 Circle (x2 + 10, y2 - 5), t, _RGB32(255, 127, 0), , , .5 Circle (x2, y2 + 10), t, _RGB32(255, 127, 0), , , .5 Next t Return 'Draws the Boss Robot. drawing2: x2 = x + xx: y2 = y + yy If x2 > 775 Then x2 = 775 If x2 < 25 Then x2 = 25 If bosses > 5 Then bosses = 1 If bosses = 1 Then If mouth2 > 1.8 Then mo2 = 1 If mouth2 < .2 Then mo2 = 0 If mo2 = 0 Then mouth2 = mouth2 + .025 If mo2 = 1 Then mouth2 = mouth2 - .025 c4 = 75: c5 = 75: c6 = 75 For t = 15 To .25 Step -.25 c4 = c4 + t / 3: c5 = c5 + t / 3: c6 = c6 + t / 3 Circle (x2, y2), t, _RGB32(c4, c5, c6) Line (x2 - 14, y2 + t + 15)-(x2 + 14, y2 + t + 15), _RGB32(c4, c5, c6), BF Next t For t = .25 To 2 Step .25 Circle (x2 - 10, y2 - 5), t, _RGB32(255, 0, 0) Circle (x2 + 10, y2 - 5), t, _RGB32(255, 0, 0) Next t For t = .25 To 6 Step .25 Circle (x2, y2 + 5), t, _RGB32(255, 0, 0), _Pi, 0, mouth2 Next t End If If bosses = 2 Then If mouth2 > 1.8 Then mo2 = 1 If mouth2 < .2 Then mo2 = 0 If mo2 = 0 Then mouth2 = mouth2 + .025 If mo2 = 1 Then mouth2 = mouth2 - .025 c4 = 75: c5 = 75: c6 = 75 For t = 29 To .25 Step -.25 c4 = c4 + t / 4: c5 = c5 + t / 4: c6 = c6 + t / 4 Circle (x2, y2), t, _RGB32(c4, c5, c6), , , .5 Next t For t = .25 To 2 Step .25 Circle (x2 - 10, y2 - 5), t, _RGB32(255, 0, 0) Circle (x2 + 10, y2 - 5), t, _RGB32(255, 0, 0) Next t For t = .25 To 6 Step .25 Circle (x2, y2 + 5), t, _RGB32(255, 0, 0), _Pi, 0, mouth2 Next t End If If bosses = 3 Then If mouth2 > 1.8 Then mo2 = 1 If mouth2 < .2 Then mo2 = 0 If mo2 = 0 Then mouth2 = mouth2 + .025 If mo2 = 1 Then mouth2 = mouth2 - .025 c4 = 188: c5 = 128: c6 = 255 Line (x2 - 29, y2 - 29)-(x2 + 29, y2 + 29), _RGB32(255, 6, 0) Line (x2 + 29, y2 - 29)-(x2 - 29, y2 + 29), _RGB32(255, 6, 0) For t = -15 To 15 Step 1 c4 = c4 + t: c5 = c5 + t: c6 = c6 + t Line (x2 - 7, y2 + t)-(x2 + 7, y2 + t), _RGB32(c4, c5, c6) Next t For t = .25 To 2 Step .25 Circle (x2 - 10, y2 - 5), t, _RGB32(255, 0, 0) Circle (x2 + 10, y2 - 5), t, _RGB32(255, 0, 0) Next t For t = .25 To 6 Step .25 Circle (x2, y2 + 5), t, _RGB32(255, 0, 0), _Pi, 0, mouth2 Next t End If If bosses = 4 Then If mouth2 > 1.8 Then mo2 = 1 If mouth2 < .2 Then mo2 = 0 If mo2 = 0 Then mouth2 = mouth2 + .025 If mo2 = 1 Then mouth2 = mouth2 - .025 c4 = 228: c5 = 188: c6 = 28 Line (x2 - 29, y2 - 29)-(x2 + 29, y2 + 29), _RGB32(9, 255, 0) Line (x2 + 29, y2 - 29)-(x2 - 29, y2 + 29), _RGB32(9, 255, 0) Circle (x2 - 29, y2 - 29), 7, _RGB32(255, 0, 0) Circle (x2 + 29, y2 + 29), 7, _RGB32(255, 0, 0) Circle (x2 + 29, y2 - 29), 7, _RGB32(255, 0, 0) Circle (x2 - 29, y2 + 29), 7, _RGB32(255, 0, 0) For t = -15 To 15 Step 1 c4 = c4 + t: c5 = c5 + t: c6 = c6 + t Line (x2 - 7, y2 + t)-(x2 + 7, y2 + t), _RGB32(c4, c5, c6) Next t For t = .25 To 2 Step .25 Circle (x2 - 10, y2 - 5), t, _RGB32(0, 255, 0) Circle (x2 + 10, y2 - 5), t, _RGB32(0, 255, 0) Next t For t = .25 To 6 Step .25 Circle (x2, y2 + 5), t, _RGB32(0, 255, 0), _Pi, 0, mouth2 Next t End If If bosses = 5 Then If mouth2 > 1.8 Then mo2 = 1 If mouth2 < .2 Then mo2 = 0 If mo2 = 0 Then mouth2 = mouth2 + .025 If mo2 = 1 Then mouth2 = mouth2 - .025 c4 = 188: c5 = 128: c6 = 255 For t = 20 To .25 Step -.25 c4 = c4 + t / 4: c5 = c5 + t / 4: c6 = c6 + t / 4 Circle (x2, y2), t, _RGB32(c4, c5, c6), , , .75 Next t For t = 20 To 25 Step .25 Circle (x2, y2), t, _RGB32(0, 0, 255), , , .75 Next t For t = 25 To 29 Step .25 Circle (x2, y2), t, _RGB32(255, 0, 0), , , .75 Next t For t = .25 To 2 Step .25 Circle (x2 - 10, y2 - 5), t, _RGB32(255, 0, 0) Circle (x2 + 10, y2 - 5), t, _RGB32(255, 0, 0) Next t For t = .25 To 6 Step .25 Circle (x2, y2 + 5), t, _RGB32(255, 0, 0), _Pi, 0, mouth2 Next t End If Return 'Draws enemy ship #2. drawing3: x5 = x3 + xx2: y5 = y3 + yy2 If x5 > 775 Then x5 = 775 If x5 < 25 Then x5 = 25 For t = 15 To 20 Step .25 Circle (x5, y5), t, _RGB32(csaucer1, csaucer2, csaucer3), , , .5 Next t For t = .25 To 8 Step .25 Circle (x5, y5), t, _RGB32(c1, c2, c3), , , .5 Next t For t = .25 To 3 Step .25 Circle (x5 - 10, y5 - 5), t, _RGB32(255, 127, 0), , , .5 Circle (x5 + 10, y5 - 5), t, _RGB32(255, 127, 0), , , .5 Circle (x5, y5 + 10), t, _RGB32(255, 127, 0), , , .5 Next t Return 'Draws enemy face. drawing4: x6 = x4 + xx3: y6 = y4 + yy3 If x6 > 775 Then x6 = 775 If x6 < 25 Then x6 = 25 If mouth > 1.8 Then mo = 1 If mouth < .2 Then mo = 0 If mo = 0 Then mouth = mouth + .025 If mo = 1 Then mouth = mouth - .025 For t = 15 To 20 Step .25 Circle (x6, y6), t, _RGB32(csaucer1, csaucer2, csaucer3), , , .5 Next t For t = .25 To 15 Step .25 Circle (x6, y6), t, _RGB32(c1, c2, c3) Next t For t = .25 To 3 Step .25 Circle (x6 - 10, y6 - 5), t, _RGB32(0, 255, 255) Circle (x6 + 10, y6 - 5), t, _RGB32(0, 255, 255) Next t For t = .25 To 6 Step .25 Circle (x6, y6 + 5), t, _RGB32(0, 255, 255), _Pi, 0, mouth Next t Return 'Draws enemy ship #3. drawing5: x7 = x3 + xx4: y7 = y3 + yy4 If x7 > 775 Then x7 = 775 If x7 < 25 Then x7 = 25 For t = 15 To 20 Step .25 Circle (x7, y7), t, _RGB32(csaucer1, csaucer2, csaucer3), , , .5 Next t For t = .25 To 8 Step .25 Circle (x7, y7), t, _RGB32(c1, c2, c3), , , .5 Next t For t = .25 To 3 Step .25 Circle (x7 - 10, y7 - 5), t, _RGB32(255, 127, 0), , , .5 Circle (x7 + 10, y7 - 5), t, _RGB32(255, 127, 0), , , .5 Circle (x7, y7 + 10), t, _RGB32(255, 127, 0), , , .5 Next t Return 'Mouse control for your movement and shooting. mouse: _Limit 200 If level = 6 And b > 0 Then Locate 3, 3: Print "BOSS ROBOT:" Line (150, 30)-(bx + 150, 50), _RGB32(227, 0, 0), BF End If Do While _MouseInput xt = _MouseX If _MouseButton(1) Then GoSub youshoot: a$ = InKey$ If a$ = Chr$(27) Then End Loop For sz = .25 To 10 Step .25 Line (xt - 10 - sz, yt + 10)-(xt - sz, yt - 10), _RGB32(0, 255, 128) Line (xt + 10 + sz, yt + 10)-(xt + sz, yt - 10), _RGB32(0, 255, 128) Next sz If xt > 780 Then xt = 780 If xt < 0 Then xt = 0 'Background Starfield sp = .0005 tim = tim - 25 stars = Int(Rnd * 100) + 1 If stars > 15 Then s2 = s2 + 1 If s2 > 950 Then s2 = 1 'Set starting position. startx = Rnd * 400 starty = Rnd * 300 st = Int(Rnd * 360) x100 = (Sin(st) * startx) + 400 y100 = (Cos(st) * starty) + 300 starx(s2) = x100 stary(s2) = y100 'Set direction to move. ddx(s2) = ((x100 - 400) / 30) ddy(s2) = ((y100 - 300) / 30) 'Set size. sz10(s2) = Rnd 'Set speed speed(s2) = .1 End If For t = 1 To 950 speed(t) = speed(t) * (1.05 + sp) stary(t) = stary(t) + ddy(t) * speed(t) starx(t) = starx(t) + ddx(t) * speed(t) cx = starx(t): cy = stary(t) r = sz10(t) + .5 c = _RGB32(255, 255, 255) fillCircle cx, cy, r, c 'skip: Next t Line (0, 0)-(_Width, _Height), _RGB32(0, 0, 0, 20), BF Return 'The start of your shot. youshoot: 'sx2 and sy2 are your shot coordinates. If ushoot = 0 Then sx2 = xt sy2 = yt - 20 ushoot = 1 Sound 400, .5 End If Return 'The drawing and movement of your shot and if it reaches the enemy. youshoot2: If ushoot = 1 Then For sz = .25 To 5 Step .25 Circle (sx2, sy2), sz, _RGB32(0, 0, 0) Next sz sy2 = sy2 - 3 If sy2 < 0 Then ushoot = 0: Return For szz = .25 To 5 Step .25 Circle (sx2, sy2), szz, _RGB32(255, 0, 0) Next szz If sx2 > x2 - 21 And sx2 < x2 + 41 And sy2 > y2 - 11 And sy2 < y2 + 21 And e1 = 0 And boss = 0 Then enemy = 1 ENEMYEXPLOSION sx2, sy2, x2, y2, sx, sy, x5, y5, sx3, sy3, x6, y6, x7, y7, sx4, sy4, sx5, sy5, enemy For sz = .25 To 5 Step .25 Circle (sx2, sy2), sz, _RGB32(0, 0, 0) Next sz sx = 1500 GoSub redrawshooter: points = points + 100 e1 = 1 If e1 = 1 And e2 = 1 And e3 = 1 And e4 = 1 Then tim = 3000 level = level + 1 level2 = level2 + 1 e1 = 0: e2 = 0: e3 = 0: e4 = 0 End If lives$ = Str$(lives) points$ = Str$(points) level$ = Str$(level2) _Title "Tech Invaders 5 Lives: " + lives$ + " Level: " + level$ + " Score: " + points$ ushoot = 0 GoTo go: End If If sx2 > x5 - 21 And sx2 < x5 + 41 And sy2 > y5 - 11 And sy2 < y5 + 21 And e2 = 0 And boss = 0 Then enemy = 2 ENEMYEXPLOSION sx2, sy2, x2, y2, sx, sy, x5, y5, sx3, sy3, x6, y6, x7, y7, sx4, sy4, sx5, sy5, enemy For sz = .25 To 5 Step .25 Circle (sx2, sy2), sz, _RGB32(0, 0, 0) Next sz sx3 = 1500 GoSub redrawshooter: points = points + 100 e2 = 1 If e1 = 1 And e2 = 1 And e3 = 1 And e4 = 1 Then tim = 3000 level = level + 1 level2 = level2 + 1 e1 = 0: e2 = 0: e3 = 0: e4 = 0 End If lives$ = Str$(lives) points$ = Str$(points) level$ = Str$(level2) _Title "Tech Invaders 5 Lives: " + lives$ + " Level: " + level$ + " Score: " + points$ ushoot = 0 GoTo go: End If If sx2 > x6 - 21 And sx2 < x6 + 41 And sy2 > y6 - 11 And sy2 < y6 + 21 And e3 = 0 And boss = 0 Then enemy = 3 ENEMYEXPLOSION sx2, sy2, x2, y2, sx, sy, x5, y5, sx3, sy3, x6, y6, x7, y7, sx4, sy4, sx5, sy5, enemy For sz = .25 To 5 Step .25 Circle (sx2, sy2), sz, _RGB32(0, 0, 0) Next sz sx4 = 1500 GoSub redrawshooter: points = points + 100 e3 = 1 If e1 = 1 And e2 = 1 And e3 = 1 And e4 = 1 Then level = level + 1 level2 = level2 + 1 tim = 3000 e1 = 0: e2 = 0: e3 = 0: e4 = 0 End If lives$ = Str$(lives) points$ = Str$(points) level$ = Str$(level2) _Title "Tech Invaders 5 Lives: " + lives$ + " Level: " + level$ + " Score: " + points$ ushoot = 0 GoTo go: End If If sx2 > x7 - 21 And sx2 < x7 + 41 And sy2 > y7 - 11 And sy2 < y7 + 21 And e4 = 0 And boss = 0 Then enemy = 5 ENEMYEXPLOSION sx2, sy2, x2, y2, sx, sy, x5, y5, sx3, sy3, x6, y6, x7, y7, sx4, sy4, sx5, sy5, enemy For sz = .25 To 5 Step .25 Circle (sx2, sy2), sz, _RGB32(0, 0, 0) Next sz sx5 = 1500 GoSub redrawshooter: points = points + 100 e4 = 1 If e1 = 1 And e2 = 1 And e3 = 1 And e4 = 1 Then level = level + 1 level2 = level2 + 1 e1 = 0: e2 = 0: e3 = 0: e4 = 0 tim = 3000 End If lives$ = Str$(lives) points$ = Str$(points) level$ = Str$(level2) _Title "Tech Invaders 5 Lives: " + lives$ + " Level: " + level$ + " Score: " + points$ ushoot = 0 GoTo go: End If 'To see if you hit the Boss. If sx2 > x2 - 31 And sx2 < x2 + 31 And sy2 > y2 - 11 And sy2 < y2 + 21 And e1 = 0 And boss = 1 Then b = b + 1 BB = 10 - b If bx = 0 Then GoTo bxx: bxx: bx = BB * 10 If bx < 0 Then GoTo bxx2: bxx2: Sound 100, 1 points = points + 100 lives$ = Str$(lives) points$ = Str$(points) level$ = Str$(level2) _Title "Tech Invaders 5 Lives: " + lives$ + " Level: " + level$ + " Score: " + points$ For sz = .25 To 5 Step .25 Circle (sx2, sy2), sz, _RGB32(0, 0, 0) Next sz If b > 10 Then sx = 1500: enemy = 4: ENEMYEXPLOSION sx2, sy2, x2, y2, sx, sy, x5, y5, sx3, sy3, x6, y6, x7, y7, sx4, sy4, sx5, sy5, enemy If b < 11 Then ushoot = 0: Return GoSub redrawshooter: bx = 0 BB = 0 b = 0 boss = 0 points = points + 1000 level = level + 1 tim = 3000 level2 = level2 + 1 e1 = 0: e2 = 0: e3 = 0: e4 = 0 lives$ = Str$(lives) points$ = Str$(points) level$ = Str$(level2) _Title "Tech Invaders 5 Lives: " + lives$ + " Level: " + level$ + " Score: " + points$ ushoot = 0 GoTo go: End If End If Return redrawshooter: For sz = .25 To 10 Step .25 Line (xt - 10 - sz, yt + 10)-(xt - sz, yt - 10), _RGB32(0, 255, 128) Line (xt + 10 + sz, yt + 10)-(xt + sz, yt - 10), _RGB32(0, 255, 128) Next sz Return 'The enemy's shot and if it reaches you. shoot: If shooting = 0 And e1 = 0 Then GoSub checktoshoot: sh = Int(Rnd * 10000) + 1 If sh < shh Then GoTo nexone: 'sx and sy are the first enemy shot coordinates. sx = x2 sy = y2 + 10 shooting = 1 Sound 300, .5 End If nexone: If shooting2 = 0 And e2 = 0 Then GoSub checktoshoot: sh2 = Int(Rnd * 10000) + 1 If sh2 < shh Then GoTo nexone2: 'sx3 and sy3 are the second enemy shot coordinates. sx3 = x5 sy3 = y5 + 10 shooting2 = 1 Sound 300, .5 End If nexone2: If shooting3 = 0 And e3 = 0 Then GoSub checktoshoot: sh3 = Int(Rnd * 10000) + 1 If sh3 < shh Then GoTo nextwo: 'sx4 and sy4 are the third enemy shot coordinates. sx4 = x6 sy4 = y6 + 10 shooting3 = 1 Sound 300, .5 End If nextwo: If shooting4 = 0 And e4 = 0 Then GoSub checktoshoot: sh4 = Int(Rnd * 10000) + 1 If sh4 < shh Then GoTo nexone3: 'sx5 and sy5 are the fourth enemy shot coordinates. sx5 = x7 sy5 = y7 + 10 shooting4 = 1 Sound 300, .5 End If nexone3: 'To see if first enemy hit you. If shooting = 1 And e1 = 0 Then For sz2 = .25 To 5 Step .25 Circle (sx, sy), sz2, _RGB32(0, 0, 0) Next sz2 sy = sy + 3 If sy > 620 Then shooting = 0: GoTo nex4: For szz2 = .25 To 5 Step .25 Circle (sx, sy), szz2, _RGB32(255, 0, 0) Next szz2 If sx > xt - 20 And sx < xt + 20 And sy > yt - 1 And sy < yt + 21 Then For sz3 = .25 To 5 Step .25 Circle (sx, sy), sz3, _RGB32(0, 0, 0) Next sz3 shooting = 0 GoSub explosion: End If End If nex4: 'To see if second enemy hit you. If shooting2 = 1 And e2 = 0 Then For sz2 = .25 To 5 Step .25 Circle (sx3, sy3), sz2, _RGB32(0, 0, 0) Next sz2 sy3 = sy3 + 3 If sy3 > 620 Then shooting2 = 0: GoTo nexx: For szz2 = .25 To 5 Step .25 Circle (sx3, sy3), szz2, _RGB32(255, 0, 0) Next szz2 If sx3 > xt - 20 And sx3 < xt + 20 And sy3 > yt - 1 And sy3 < yt + 21 Then For sz3 = .25 To 5 Step .25 Circle (sx3, sy3), sz3, _RGB32(0, 0, 0) Next sz3 shooting2 = 0 GoSub explosion: End If End If nexx: 'To see if third enemy hit you. If shooting3 = 1 And e3 = 0 Then For sz2 = .25 To 5 Step .25 Circle (sx4, sy4), sz2, _RGB32(0, 0, 0) Next sz2 sy4 = sy4 + 3 If sy4 > 620 Then shooting3 = 0: GoTo nexx2: For szz2 = .25 To 5 Step .25 Circle (sx4, sy4), szz2, _RGB32(255, 0, 0) Next szz2 If sx4 > xt - 20 And sx4 < xt + 20 And sy4 > yt - 1 And sy4 < yt + 21 Then For sz3 = .25 To 5 Step .25 Circle (sx4, sy4), sz3, _RGB32(0, 0, 0) Next sz3 shooting3 = 0 GoSub explosion: End If End If nexx2: If shooting4 = 1 And e4 = 0 And boss = 0 Then For sz2 = .25 To 5 Step .25 Circle (sx5, sy5), sz2, _RGB32(0, 0, 0) Next sz2 sy5 = sy5 + 3 If sy5 > 620 Then shooting4 = 0: Return For szz2 = .25 To 5 Step .25 Circle (sx5, sy5), szz2, _RGB32(255, 0, 0) Next szz2 If sx5 > xt - 20 And sx5 < xt + 20 And sy5 > yt - 1 And sy5 < yt + 21 Then For sz3 = .25 To 5 Step .25 Circle (sx5, sy5), sz3, _RGB32(0, 0, 0) Next sz3 shooting4 = 0 GoSub explosion: End If End If Return explosion: Randomize Timer dxx = (Rnd * 6) + -3 dyy = (Rnd * 6) + -3 dxx2 = (Rnd * 6) + -3 dyy2 = (Rnd * 6) + -3 dxx3 = (Rnd * 6) + -3 dyy3 = (Rnd * 6) + -3 dxx4 = (Rnd * 6) + -3 dyy4 = (Rnd * 6) + -3 dxx5 = (Rnd * 6) + -3 dyy5 = (Rnd * 6) + -3 dxx6 = (Rnd * 6) + -3 dyy6 = (Rnd * 6) + -3 Sound 160, .5 Sound 150, .5 Sound 140, .5 Sound 130, .5 Sound 120, .5 Sound 110, .5 Sound 100, .5 _AutoDisplay yourexplosion: DD = DD + 1 dxx = dxx + dxx / 4 dxx2 = dxx2 + dxx2 / 4 dxx3 = dxx3 + dxx3 / 4 dxx4 = dxx4 + dxx4 / 4 dxx5 = dxx5 + dxx5 / 4 dxx6 = dxx6 + dxx6 / 4 dyy = dyy + dyy / 4 dyy2 = dyy2 + dyy2 / 4 dyy3 = dyy3 + dyy3 / 4 dyy4 = dyy4 + dyy4 / 4 dyy5 = dyy5 + dyy5 / 4 dyy6 = dyy6 + dyy6 / 4 Line (xt + dxx, yt + dyy)-(xt + dxx + 2, yt + dyy + 2), _RGB32(255, 0, 0), BF Line (xt + dxx2, yt + dyy2)-(xt + dxx2 + 2, yt + dyy2 + 2), _RGB32(0, 255, 0), BF Line (xt + dxx3, yt + dyy3)-(xt + dxx3 + 2, yt + dyy3 + 2), _RGB32(255, 0, 0), BF Line (xt + dxx4, yt + dyy4)-(xt + dxx4 + 2, yt + dyy4 + 2), _RGB32(0, 255, 0), BF Line (xt + dxx5, yt + dyy5)-(xt + dxx5 + 2, yt + dyy5 + 2), _RGB32(255, 0, 0), BF Line (xt + dxx6, yt + dyy6)-(xt + dxx6 + 2, yt + dyy6 + 2), _RGB32(0, 255, 0), BF _Delay .02 If DD > 20 Then GoTo goingback GoTo yourexplosion: goingback: DD = 0 Line (xt - 21, yt - 21)-(xt + 41, yt + 41), _RGB32(0, 0, 0), BF For sz = .25 To 30 Step .5 Circle (xt, yt), sz, _RGB32(0, 0, 0) Next sz Line (xt - 10, yt - 15)-(xt + 10, yt), _RGB(0, 0, 0), BF DD = 0 lives = lives - 1 lives$ = Str$(lives) points$ = Str$(points) level$ = Str$(level2) _Title "Tech Invaders 5 Lives: " + lives$ + " Level: " + level$ + " Score: " + points$ Line (xt - 22, yt - 42)-(xt + 42, yt + 42), _RGB32(0, 0, 0), BF GoSub redrawshooter: If lives = 0 Then Locate 20, 40: Print "G A M E O V E R" Locate 22, 40: Print "Score: "; points Locate 23, 40: Print "Level: "; level2 Locate 25, 40: Input "Press Enter to go to Top Ten Scores.", tt$ 'Top Ten Scores scc = points If _FileExists("toptentech.txt") Then Else Open "toptentech.txt" For Output As #1 Restore originaltopten Do Read toptenname$, toptenscore! If toptenname$ = "EOF" Then Exit Do Print #1, toptenname$ Print #1, toptenscore! Loop Close #1 End If Open "toptentech.txt" For Input As #1 For n = 1 To 10 Input #1, name$(n) Input #1, score(n) If scc > score(n) And sct = 0 Then NN = n Print "You have made the Top Ten!" typename: Input "Type your name here (25 letters and spaces maximum.):", nm$(NN) If Len(nm$(NN)) > 25 Then Print "Name too long, try again." GoTo typename: End If sccc(NN) = scc sct = 1 End If If n = 10 And sct = 0 Then Close #1: GoTo nex7: Next n Close #1 nex5: Close #1 Open "toptentech.txt" For Output As #1 For n = 1 To NN If n <> NN Then Print #1, name$(n): Print #1, score(n) If n = NN Then Print #1, nm$(n) Print #1, sccc(n) End If Next n nex6: For n = NN To 10 Print #1, name$(n): Print #1, score(n) Next n Close #1 nex7: Cls Print: Print: Print Print " T O P T E N " Print: Print: Print Open "toptentech.txt" For Input As #1 For n = 1 To 10 If EOF(1) Then GoTo nex8: Input #1, name$(n) Input #1, score(n) Print " "; n; ". "; name$(n); score(n) Next n nex8: Close #1 Locate 21: Print "Play Again (Y/N)?" Do ag$ = InKey$ If ag$ = "y" Or ag$ = "Y" Then Clear: GoTo begin: If ag$ = "n" Or ag$ = "N" Then End Loop End If OPENINGSOUND Return checktoshoot: If level2 = 1 Then shh = 9950 If level2 = 2 Then shh = 9945 If level2 = 3 Then shh = 9940 If level2 = 4 Then shh = 9935 If level2 = 5 Then shh = 9930 If level2 = 6 Then shh = 9925 If level2 > 6 Then shh = 9920 Return originaltopten: Data Space Ace,7000 Data Suzy Swift,6000 Data Speedy Spencer,5000 Data Super Sam,4000 Data Battery Bob,3000 Data Karen Kryptonite,2750 Data Quick Ken,2500 Data Tiger Tessa,2250 Data Arcade Joe,2000 Data How Do U Play,1750 Data EOF,0 Sub OPENINGSOUND snd = 300 snd2 = 800 For t = 1 To 50 If snd > 800 Then snd = 300 If snd2 < 300 Then snd2 = 800 snd = snd + 20 Sound snd, .5 Next t End Sub Sub ENEMYEXPLOSION (sx2, sy2, x2, y2, sx, sy, x5, y5, sx3, sy3, x6, y6, x7, y7, sx4, sy4, sx5, sy5, enemy) For sz4 = .25 To 5 Step .25 Circle (sx2, sy2), sz4, _RGB32(0, 0, 0) Next sz4 Sound 160, .5 Sound 150, .5 Sound 140, .5 Sound 130, .5 Sound 120, .5 Sound 110, .5 Sound 100, .5 Randomize Timer dxx = (Rnd * 6) + -3 dyy = (Rnd * 6) + -3 dxx2 = (Rnd * 6) + -3 dyy2 = (Rnd * 6) + -3 dxx3 = (Rnd * 6) + -3 dyy3 = (Rnd * 6) + -3 dxx4 = (Rnd * 6) + -3 dyy4 = (Rnd * 6) + -3 dxx5 = (Rnd * 6) + -3 dyy5 = (Rnd * 6) + -3 dxx6 = (Rnd * 6) + -3 dyy6 = (Rnd * 6) + -3 _AutoDisplay explosion1: dd = dd + 1 dxx = dxx + dxx / 4 dxx2 = dxx2 + dxx2 / 4 dxx3 = dxx3 + dxx3 / 4 dxx4 = dxx4 + dxx4 / 4 dxx5 = dxx5 + dxx5 / 4 dxx6 = dxx6 + dxx6 / 4 dyy = dyy + dyy / 4 dyy2 = dyy2 + dyy2 / 4 dyy3 = dyy3 + dyy3 / 4 dyy4 = dyy4 + dyy4 / 4 dyy5 = dyy5 + dyy5 / 4 dyy6 = dyy6 + dyy6 / 4 If enemy = 1 Or enemy = 4 Then Line (x2 + dxx, y2 + dyy)-(x2 + dxx + 2, y2 + dyy + 2), _RGB32(255, 0, 0), BF Line (x2 + dxx2, y2 + dyy2)-(x2 + dxx2 + 2, y2 + dyy2 + 2), _RGB32(0, 255, 0), BF Line (x2 + dxx3, y2 + dyy3)-(x2 + dxx3 + 2, y2 + dyy3 + 2), _RGB32(255, 0, 0), BF Line (x2 + dxx4, y2 + dyy4)-(x2 + dxx4 + 2, y2 + dyy4 + 2), _RGB32(0, 255, 0), BF Line (x2 + dxx5, y2 + dyy5)-(x2 + dxx5 + 2, y2 + dyy5 + 2), _RGB32(255, 0, 0), BF Line (x2 + dxx6, y2 + dyy6)-(x2 + dxx6 + 2, y2 + dyy6 + 2), _RGB32(0, 255, 0), BF If dd > 20 Then GoTo goingback GoTo explosion1: goingback: dd = 0 Line (x2 - 21, y2 - 21)-(x2 + 41, y2 + 41), _RGB32(0, 0, 0), BF For sz4 = .25 To 5 Step .25 Circle (sx2, sy2), sz4, _RGB32(0, 0, 0) Next sz4 For sz4 = .25 To 5 Step .25 Circle (sx, sy), sz4, _RGB32(0, 0, 0) Next sz4 End If If enemy = 2 Then Line (x5 + dxx, y5 + dyy)-(x5 + dxx + 2, y5 + dyy + 2), _RGB32(255, 0, 0), BF Line (x5 + dxx2, y5 + dyy2)-(x5 + dxx2 + 2, y5 + dyy2 + 2), _RGB32(0, 255, 0), BF Line (x5 + dxx3, y5 + dyy3)-(x5 + dxx3 + 2, y5 + dyy3 + 2), _RGB32(255, 0, 0), BF Line (x5 + dxx4, y5 + dyy4)-(x5 + dxx4 + 2, y5 + dyy4 + 2), _RGB32(0, 255, 0), BF Line (x5 + dxx5, y5 + dyy5)-(x5 + dxx5 + 2, y5 + dyy5 + 2), _RGB32(255, 0, 0), BF Line (x5 + dxx6, y5 + dyy6)-(x5 + dxx6 + 2, y5 + dyy6 + 2), _RGB32(0, 255, 0), BF If dd > 20 Then GoTo goingback2: GoTo explosion1: goingback2: dd = 0 Line (x5 - 21, y5 - 21)-(x5 + 41, y5 + 41), _RGB32(0, 0, 0), BF For sz5 = .25 To 5 Step .25 Circle (sx2, sy2), sz5, _RGB32(0, 0, 0) Next sz5 For sz5 = .25 To 5 Step .25 Circle (sx3, sy3), sz5, _RGB32(0, 0, 0) Next sz5 End If If enemy = 3 Then Line (x6 + dxx, y6 + dyy)-(x6 + dxx + 2, y6 + dyy + 2), _RGB32(255, 0, 0), BF Line (x6 + dxx2, y6 + dyy2)-(x6 + dxx2 + 2, y6 + dyy2 + 2), _RGB32(0, 255, 0), BF Line (x6 + dxx3, y6 + dyy3)-(x6 + dxx3 + 2, y6 + dyy3 + 2), _RGB32(255, 0, 0), BF Line (x6 + dxx4, y6 + dyy4)-(x6 + dxx4 + 2, y6 + dyy4 + 2), _RGB32(0, 255, 0), BF Line (x6 + dxx5, y6 + dyy5)-(x6 + dxx5 + 2, y6 + dyy5 + 2), _RGB32(255, 0, 0), BF Line (x6 + dxx6, y6 + dyy6)-(x6 + dxx6 + 2, y6 + dyy6 + 2), _RGB32(0, 255, 0), BF If dd > 20 Then GoTo goingback3: GoTo explosion1: goingback3: dd = 0 Line (x6 - 21, y6 - 21)-(x6 + 41, y6 + 41), _RGB32(0, 0, 0), BF For sz5 = .25 To 5 Step .25 Circle (sx2, sy2), sz5, _RGB32(0, 0, 0) Next sz5 For sz5 = .25 To 5 Step .25 Circle (sx4, sy4), sz5, _RGB32(0, 0, 0) Next sz5 End If If enemy = 5 Then Line (x7 + dxx, y7 + dyy)-(x7 + dxx + 2, y7 + dyy + 2), _RGB32(255, 0, 0), BF Line (x7 + dxx2, y7 + dyy2)-(x7 + dxx2 + 2, y7 + dyy2 + 2), _RGB32(0, 255, 0), BF Line (x7 + dxx3, y7 + dyy3)-(x7 + dxx3 + 2, y7 + dyy3 + 2), _RGB32(255, 0, 0), BF Line (x7 + dxx4, y7 + dyy4)-(x7 + dxx4 + 2, y7 + dyy4 + 2), _RGB32(0, 255, 0), BF Line (x7 + dxx5, y7 + dyy5)-(x7 + dxx5 + 2, y7 + dyy5 + 2), _RGB32(255, 0, 0), BF Line (x7 + dxx6, y7 + dyy6)-(x7 + dxx6 + 2, y7 + dyy6 + 2), _RGB32(0, 255, 0), BF If dd > 20 Then GoTo goingback4: GoTo explosion1: goingback4: dd = 0 Line (x7 - 21, y7 - 21)-(x7 + 41, y7 + 41), _RGB32(0, 0, 0), BF For sz5 = .25 To 5 Step .25 Circle (sx2, sy2), sz5, _RGB32(0, 0, 0) Next sz5 For sz5 = .25 To 5 Step .25 Circle (sx5, sy5), sz5, _RGB32(0, 0, 0) Next sz5 End If End Sub 'from Steve Gold standard Sub fillCircle (CX As Integer, CY As Integer, R As Integer, C As _Unsigned Long) Dim Radius As Integer, RadiusError As Integer Dim X As Integer, Y As Integer Radius = Abs(R): RadiusError = -Radius: X = Radius: Y = 0 If Radius = 0 Then PSet (CX, CY), C: Exit Sub Line (CX - X, CY)-(CX + X, CY), C, BF While X > Y RadiusError = RadiusError + Y * 2 + 1 If RadiusError >= 0 Then If X <> Y + 1 Then Line (CX - Y, CY - X)-(CX + Y, CY - X), C, BF Line (CX - Y, CY + X)-(CX + Y, CY + X), C, BF End If X = X - 1 RadiusError = RadiusError - X * 2 End If Y = Y + 1 Line (CX - X, CY - Y)-(CX + X, CY - Y), C, BF Line (CX - X, CY + Y)-(CX + X, CY + Y), C, BF Wend End Sub