Challenge: 
Winner?: 
No
Code Snippet: 
sync on
sync rate 3
randomize timer()
set display mode 500, 500, 32
print "ATTACK OF THE W'S"
print
print
print "Loading..."
sync


load dll "kernel32.dll",1

type ship
    x as float
    y as float
    mx as float
    my as float
    global
endtype

type p
    x as float
    y as float
    mx as float
    my as float
    r as float
    g as float
    b as float
endtype

type lvl
    expld as integer
endtype
global level as lvl

type ln
    y as float
endtype



global player as ship
player.x = 100
player.y = 150



global laser as ship


dim enemy(2000) as ship
maxen = 5
for x = 1 to maxen
    enemy(x).x = rnd(500)
    enemy(x).y = 0
next x

dim part(5) as p


cls


sync
wait 2000
gosub cutscene


do
    cls
    
    gosub controlplayer
    gosub controlenemies
    gosub handleparts
    sync
    level.expld = 0
loop

controlplayer:
    if leftkey() = 1 then player.mx = -20
    if rightkey() = 1 then player.mx = 20
    if upkey() = 1 then player.my = -20
    if downkey() = 1 then player.my = 20
    
    player.x = player.x + player.mx
    player.y = player.y + player.my
    
    player.mx = player.mx * .5
    player.my = player.my * .5
    
    ink rgb(0,255,0),0
    text player.x, player.y, "A"
    
    laser.y = laser.y - 40
    
    ink rgb(255,0,0),0
    text laser.x, laser.y, "|"
    
    if left$(entry$(), 1) = " " and dthtmr < 0
        laser.x = player.x
        laser.y = player.y
        f = 1000
        for s = 1 to 5
            f = f - 100
            call dll 1, "Beep", f, 30
        next s
    endif
    dthtmr = dthtmr - 1
    if dthtmr = 0 then gosub endofgame

        clear entry buffer
    
return


controlenemies:
ink rgb(0,0,255),0
    for x = 1 to maxen
        enemy(x).x = enemy(x).x + enemy(x).mx
        enemy(x).y = enemy(x).y + enemy(x).my
        if enemy(x).x < player.x then enemy(x).mx = enemy(x).mx + .1
        if enemy(x).x > player.x then enemy(x).mx = enemy(x).mx - .1
        if enemy(x).y < player.y then enemy(x).my = enemy(x).my + .1
        if enemy(x).y > player.y then enemy(x).my = enemy(x).my - .1
        text enemy(x).x, enemy(x).y, "W"
        if laser.y - enemy(x).y < -40 and abs(enemy(x).x - laser.x) < 20
            explode(enemy(x).x, enemy(x).y)
            score = score + 100
            enemy(x).x = rnd(500)
            enemy(x).y = -10
            enemy(x).mx = 0
            enemy(x).my = 0
            if rnd(2) = 1
                maxen = maxen + 1
                enemy(maxen).x = rnd(500)
                enemy(maxen).y = -10
            endif
        endif
        
        if abs(player.y - enemy(x).y) < 20 and abs(enemy(x).x - player.x) < 20
            explode(player.x, player.y)
            player.y = -1000000
            dthtmr = 20
        endif
    next x
return

handleparts:
    for a = 1 to 5
        part(a).x = part(a).x + part(a).mx
        part(a).y = part(a).y + part(a).my
        ink rgb(part(a).r,part(a).g, part(a).b), 0
        text part(a).x, part(a).y, "*"
        part(a).r = part(a).r * .9
        part(a).g = part(a).g * .9
        part(a).b = part(a).b * .9
    next a
return

function explode(x,y)
    if level.expld = 0
        for s = 1 to 20
            call dll 1, "Beep", rnd(100), 30
        next s
        level.expld = 1
    endif
    for a = 1 to 5
        part(a).x = x
        part(a).y = y
        part(a).mx = rnd(50) - 25
        part(a).my = rnd(50) - 25
        c = rnd(1)
        if c = 0 then part(a).r = 255:part(a).g = 0: part(a).b = 0
        if c = 1 then part(a).r = 255:part(a).g = 255: part(a).b = 0
    next a
endfunction


cutscene:
    text 10, 30, "A                   B"
    set cursor 0, 70
    print "B:  They're back..."
    sync
    wait 2000
    print "A:  Who?"
    sync
    wait 2000
    print "B:  The W's... They are back."
    sync
    wait 2000
    print "A:  LMAO!"
    text 10, 30, "A!!                 B"
    sync
    wait 2000
    print "B:  No, I'm seroius."
    ink 0,0
    box 0, 30, 500, 45
    ink rgb(255,255,255), 0
    text 10, 30, "A                   B"
    sync
    wait 600
    print "B:  They are here to kill us all."
    sync
    wait 3000
    print "A:  Uh oh."
    sync
    wait 1600
    print "B:  Yeah, the only solution is for you to go kill em all."
    sync
    wait 2000
    text 10, 30, "A!                  B"
    sync
    wait 1000
    print "A:  Crap..."
    sync
    wait 3000
return


endofgame:
    cls
    ink rgb(150,150,150), 0
    score$ = str$(score)
    while len(score$) < 6
    score$ = "0