heres a demo of the game im making, the main playing bit is done, its judt the details and addons i need to do.
things on mi list:
more attack sequences
the bombs explode in all directions
powerups
boss stages
stats bar with lives, score ect
there are a few glitches but nuffin major, and id apreciate any comments or idears u mite be able to give me.
sussed it, go down
heres the code if ur interested
Rem Project: space game
Rem Created: 12/1/2005 3:09:51 PM
`*** screen stats
#constant screenwidth 1280
#constant screenheight 1024
#constant screendepth 32
`*** boolean
#constant true 1
#constant false 0
`***neutral sprites
#constant background 1017
#constant powerup 1016
#constant explosion 1000
#constant asteroid 1020
#constant bomb 1021
`***sprites on my side
#constant ship 31
#constant playerspecial 32
#constant playerfire 1
`***sprites aginst me
#constant aliencraft1 131
#constant aliencraft2 141
#constant aliencraft3 152
#constant alienfire 100
`*** types
type playerfiretype
xpos as integer
ypos as integer
used as integer
angle as float
velocity as integer
shot as integer
endtype
type alienfiretype
xpos as integer
ypos as integer
used as INTEGER
angle as float
velocity as integer
shot as integer
endtype
type aliencrafttype
xpos as integer
ypos as integer
angle as float
velocity as integer
craft as integer
endtype
type playercrafttype
xpos as integer
ypos as integer
angle as float
velocity as integer
endtype
type bombtype
xpos as integer
ypos as integer
velocity as integer
angle as float
endtype
type specialtype
xpos as integer
ypos as integer
velocity as integer
angle as float
endtype
type explodetype
xpos as integer
ypos as integer
frame as integer
used as integer
endtype
`*** arrays
dim playerfire(30) as playerfiretype
dim aliencraft(30) as aliencrafttype
dim alienfire(30) as alienfiretype
dim explode(15) as explodetype
`*** player types
global playership as playercrafttype
global bomb as bombtype
global special as specialtype
`*** time markers
global lastammo as integer
global lastplayerfire as integer
global lastattack as integer
global lastcollision as integer
`global lastambush as integer
`*** globals
global keys as integer rem this records what the player has input
global style as integer rem this is the attack pattern
global specialsize as integer rem this is to determinthe size of the special attack
global usingspecial as boolean rem this is wheather the special attack is being used or not
global numaliens as integer rem this is to tell the alienmove how many aliens there are
global movebomb as boolean rem
global bombmoves as integer rem
global tokill as integer rem this is to count hw many aliens need to be killed before next attack
GLOBAL SCORE AS INTEGER rem this holds the players score
global shot as integer
global switch as integer
global velocity as integer
global angle as integer
global xpos as integer
global ypos as integer
global asteroid_use as integer
global bomb_use as integer
global moves as integer
global rotation as integer
`***main loop
setup()
choose_attack()
repeat
sprite background, - 2000, -2000, background
`*** move player
if sprite exist(ship) = true
keys = player_input()
move_player(keys)
else
if tokill = 0
sprite ship, screenwidth/2, screenheight/2, ship
offset sprite ship, (sprite width(ship)/2), (sprite height(ship)/2)
playership.xpos = sprite x(ship)
playership.ypos = sprite y(ship)
playership.angle = 0
playership.velocity = 3
endif
endif
`***move aliens
if tokill = 0
style = choose_attack()
else
move_aliens(style)
endif
`***move ammunition
if timer() - lastammo > 10
for switch = 1 to 2
for shot = 1 to 30
if switch = 1
if sprite exist (shot)
xpos = playerfire(shot).xpos
ypos = playerfire(shot).ypos
used = playerfire(shot).used
angle = playerfire(shot).angle
velocity = playerfire(shot).velocity
ammo(xpos, ypos, used, angle, velocity, shot, switch)
endif
endif
if switch = 2
if sprite exist (shot + 99)
xpos = alienfire(shot).xpos
ypos = alienfire(shot).ypos
used = alienfire(shot).used
angle = alienfire(shot).angle
velocity = alienfire(shot).velocity
ammo(xpos, ypos, used, angle, velocity, shot, switch)
endif
endif
next shot
next switch
lastammo = timer()
endif
if timer() - lastcollision > 60
`*** collision detection
playerfire()
alienfire()
alien()
bomb()
asteroid()
lastcollision = timer()
endif
sprite background, 0, 0, background
stats()
fastsync
rem player is out of lives
until 1 > 2
`gameover()
fastsync
wait key
`***** FUNCTIONS
function setup()
set display mode screenwidth, screenheight, screendepth
set image colorkey 255, 0, 255
hide mouse
sync on
set text size 50
set cursor 300, 100
print "controls:"
set cursor 100, 175
print "left mouse click to fire, right mouse click for special attack."
set cursor 100, 250
print "left and right keys to rotate left and right"
set cursor 100, 325
print "up key for speed boost, and down key to hover"
set cursor 350, 500
print "press any key to start"
fastsync
wait key
load image "background2.jpg", background
sprite background, 0, 0, background
stretch sprite background, 250, 200
`*** last times
lastammo = timer()
lastplayerfire = timer()
lastattack = timer()
lastcollision = timer()
`*** load player
load image "ship.bmp", ship
sprite ship, 500, 500, ship
offset sprite ship, (sprite width(ship)/2), (sprite height(ship)/2)
playership.velocity = 3
`*** load images
load image "special.bmp", playerspecial
load image "playerfire.bmp", playerfire
load image "alienfire.bmp", alienfire
load image "homer.bmp", aliencraft1
load image "shooter.bmp", aliencraft2
load image "explode_1.bmp", explosion
`***load sounds
load sound "blaster.wav", playerfire
load sound "rippler.wav", playerspecial
load sound "large explosion 1.wav", aliencraft1
load sound "zapper 2.wav", alienfire
load sound "jet loop.wav", ship
load sound "boom 2.wav", asteroid
load sound "large explosion 2.wav", bomb
`***load animated sprites
create animated sprite asteroid, "asteroid.bmp", 4, 4, asteroid
sprite asteroid, -2000, -2000, asteroid
asteroid_use = 0
create animated sprite bomb, "bomb.bmp", 8, 1, bomb
sprite bomb, screenwidth + 100, -100, bomb
bomb_use = 0
endfunction
function player_input()
keys = 0
if leftkey() = 1
keys = keys || %1
endif
if rightkey() = 1
keys = keys || %10
endif
if upkey() = 1
keys = keys || %100
endif
if downkey() = 1
keys = keys || %1000
endif
if mouseclick() = 1
keys = keys || %10000
endif
if mouseclick() = 2 or mouseclick() = 3
keys = keys || %100000
endif
endfunction keys
function move_player(keys)
`*** move left
if (keys && 1) > 0
angle = playership.angle
rotate sprite ship, angle - 1
playership.angle = sprite angle(ship)
endif
`*** move right
if (keys && 2) > 0
angle = playership.angle
rotate sprite ship, angle + 1
playership.angle = sprite angle(ship)
endif
`*** move up
if (keys && 4) > 0
move sprite ship, playership.velocity
playership.xpos = sprite x(ship)
playership.ypos = sprite y(ship)
endif
`***move down
if (keys && 8) > 0
playership.velocity = 0
else
playership.velocity = 3
endif
`***normal attack
if (keys && 16) > 0
if timer() - lastplayerfire > 300
x = sprite x(ship)
y = sprite y(ship)
for c = 1 to 30
if playerfire(c).used = 0
sprite c, x, y, playerfire
offset sprite c, (sprite width(c)/2), (sprite height(c)/2)
sprite c, x, y, playerfire
playerfire(c).xpos = x
playerfire(c).ypos = y
playerfire(c).used = true
playerfire(c).velocity = 5
rotate sprite c, playership.angle
play sound playerfire
dec score, 5
exit
endif
next c
lastplayerfire = timer()
endif
endif
remstart `***special attack
if (keys && 32) > 0 and usingspecial = false
x = sprite x(ship)
y = sprite y(ship)
sprite playerspecial, x, y , playerspecial
offset sprite playerspecial, (sprite width(playerspecial)/2), (sprite height(playerspecial)/2)
sprite playerspecial, x, y , playerspecial
rotate sprite playerspecial, playership.angle
play sound playerspecial
specialsize = 100
special.xpos = x
special.ypos = y
special.angle = playership.angle
special.velocity = 3
endif
remend
move sprite ship, playership.velocity - 2
playership.xpos = sprite x(ship)
playership.ypos = sprite y(ship)
findplayer()
endfunction
function ammo(xpos, ypos, used, angle, velocity, shot, switch)
if switch = 2
shot = shot + 99
endif
if used = true
move sprite shot, velocity
ypos = sprite y(shot)
xpos = sprite x(shot)
if ypos < 0 or ypos > screenheight or xpos < 0 or xpos > screenwidth
delete sprite shot
used = false
endif
endif
if switch = 2
shot = shot - 99
endif
if switch = 1
playerfire(shot).xpos = xpos
playerfire(shot).ypos = ypos
playerfire(shot).used = used
else
alienfire(shot).xpos = xpos
alienfire(shot).ypos = ypos
alienfire(shot).used = used
endif
endfunction
function move_aliens(style)
if timer() - lastattack > 20
if style = 1
for c = 131 to 131 + numaliens
if sprite exist(c)
`speed = aliencraft(131).velocity
move sprite c, aliencraft(c - 130).velocity
if sprite y(c) > screenheight
delete sprite c
dec tokill
endif
endif
next c
endif
if style = 2
for c = 131 to 131 + numaliens
if sprite exist(c)
move sprite c, aliencraft(c - 130).velocity
if sprite y(c) < 10
dec tokill
delete sprite c
endif
endif
next c
endif
if style = 3
for c = 131 to 131 + numaliens
if sprite exist(c)
move sprite c, aliencraft(c - 130).velocity
if sprite y(c) > screenheight
dec tokill
delete sprite c
endif
endif
next c
endif
if style = 4
for c = 131 to 131 + numaliens
if sprite exist(c)
move sprite c, aliencraft(c - 130).velocity
if sprite x(c) > screenwidth + 30
dec tokill
delete sprite c
endif
endif
next c
endif
if style = 5
for c = 131 to 134
if sprite exist(c)
move sprite c, aliencraft(c - 130).velocity
if sprite x(c) > screenwidth + 30
delete sprite c
dec tokill
endif
endif
next c
for c = 135 to 138
if sprite exist(c)
move sprite c, aliencraft(c - 130).velocity
if sprite x(c) < 10
delete sprite c
dec tokill
endif
endif
next c
endif
if style = 6
for c = 131 to 131 + numaliens
if sprite exist(c)
move sprite c, aliencraft(c - 130).velocity
if moves > 200 and rotation > 0
rotate sprite c, aliencraft(c-130).angle + 1
aliencraft(c-130).angle = aliencraft(c-130).angle + 1
endif
if sprite y(c) > screenheight
dec tokill
delete sprite c
endif
endif
next c
inc moves
dec rotation
endif
if style = 7
for c = 131 to 134
if sprite exist(c)
move sprite c, aliencraft(c - 130).velocity
if moves > 200 and rotation > 0
rotate sprite c, aliencraft(c-130).angle + 1
aliencraft(c-130).angle = aliencraft(c-130).angle + 1
endif
if sprite y(c) > screenwidth + 20
delete sprite c
dec tokill
endif
endif
next c
for c = 135 to 138
if sprite exist(c)
move sprite c, aliencraft(c - 130).velocity
if moves > 200 and rotation > 0
rotate sprite c, aliencraft(c-130).angle + 1
aliencraft(c-130).angle = aliencraft(c-130).angle + 1
endif
if sprite y(c)< 0
delete sprite c
dec tokill
endif
endif
next c
inc moves
dec rotation
endif
if style = 8
for c = 131 to 132
if sprite exist(c)
move sprite c, aliencraft(c - 130).velocity
if sprite x(c) > screenwidth + 30
delete sprite c
dec tokill
endif
endif
next c
for c = 133 to 134
if sprite exist(c)
move sprite c, aliencraft(c - 130).velocity
if sprite y(c) > screenheight + 30
delete sprite c
dec tokill
endif
endif
next c
for c = 135 to 136
if sprite exist(c)
move sprite c, aliencraft(c - 130).velocity
if sprite x(c) < -10
delete sprite c
dec tokill
endif
endif
next c
for c = 137 to 138
if sprite exist(c)
move sprite c, aliencraft(c - 130).velocity
if sprite y(c) < -10
delete sprite c
dec tokill
endif
endif
next c
endif
for c = 131 to 131 + numaliens
if sprite exist(c)
if sprite image(c) = aliencraft2
shoot = rnd(200)
if shoot = 10
x = sprite x(c)
y = sprite y(c)
for laser = 1 to 30
if alienfire(laser).used = false
sprite laser + 99, x, y, alienfire
rotate sprite laser + 99, aliencraft(c - 130).angle
offset sprite laser + 99, (sprite width(laser + 99)/2), (sprite height(laser + 99)/2)
alienfire(laser).angle = aliencraft(c - 130).angle
alienfire(laser).used = true
alienfire(laser).xpos = sprite x(laser + 99)
alienfire(laser).ypos = sprite y(laser + 99)
alienfire(laser).velocity = -6
alienfire(laser).shot = laser
play sound alienfire
exit
endif
next laser
endif
endif
endif
next c
if asteroid_use = 1
move sprite asteroid, 5
if sprite x(asteroid) > screenwidth + 200 or sprite x(asteroid) < -200 or sprite y(asteroid) > screenheight + 200 or sprite y(asteroid) < -200
sprite asteroid, -100, -100, asteroid
asteroid_use = 0
endif
endif
if bomb_use = 1
move sprite bomb, 3
if sprite x(bomb) > screenwidth + 200 or sprite x(bomb) < -200 or sprite y(bomb) > screenheight + 200 or sprite y(bomb) < -200
sprite bomb, screenwidth + 100, -100, bomb
bomb_use = 0
endif
endif
play sprite asteroid, 1, 15, 70
play sprite bomb, 1, 7, 70
lastattack = timer()
endif
endfunction
function choose_attack()
randomize timer()
style = rnd(7) + 1
if style = 1
sprite 131, 200, -100 , aliencraft2
sprite 132, 400, -100 , aliencraft2
sprite 133, 600, -100 , aliencraft2
sprite 134, 800, -100 , aliencraft2
for c = 1 to 4
offset sprite c + 130, (sprite width(c + 130)/2), (sprite height(c + 130)/2)
aliencraft(c).xpos = sprite x(c + 130)
aliencraft(c).ypos = sprite y(c + 130)
aliencraft(c).craft = c + 130
aliencraft(c).angle = 0
aliencraft(c).velocity = -3
next c
numaliens = 3
tokill = 4
endif
if style = 2
sprite 131, 400, screenheight , aliencraft1
sprite 132, 600, screenheight , aliencraft1
sprite 133, 800, screenheight , aliencraft2
sprite 134, 200, screenheight , aliencraft2
rotate sprite 131, 180
rotate sprite 132, 180
rotate sprite 133, 180
rotate sprite 134, 180
for c = 1 to 2
offset sprite c + 130, (sprite width(c + 130)/2), (sprite height(c + 130)/2)
aliencraft(c).xpos = sprite x(c + 130)
aliencraft(c).ypos = sprite y(c + 130)
aliencraft(c).craft = c + 130
aliencraft(c).angle = 180
aliencraft(c).velocity = -6
next c
for c = 3 to 4
offset sprite c + 130, (sprite width(c + 130)/2), (sprite height(c + 130)/2)
aliencraft(c).xpos = sprite x(c + 130)
aliencraft(c).ypos = sprite y(c + 130)
aliencraft(c).craft = c + 130
aliencraft(c).angle = 180
aliencraft(c).velocity = -3
next c
numaliens = 3
tokill = 4
endif
if style = 3
sprite 131, 400, -100 , aliencraft2
sprite 132, 600, -100 , aliencraft2
sprite 133, 800, -100 , aliencraft2
for c = 1 to 3
offset sprite c + 130, (sprite width(c + 130)/2), (sprite height(c + 130)/2)
aliencraft(c).xpos = sprite x(c + 130)
aliencraft(c).ypos = sprite y(c + 130)
aliencraft(c).craft = c + 130
aliencraft(c).angle = 0
aliencraft(c).velocity = -3
next c
numaliens = 2
tokill = 3
endif
if style = 4
sprite 131, -50, 100 , aliencraft1
sprite 132, -50, 300 , aliencraft1
sprite 133, -50, 500 , aliencraft1
sprite 134, -50, 700 , aliencraft1
sprite 135, 0, 200 , aliencraft2
sprite 136, 0, 400 , aliencraft2
sprite 137, 0, 600 , aliencraft2
sprite 138, 0, 800 , aliencraft2
rotate sprite 131, 270
rotate sprite 132, 270
rotate sprite 133, 270
rotate sprite 134, 270
rotate sprite 135, 270
rotate sprite 136, 270
rotate sprite 137, 270
rotate sprite 138, 270
for c = 1 to 4
offset sprite c + 130, (sprite width(c + 130)/2), (sprite height(c + 130)/2)
aliencraft(c).xpos = sprite x(c + 130)
aliencraft(c).ypos = sprite y(c + 130)
aliencraft(c).craft = c + 130
aliencraft(c).angle = 270
aliencraft(c).velocity = -6
next c
for c = 5 to 8
offset sprite c + 130, (sprite width(c + 130)/2), (sprite height(c + 130)/2)
aliencraft(c).xpos = sprite x(c + 130)
aliencraft(c).ypos = sprite y(c + 130)
aliencraft(c).craft = c + 130
aliencraft(c).angle = 270
aliencraft(c).velocity = -3
next c
numaliens = 7
tokill = 8
endif
if style = 5
sprite 131, 0, 100 , aliencraft1
sprite 132, -50, 200 , aliencraft1
sprite 133, 0, 300 , aliencraft1
sprite 134, -50, 400 , aliencraft1
sprite 135, screenwidth, 500 , aliencraft2
sprite 136, screenwidth + 50, 600 , aliencraft2
sprite 137, screenwidth, 700 , aliencraft2
sprite 138, screenwidth + 50, 800 , aliencraft2
rotate sprite 131, 270
rotate sprite 132, 270
rotate sprite 133, 270
rotate sprite 134, 270
rotate sprite 135, 90
rotate sprite 136, 90
rotate sprite 137, 90
rotate sprite 138, 90
for c = 1 to 4
offset sprite c + 130, (sprite width(c + 130)/2), (sprite height(c + 130)/2)
aliencraft(c).xpos = sprite x(c + 130)
aliencraft(c).ypos = sprite y(c + 130)
aliencraft(c).craft = c + 130
aliencraft(c).angle = 270
aliencraft(c).velocity = -6
next c
for c = 5 to 8
offset sprite c + 130, (sprite width(c + 130)/2), (sprite height(c + 130)/2)
aliencraft(c).xpos = sprite x(c + 130)
aliencraft(c).ypos = sprite y(c + 130)
aliencraft(c).craft = c + 130
aliencraft(c).angle = 90
aliencraft(c).velocity = -3
next c
numaliens = 7
tokill = 8
endif
if style = 6
sprite 131, 400, -100 , aliencraft2
sprite 132, 600, -100 , aliencraft2
sprite 133, 800, -100 , aliencraft2
for c = 1 to 3
offset sprite c + 130, (sprite width(c + 130)/2), (sprite height(c + 130)/2)
aliencraft(c).xpos = sprite x(c + 130)
aliencraft(c).ypos = sprite y(c + 130)
aliencraft(c).craft = c + 130
aliencraft(c).angle = 0
aliencraft(c).velocity = -3
next c
numaliens = 2
tokill = 3
moves = 0
rotation = 560
endif
if style = 7
sprite 131, 100, 0 , aliencraft2
sprite 132, 400, 0 , aliencraft2
sprite 133, 700, 0 , aliencraft2
sprite 134, 1000, 0 , aliencraft2
sprite 135, 250, screenheight , aliencraft2
sprite 136, 550, screenheight , aliencraft2
sprite 137, 850, screenheight , aliencraft2
rotate sprite 131, 0
rotate sprite 132, 0
rotate sprite 133, 0
rotate sprite 134, 0
rotate sprite 135, 180
rotate sprite 136, 180
rotate sprite 137, 180
for c = 1 to 4
offset sprite c + 130, (sprite width(c + 130)/2), (sprite height(c + 130)/2)
aliencraft(c).xpos = sprite x(c + 130)
aliencraft(c).ypos = sprite y(c + 130)
aliencraft(c).craft = c + 130
aliencraft(c).angle = 0
aliencraft(c).velocity = -3
next c
for c = 5 to 7
offset sprite c + 130, (sprite width(c + 130)/2), (sprite height(c + 130)/2)
aliencraft(c).xpos = sprite x(c + 130)
aliencraft(c).ypos = sprite y(c + 130)
aliencraft(c).craft = c + 130
aliencraft(c).angle = 180
aliencraft(c).velocity = -3
next c
numaliens = 6
tokill = 7
moves = 0
rotation = 560
endif
if style = 8
sprite 131, -10, 100 , aliencraft1
sprite 132, -10, 300 , aliencraft1
sprite 133, 600, -10 , aliencraft1
sprite 134, 200, -10 , aliencraft1
sprite 135, screenwidth, 500 , aliencraft1
sprite 136, screenwidth , 800 , aliencraft1
sprite 137, 400, screenheight , aliencraft1
sprite 138, 800, screenheight , aliencraft1
rotate sprite 131, 270
rotate sprite 132, 270
rotate sprite 133, 0
rotate sprite 134, 0
rotate sprite 135, 90
rotate sprite 136, 90
rotate sprite 137, 180
rotate sprite 138, 180
for c = 1 to 2
offset sprite c + 130, (sprite width(c + 130)/2), (sprite height(c + 130)/2)
aliencraft(c).xpos = sprite x(c + 130)
aliencraft(c).ypos = sprite y(c + 130)
aliencraft(c).craft = c + 130
aliencraft(c).angle = 90
aliencraft(c).velocity = -6
next c
for c = 3 to 4
offset sprite c + 130, (sprite width(c + 130)/2), (sprite height(c + 130)/2)
aliencraft(c).xpos = sprite x(c + 130)
aliencraft(c).ypos = sprite y(c + 130)
aliencraft(c).craft = c + 130
aliencraft(c).angle = 0
aliencraft(c).velocity = -6
next c
for c = 5 to 6
offset sprite c + 130, (sprite width(c + 130)/2), (sprite height(c + 130)/2)
aliencraft(c).xpos = sprite x(c + 130)
aliencraft(c).ypos = sprite y(c + 130)
aliencraft(c).craft = c + 130
aliencraft(c).angle = 270
aliencraft(c).velocity = -6
next c
for c = 7 to 8
offset sprite c + 130, (sprite width(c + 130)/2), (sprite height(c + 130)/2)
aliencraft(c).xpos = sprite x(c + 130)
aliencraft(c).ypos = sprite y(c + 130)
aliencraft(c).craft = c + 130
aliencraft(c).angle = 180
aliencraft(c).velocity = -6
next c
numaliens = 7
tokill = 8
endif
if asteroid_use = 0
direction = rnd(8)
select direction
case 1
place = rnd(900)+50
sprite asteroid, place, 0, asteroid
offset sprite asteroid, (sprite width(asteroid)/2), (sprite height(asteroid)/2)
rotate sprite asteroid, rnd(140)+110
asteroid_use = 1
endcase
case 2
place = rnd(900)+50
sprite asteroid, place, screenheight, asteroid
offset sprite asteroid, (sprite width(asteroid)/2), (sprite height(asteroid)/2)
rotate sprite asteroid, rnd(160) - 80
asteroid_use = 1
endcase
case 3
place = rnd(900)+50
sprite asteroid, 0, place, asteroid
offset sprite asteroid, (sprite width(asteroid)/2), (sprite height(asteroid)/2)
rotate sprite asteroid, rnd(150) + 20
asteroid_use = 1
endcase
case 4
place = rnd(900)+50
sprite asteroid, screenwidth, place, asteroid
offset sprite asteroid, (sprite width(asteroid)/2), (sprite height(asteroid)/2)
rotate sprite asteroid, rnd(200) + 140
asteroid_use = 1
endcase
case default
endcase
endselect
endif
if bomb_use = 0
direction = rnd(8)
select direction
case 1
place = rnd(900)+50
sprite bomb, place, 0, bomb
offset sprite bomb, (sprite width(bomb)/2), (sprite height(bomb)/2)
rotate sprite bomb, rnd(140)+110
bomb_use = 1
endcase
case 2
place = rnd(900)+50
sprite bomb, place, screenheight, bomb
offset sprite bomb, (sprite width(bomb)/2), (sprite height(bomb)/2)
rotate sprite bomb, rnd(160) - 80
bomb_use = 1
endcase
case 3
place = rnd(900)+50
sprite bomb, 0, place, bomb
offset sprite bomb, (sprite width(bomb)/2), (sprite height(bomb)/2)
rotate sprite bomb, rnd(150) + 20
bomb_use = 1
endcase
case 4
place = rnd(900)+50
sprite bomb, screenwidth, place, bomb
offset sprite bomb, (sprite width(bomb)/2), (sprite height(bomb)/2)
rotate sprite bomb, rnd(200) + 140
bomb_use = 1
endcase
case default
endcase
endselect
endif
endfunction style
function stats()
set cursor 100, 950
PRINT " "
set cursor 100, 950
print "SCORE: " , SCORE
ENDFUNCTION
function findplayer()
if playership.xpos > screenwidth
sprite ship, playership.xpos - screenwidth, playership.ypos, ship
playership.xpos = sprite x(ship)
x = sprite x(ship)
playership.xpos = x
endif
if playership.xpos < 0
sprite ship, playership.xpos + width, playership.ypos, ship
playership.xpos = sprite x(ship)
x = sprite x(ship)
playership.xpos = x
endif
if playership.ypos > screenheight
sprite ship, playership.xpos, playership.ypos - screenheight, ship
playership.ypos = sprite y(ship)
y = sprite y(ship)
playership.ypos = y
endif
if playership.ypos < 0
sprite ship, playership.xpos, playership.ypos + screenheight, ship
playership.ypos = sprite y(ship)
y = sprite y(ship)
playership.ypos = y
endif
endfunction
function playerfire()
for shotno = 1 to 30
if playerfire(shotno).used = 1
if sprite collision(shotno, 0) => 100
target = sprite collision(shotno, 0)
if target >= 100 and target <= 130
`***hit alienfire
delete sprite shotno
delete sprite target
playerfire(shotno).used = 0
alienfire(target - 99).used = 0
else
if target => 131 and target =< 151
`***hit alien
delete sprite shotno
delete sprite target
playerfire(shotno).used = 0
dec tokill
inc score, 50
play sound aliencraft1
else
if target = 1020
`***hit asteroid
delete sprite shotno
playerfire(shotno).used = 0
sprite asteroid, -100, -100, asteroid
asteroid_use = 0
play sound asteroid
else
if target = 1021
`***hit bomb
delete sprite shotno
playerfire(shotno).used = 0
sprite bomb, screenwidth + 100, -100, bomb
bomb_use = 0
play sound bomb
endif
endif
endif
endif
endif
endif
next shotno
endfunction
function alienfire()
for shotno = 1 to 30
if alienfire(shotno).used = 1
if sprite collision(shotno + 99, 0)
target = sprite collision(shotno + 99, 0)
if target <= 30
`***hit playerfire
delete sprite shotno + 99
delete sprite target
playerfire(target).used = 0
alienfire(shotno).used = 0
else
if target = 31
`***hit player
delete sprite shotno + 99
delete sprite target
alienfire(shotno).used = 0
else
if target = 1020
`***hit asteroid
delete sprite shotno + 99
alienfire(shotno).used = 0
sprite asteroid, -100, -100, asteroid
asteroid_use = 0
play sound asteroid
else
if target = 1021
`***hit bomb
delete sprite shotno + 99
alienfire(shotno).used = 0
sprite bomb, screenwidth + 100, -100, bomb
bomb_use = 0
play sound bomb
endif
endif
endif
endif
endif
endif
next shotno
endfunction
function alien()
for thealien = 1 to 20
if sprite exist(thealien + 130)
if sprite collision(thealien+130, 0)
target = sprite collision(thealien+130, 0)
if target = ship
delete sprite thealien+130
delete sprite ship
play sound aliencraft1
dec tokill
else
if target = asteroid
delete sprite thealien+130
sprite asteroid, -100, -100, asteroid
asteroid_use = 0
play sound aliencraft1
play sound asteroid
dec tokill
else
if target = 1021
delete sprite thealien+130
sprite bomb, screenwidth + 100, -100, bomb
bomb_use = 0
play sound aliencraft1
dec tokill
play sound bomb
endif
endif
endif
endif
endif
next thealien
endfunction
function bomb()
if bomb_use = 1
if sprite collision(bomb, 0)
target = sprite collision(bomb, 0)
if target = ship
delete sprite ship
sprite bomb, screenwidth + 100, -100, bomb
bomb_use = 0
play sound aliencraft1
play sound bomb
else
if target = asteroid
asteroid_use = 0
bomb_use = 0
sprite bomb, screenwidth + 100, -100, bomb
sprite asteroid, -100, -100, asteroid
play sound asteroid
endif
endif
endif
endif
endfunction
function asteroid()
if asteroid_use = 1
if sprite collision(asteroid, ship) = 1
delete sprite ship
sprite asteroid, -100, -100, asteroid
asteroid_use = 0
play sound aliencraft1
play sound asteroid
endif
endif
endfunction
LIVE LIFE LOUD LOVE MUSIC
rock, metal, punk, emo, ska, reggae, indie, goth, 70's rock, 80's rock, death metal, poppunk, grunge
***caffine, weed, programming and rock addict***