Rem Project: Space Invaders
Rem Created: 29/02/2004 13:05:51
Rem ***** Main Source File *****
set display mode 640,480,32
sync on
Sync rate 0
hide mouse
playery=420
playerx=320
bulletx=playerx+20
bullety=421
shot=0
Load image "Space Invadersshipsship1.png",4
Load image "Space Invadersbulletsbulletp.png",5
Load image "Space InvadersShieldsbottomleft+right.png",6
Sprite 31,playerx,playery,4
Sprite 32,bulletx,bullety,5
hide sprite 32
dim ginv(10)
dim pinv(10)
dim binv(10)
g_aliney=10
p_alieny=30
b_alieny=60
x=1
load Image "Space Invadersenemysgrnenemy.png",1
for g=1 to 10
sprite g,g*50,g_alieny,1
ginv(g)=g*50
next g
sync
load image "Space Invadersenemyspurpenemy.png",2
for p=1 to 10
sprite p,p*50,p_alieny,2
pinv(p)=p*50
next p
sync
load image "Space Invadersenemysbluenemy.png",3
for b=1 to 10
sprite b,b*50,b_alieny,3
binv(b)=b*50
next b
sync
do
`Enigine
`move left
If keystate(203)=1 and playerx>0
playerx=playerx-5
bulletx=bulletx-5
Sprite 31,playerx,playery,4
Endif
`move right
If keystate(205)=1 and playerx<591
playerx=playerx+5
bulletx=bulletx+5
Sprite 31,playerx,playery,4
Endif
If keystate(57)=1 and shot=0
show sprite 32
shot=1
Endif
If shot=1
bulletx=playerx+20
bullety=bullety-15
Sprite 32,sprite x(32),bullety,5
Endif
If bullety<4
hide sprite 32
bullety=421
bulletx=playerx+20
shot=0
Endif
If shot=0
bulletx=playerx+20
sprite 32,bulletx,bullety,5
Endif
`Shields
`Shield1 (left)
Sprite 33,105,350,6
`Shield2 (middle)
Sprite 37,305,350,6
`Shield3 (right)
Sprite 41,505,350,6
`aliens
for g=1 to 10
if ginv(g)>=600 then ginv(g)=600
if ginv(g)=600
x=x*-1
g_alieny=g_alieny+15
endif
if ginv(g)<=10 then ginv(g)=10
if ginv(g)=10
x=x*-1
g_alieny=g_alieny+15
endif
ginv(g)=ginv(g)+x
sprite g,ginv(g),g_alieny,1
next g
sync
for p=1 to 10
if pinv(p)>=600 then pinv(p)=600
if pinv(p)=600
x=x*-1
p_alieny=p_alieny+15
endif
if pinv(p)<=10 then pinv(p)=10
if pinv(p)=10
x=x*-1
p_alieny=p_alieny+15
endif
pinv(p)=pinv(p)+x
sprite p,pinv(p),p_alieny,2
next p
sync
for b=1 to 10
if binv(b)>=600 then binv(b)=600
if binv(b)=600
x=x*-1
b_alieny=b_alieny+15
endif
if binv(b)<=10 then binv(b)=10
if binv(b)=10
x=x*-1
b_alieny=b_alieny+15
endif
binv(b)=binv(b)+x
sprite b,binv(b),b_alieny,3
next b
sync
for alien_hit = 1 to 30
alien_hit = Sprite Collision(32,0)
if alien_hit > 0 then delete sprite alien_hit
next alien_hit
sync
loop
Right there are a few problems with this. The first is that when you load the game it freezes and just displays the shields and the blue aliens. The second is that if you delete the collison part of the program and just leave it as that then the aliens are constantly flashing and when they get to the right side of the screen they just carry on going down. We'd be grateful for any help possible.
Thanks,
Code Monkey Studios (Michael Eddie, Gamemaker Jason and Proshooter)
Intel Celron 2.6ghz, 256 MB Ram, 80gb HD,D DVD Rom, CD Rewriter,17" Flat pannel Monitior and DB Pro