navidnabijou
Programmer
Code:
`Set up
constant1 = 2
hide mouse
randomize timer()
`Loading bitmaps and getting images
load bitmap "airplanesprite.bmp", 0
get image 1,0,0,69,71
load bitmap "alienshipsprite.bmp", 0
get image 2,0,0,53,36
load bitmap "bullet.bmp", 0
get image 3,0,0,12,12
cls
`Declare variables [TO DO]
dim spritenum(constant1)
for n = 1 to constant1
spritenum(n)=n+2
next n
spriteplace = 1
shipx = 0
shipy = 0
alientime = 0
alienships = 0
counter = 1
`Start the game
cls
print "Press any key to begin."
wait key
cls
sprite 1,500,240,1
`Game loop
do
`Creating a new alien ship
if alientime = constant1
k=spritenum(spriteplace)
wait key
sprite k,0,rnd(480),2
rotate sprite spritenum(spriteplace), 270
alienships = alienships + 1
spriteplace = spriteplace + 1
wait 500
endif
wait key
`Moving all alien ships
if alienships > 0
for n = 0 to alienships
move sprite spritenum(counter), 10
counter = counter + 1
next n
endif
`Sorting out variables
counter = 1
shipx = sprite x(1)
shipy = sprite y(1)
if alientime >= constant1 then alientime = 0
alientime = alientime + 1
`Shooting
if spacekey() = 1
sprite 2,shipx,shipy,3
rotate sprite 2, 90
move sprite 2, 15
endif
loop
wait key
end
[CODE/]
-----------------------------------------------------------
This is my unfinished game. The problem is, when i go to move all alien ships, and command it to use index 1 in the spritenum array, it tells me that the sprite does not exsist.
Copy it into DBPRO yourself if you want.
Please help!!!