============================================================
UPDATE 9/11/04
Please take a look at the new thread
http://forum.thegamecreators.com/?m=forum_view&t=38965&b=7
=============================================================
Changed Sprite #s so you can add up to 40 waves instead of 3.
Hi,
I made a 2d Shoot Em' Up Game a while back and decided to turn it into a game engine. The Code is really basic and easy to read and
with all my comments I hope anyone with basic programming skills can make a simple shooter game.
Heres a Picture of a Game I made with my engine
` This is a 2d Shoot Em Up engine by Stephen Sokolowski
` Use this as a Basis to make your own Shoot em up games
` To Start your Game, Enter the Name of it In the Title Screen
sync on
sync rate 40
hide mouse
`Title Screen
hide mouse
set text font "times new roman"
set text size 20
center text 320,0,"Enter Game Title Here"
set text size 20
`Please keep the following line in your game!!
center text 320,80, "Made By: 2d Shoot Em Up Engine"
set text size 20
center text 320,125, "Enter Game Description"
center text 320,145, "Add more to Game Description if needed"
set text size 20
center text 320,190,"CONTROLS:"
set text size 20
center text 320,230, "Space Bar : Fires guns"
center text 320,260, "UpKey : Reloads guns"
center text 320,290, "Leftkey : Strafes player left"
center text 320,320, "Rightkey : Strafes player right"
set text size 20
center text 320,390, "PRESS ANY KEY TO CONTINUE"
wait key
cls
RANDOMIZE TIMER()
`Load your Images in the order below!!!!
`--------------------------------------------------
`--------------------------------------------------
`NOTE: IF YOU DO NOT LOAD IMAGES AS SAID BELOW
`YOUR GAME WILL NOT WORK!!!!!!!
`--------------------------------------------------
`--------------------------------------------------
`Load Player Image as Image #1
load image ".bmp",1
`Load Player Life Image as Image #2
load image ".bmp",2
`Load Player Bullet as Image #3
load image ".bmp",3
`Load Background Image as Image #4
load image ".bmp",4
`--------------------------
`NOTE THERE IS NOT IMAGE 5
`SKIP TO IMAGE #6
`--------------------------
`Load Your Shield as Image #6
`"Shield" is what is used to protect the Player Character
`Example is say a SandBag
load image ".bmp",6
`Load Ammo Image as Image #7
load image ".bmp",7
`Load Boss Enemy as Image #8
load image ".bmp",8
`Load Boss Bullet as Image #9
load image ".bmp",9
`Load Enemies as Image #10
load image ".bmp",10
`Load Enemy Bullets as Image #11
load image ".bmp",11
`-------------------------------------------------------------------
`Do not change the numbers just put your own sounds in that resemble
`The type of sound that is needed
`-------------------------------------------------------------------
`Load a Sound for the Players Guns
load sound ".wav",1
`Load a Sound to Reload Players Guns
load sound ".wav",2
`Load a Sound to make a squish or injure noise for enemies
load sound ".wav",3
`Load a Sound to make a injured noise for Enemies
load sound ".wav",4
`Load a Sound that Resembles impact or a Hit
load sound ".wav",5
`Load your music
load music ".mid",1
play music 1
`This Will Paste your Background image to the screen
`Make your Background image 640, 480
paste image 4, 20,40
`Change These varibles so Your Bullet sprite comes out of
`Your Player sprites Guns
`If you do not change these your bullet make come out of
`Your Images body or arm
BulletOutOfGunX = 32
BulletOutOfGunY = 418
`Change These Varibles so your BossBullet sprite come outs
`of your Boss's gun
`If you do not change these your bullet make come out of
`Your Images body or arm
BossBulletOutOfGunX = 45
BossBulletOutOfGunY = 45
`Change These Varibles so your bullet sprite comes out of
`Your Enemy Sprites Guns
`If you do not change these your bullet make come out of
`Your Images body or arm
EnemyBulletOutOfGunX = 25
EnemyBulletOutofGunY = 55
`NOTE CHANGE THE FOLLOWING CODE IN BETWEEN THE = SIGNS IF YOU WOULD LIKE
`===============================================
`Controls the Speed for the Players Bullet
`Change value if you want
BulletSpeed = 10
`The Amount of Ammo Clips
Ammo = 3
`Boss Stats
`Change Values if you like
BossLife = 6
BossBulletSpeed = 10
BossSpeed = 3
`Speed the first wave of enemies move at
EnemySpeed = 2
`Speed the first wave of enemies Bullets will move at
EnemyBulletSpeed = 7
`Also See LINES 610, 611
`And See LINES 679, 680
`Position the Shield/Barrier
ShieldX = 280
ShieldY = 350
`================================================
`Coordinates for player
PlayerX = 300
PlayerY = 400
`Lifes
PlayerLifes = 3
lifes = 3
Bullets = 76
`Comes Out of Gun (Adjust to match your Player Sprites Gun)
BulletX = PlayerX + BulletOutOfGunX
BulletY = BulletOutOfGunY
MoveBoss = rnd(1)
BossX = rnd(500)
BossY = rnd(200)
BossBulletX = BossX + BossBulletOutOfGunX
BossBulletY = BossY + BossBulletOutOfGunY
`Position our first Wave of Enemys
`Create an Array for the Enemies X coordinates
dim EnemyX(15)
EnemyX(1) = rnd(500)
EnemyX(2) = rnd(500)
EnemyX(3) = rnd(500)
EnemyX(4) = rnd(500)
EnemyX(5) = rnd(500)
`This Will be for our second wave of Enemies
EnemyX(6) = rnd(500)
EnemyX(7) = rnd(500)
EnemyX(8) = rnd(500)
EnemyX(9) = rnd(500)
EnemyX(10) = rnd(500)
`This Will be for our Third Wave of Enemies
EnemyX(11) = rnd(500)
EnemyX(12) = rnd(500)
EnemyX(13) = rnd(500)
EnemyX(14) = rnd(500)
EnemyX(15) = rnd(500)
`Create an Array for the Enemies Y coordinates
dim EnemyY(15)
EnemyY(1) = rnd(200)
EnemyY(2) = rnd(200)
EnemyY(3) = rnd(200)
EnemyY(4) = rnd(200)
EnemyY(5) = rnd(200)
`This Will be for our second wave of Enemies
EnemyY(6) = rnd(200)
EnemyY(7) = rnd(200)
EnemyY(8) = rnd(200)
EnemyY(9) = rnd(200)
EnemyY(10) = rnd(200)
`This Will be for our Third wave of Enemies
EnemyY(11) = rnd(200)
EnemyY(12) = rnd(200)
EnemyY(13) = rnd(200)
EnemyY(14) = rnd(200)
EnemyY(15) = rnd(200)
`Move Enemy sprite
dim MoveEnemy(15)
MoveEnemy(1) = rnd(1)
MoveEnemy(2) = rnd(1)
MoveEnemy(3) = rnd(1)
MoveEnemy(4) = rnd(1)
MoveEnemy(5) = rnd(1)
`This Will be for our second wave of Enemies
MoveEnemy(6) = rnd(1)
MoveEnemy(7) = rnd(1)
MoveEnemy(8) = rnd(1)
MoveEnemy(9) = rnd(1)
MoveEnemy(10) = rnd(1)
`This Will be for our Third wave of Enemies
MoveEnemy(11) = rnd(1)
MoveEnemy(12) = rnd(1)
MoveEnemy(13) = rnd(1)
MoveEnemy(14) = rnd(1)
MoveEnemy(15) = rnd(1)
`Position Bullet to come out of Enemy or Enemy Gun.
`You will have to fix these variables so the Bullets
`Come out of your enemy sprites properly.
Dim EnemyBulletX(15)
EnemyBulletX(1) = EnemyX(1) + EnemyBulletOutOfGunX
EnemyBulletX(2) = EnemyX(2) + EnemyBulletOutOfGunX
EnemyBulletX(3) = EnemyX(3) + EnemyBulletOutOfGunX
EnemyBulletX(4) = EnemyX(4) + EnemyBulletOutOfGunX
EnemyBulletX(5) = EnemyX(5) + EnemyBulletOutOfGunX
`This Will be for our second wave of Enemies
EnemyBulletX(6) = EnemyX(6) + EnemyBulletOutOfGunX
EnemyBulletX(7) = EnemyX(7) + EnemyBulletOutOfGunX
EnemyBulletX(8) = EnemyX(8) + EnemyBulletOutOfGunX
EnemyBulletX(9) = EnemyX(9) + EnemyBulletOutOfGunX
EnemyBulletX(10) = EnemyX(10) + EnemyBulletOutOfGunX
`This Will be for our Third wave of Enemies
EnemyBulletX(11) = EnemyX(11) + EnemyBulletOutOfGunX
EnemyBulletX(12) = EnemyX(12) + EnemyBulletOutOfGunX
EnemyBulletX(13) = EnemyX(13) + EnemyBulletOutOfGunX
EnemyBulletX(14) = EnemyX(14) + EnemyBulletOutOfGunX
EnemyBulletX(15) = EnemyX(15) + EnemyBulletOutOfGunX
Dim EnemyBulletY(15)
EnemyBulletY(1) = EnemyY(1) + EnemyBulletOutOfGunY
EnemyBulletY(2) = EnemyY(2) + EnemyBulletOutOfGunY
EnemyBulletY(3) = EnemyY(3) + EnemyBulletOutOfGunY
EnemyBulletY(4) = EnemyY(4) + EnemyBulletOutOfGunY
EnemyBulletY(5) = EnemyY(5) + EnemyBulletOutOfGunY
`This Will be for our second wave of Enemies
EnemyBulletY(6) = EnemyY(6) + EnemyBulletOutOfGunY
EnemyBulletY(7) = EnemyY(7) + EnemyBulletOutOfGunY
EnemyBulletY(8) = EnemyY(8) + EnemyBulletOutOfGunY
EnemyBulletY(9) = EnemyY(9) + EnemyBulletOutOfGunY
EnemyBulletY(10) = EnemyY(10) + EnemyBulletOutOfGunY
`This Will be for our Third wave of Enemies
EnemyBulletY(11) = EnemyY(11) + EnemyBulletOutOfGunY
EnemyBulletY(12) = EnemyY(12) + EnemyBulletOutOfGunY
EnemyBulletY(13) = EnemyY(13) + EnemyBulletOutOfGunY
EnemyBulletY(14) = EnemyY(14) + EnemyBulletOutOfGunY
EnemyBulletY(15) = EnemyY(15) + EnemyBulletOutOfGunY
`These next 6 Lines position your Player Life Icons
`===================================================
life3x = 480
life3y = 20
life2x = 500
life2y = 20
life1x = 520
life1y = 20
`===================================================
`This Positions the Players Ammo in the top center of the screen
`You shouldnt need to change the values here
dim PosBulletX(20)
PosBulletX(1) = 220
PosBulletX(2) = 230
PosBulletX(3) = 240
PosBulletX(4) = 250
PosBulletX(5) = 260
PosBulletX(6) = 270
PosBulletX(7) = 280
PosBulletX(8) = 290
PosBulletX(9) = 300
PosBulletX(10) = 310
PosBulletX(11) = 320
PosBulletX(12) = 330
PosBulletX(13) = 340
PosBulletX(14) = 350
PosBulletX(15) = 360
PosBulletX(16) = 370
PosBulletX(17) = 380
PosBulletX(18) = 390
PosBulletX(19) = 400
PosBulletX(20) = 410
dim PosBulletY(20)
PosBulletY(1) = 25
PosBulletY(2) = 25
PosBulletY(3) = 25
PosBulletY(4) = 25
PosBulletY(5) = 25
PosBulletY(6) = 25
PosBulletY(7) = 25
PosBulletY(8) = 25
PosBulletY(9) = 25
PosBulletY(10) = 25
PosBulletY(11) = 25
PosBulletY(12) = 25
PosBulletY(13) = 25
PosBulletY(14) = 25
PosBulletY(15) = 25
PosBulletY(16) = 25
PosBulletY(17) = 25
PosBulletY(18) = 25
PosBulletY(19) = 25
PosBulletY(20) = 25
set text opaque
set text size 20
`Enter Your Game Title Here
`---------------------------------
text 25,1, "Enter Game Title Here"
`---------------------------------
text 480,1, "Player Lifes: "
text 280,1, "Ammo Clips: 3"
`-----------------------------------------------------
`-----------------M_A_I_N--L_O_O_P--------------------
`-----------------------------------------------------
do
`The following lines below implement the Controls stated on the
`Title Screen
`Moves the Player to the left
if leftkey() = 1 then playerX = playerX - 3
`Moves the Player to the Right
if rightkey() = 1 then playerX = playerX + 3
`This code is stating that if the Bullets variable is less then 57 and the upkey is pressed
`And The Player Has Ammo left then Reload the Guns and restore the Bullet sprites under Ammo Clips
if bullets < 56 and upkey() = 1 and ammo > 0 then ReloadBullets = 1
`If Spacekey is pressed then fire bullets
if spacekey() = 1 and bullets >= 56 then firing = 1
`This fires the Players Bullet
if firing = 1
dec BulletY,BulletSpeed
endif
`If firing = 0 then Make sure that the players Bullet Follows
`The Player as he moves
if firing = 0
BulletX = playerX + BulletOutOfGunX
BulletY = BulletOutOfGunY
endif
`If the Bullet is shot then Delete a Bullet under Ammo clips and
`Play Gun sounds
if bullety <= 390 and BulletY >= 385 then DeleteBullets = 1 : play sound 1
`Fire Boss Bullets
BossBulletY = BossBulletY + BossBulletSpeed
`Move Boss
if MoveBoss = 0 then Inc BossX,BossSpeed
if MoveBoss = 1 then Dec BossX,BossSpeed
`Boss Boundarys
if BossX < 10 then MoveBoss = 0
if BossX > 565 then MoveBoss = 1
`Boss Bullet Boundarys
if BossBulletY > 500 then BossBulletX = BossX + BossBulletOutOfGunX : BossBulletY = BossY + BossBulletOutofGunY
`The Following Lines of code will fire the Enemies Bullets.
for EnemyFire = 1 to 15
EnemyBulletY(EnemyFire) = EnemyBulletY(EnemyFire) + EnemyBulletSpeed
next EnemyFire
`Move Enemy
for a = 1 to 15
if MoveEnemy(a) = 0 then EnemyX(a) = EnemyX(a) + EnemySpeed
if MoveEnemy(a) = 1 then EnemyX(a) = EnemyX(a) - EnemySpeed
next a
`Player Boundarys
if playerX < 10 then playerX = 11
if playerX > 565 then playerX = 564
`Bullet Boundarys
if BulletY < 50 then firing = 0 : BulletX = playerX + BulletOutOfGunX : BulletY = BulletOutOfGunY
`Enemy Boundarys
for EB = 1 to 15
if EnemyX(EB) < 10 then MoveEnemy(EB) = 0
if EnemyX(EB) > 565 then MoveEnemy(EB) = 1
next EB
`Enemy Bullet Boundarys
for EBB = 1 to 15
if EnemyBulletY(EBB) > 500 then EnemyBulletX(EBB) = EnemyX(EBB) + EnemyBulletOutOfGunX : EnemyBulletY(EBB) = EnemyY(EBB) + EnemyBulletOutOfGunY
next EBB
sprite 3,BulletX,BulletY,3
sprite 1,playerX,playerY,1
sprite 4,ShieldX,ShieldY,6
sprite 101,EnemyX(1),EnemyY(1),10
sprite 102,EnemyX(2),EnemyY(2),10
sprite 103,EnemyX(3),EnemyY(3),10
sprite 104,EnemyX(4),EnemyY(4),10
sprite 105,EnemyX(5),EnemyY(5),10
sprite 301,EnemyBulletX(1),EnemyBulletY(1),11
sprite 302,EnemyBulletX(2),EnemyBulletY(2),11
sprite 303,EnemyBulletX(3),EnemyBulletY(3),11
sprite 304,EnemyBulletX(4),EnemyBulletY(4),11
sprite 305,EnemyBulletX(5),EnemyBulletY(5),11
sprite 5, life3x,life3y,2
sprite 6, life2x,life2y,2
sprite 7, life1x,life1y,2
sprite 56, PosBulletX(1),PosBulletY(1),7
sprite 57, PosBulletX(2),PosBulletY(2),7
sprite 58, PosBulletX(3),PosBulletY(3),7
sprite 59, PosBulletX(4),PosBulletY(4),7
sprite 60, PosBulletX(5),PosBulletY(5),7
sprite 61, PosBulletX(6),PosBulletY(6),7
sprite 62, PosBulletX(7),PosBulletY(7),7
sprite 63, PosBulletX(8),PosBulletY(8),7
sprite 64, PosBulletX(9),PosBulletY(9),7
sprite 65, PosBulletX(10),PosBulletY(10),7
sprite 66, PosBulletX(11),PosBulletY(11),7
sprite 67, PosBulletX(12),PosBulletY(12),7
sprite 68, PosBulletX(13),PosBulletY(13),7
sprite 69, PosBulletX(14),PosBulletY(14),7
sprite 70, PosBulletX(15),PosBulletY(15),7
sprite 71, PosBulletX(16),PosBulletY(16),7
sprite 72, PosBulletX(17),PosBulletY(17),7
sprite 73, PosBulletX(18),PosBulletY(18),7
sprite 74, PosBulletX(19),PosBulletY(19),7
sprite 75, PosBulletX(20),PosBulletY(20),7
`Delete the Bullet sprites under Ammo Clips
if DeleteBullets = 1
bullets = bullets - 1 * 1
if Bullets = 74 then PosBulletX(20) = 680 : PosBulletY(20) = 680
if Bullets = 73 then PosBulletX(19) = 680 : PosBulletY(19) = 680
if Bullets = 72 then PosBulletX(18) = 680 : PosBulletY(18) = 680
if Bullets = 71 then PosBulletX(17) = 680 : PosBulletY(17) = 680
if Bullets = 70 then PosBulletX(16) = 680 : PosBulletY(16) = 680
if Bullets = 69 then PosBulletX(15) = 680 : PosBulletY(15) = 680
if Bullets = 68 then PosBulletX(14) = 680 : PosBulletY(14) = 680
if Bullets = 67 then PosBulletX(13) = 680 : PosBulletY(13) = 680
if Bullets = 66 then PosBulletX(12) = 680 : PosBulletY(12) = 680
if Bullets = 65 then PosBulletX(11) = 680 : PosBulletY(11) = 680
if Bullets = 64 then PosBulletX(10) = 680 : PosBulletY(10) = 680
if Bullets = 63 then PosBulletX(9) = 680 : PosBulletY(9) = 680
if Bullets = 62 then PosBulletX(8) = 680 : PosBulletY(8) = 680
if Bullets = 61 then PosBulletX(7) = 680 : PosBulletY(7) = 680
if Bullets = 60 then PosBulletX(6) = 680 : PosBulletY(6) = 680
if Bullets = 59 then PosBulletX(5) = 680 : PosBulletY(5) = 680
if Bullets = 58 then PosBulletX(4) = 680 : PosBulletY(4) = 680
if Bullets = 57 then PosBulletX(3) = 680 : PosBulletY(3) = 680
if Bullets = 56 then PosBulletX(2) = 680 : PosBulletY(2) = 680
if Bullets = 55 then PosBulletX(1) = 680 : PosBulletY(1) = 680
deletebullets = 0
endif
if ReloadBullets = 1
bullets = 76
PosBulletX(1) = 220
PosBulletX(2) = 230
PosBulletX(3) = 240
PosBulletX(4) = 250
PosBulletX(5) = 260
PosBulletX(6) = 270
PosBulletX(7) = 280
PosBulletX(8) = 290
PosBulletX(9) = 300
PosBulletX(10) = 310
PosBulletX(11) = 320
PosBulletX(12) = 330
PosBulletX(13) = 340
PosBulletX(14) = 350
PosBulletX(15) = 360
PosBulletX(16) = 370
PosBulletX(17) = 380
PosBulletX(18) = 390
PosBulletX(19) = 400
PosBulletX(20) = 410
PosBulletY(1) = 25
PosBulletY(2) = 25
PosBulletY(3) = 25
PosBulletY(4) = 25
PosBulletY(5) = 25
PosBulletY(6) = 25
PosBulletY(7) = 25
PosBulletY(8) = 25
PosBulletY(9) = 25
PosBulletY(10) = 25
PosBulletY(11) = 25
PosBulletY(12) = 25
PosBulletY(13) = 25
PosBulletY(14) = 25
PosBulletY(15) = 25
PosBulletY(16) = 25
PosBulletY(17) = 25
PosBulletY(18) = 25
PosBulletY(19) = 25
PosBulletY(20) = 25
Ammo = Ammo - 1 * 1
text 280,1, "Ammo Clips: " + STR$(Ammo)
play sound 2
ReloadBullets = 0
endif
if sprite hit(3,4) = 1
BulletX = PlayerX + BulletOutOfGunX
BulletY = BulletOutOfGunY
firing = 0
endif
`This code acknowldges the Enemies bullet against sandbag
for C = 301 to 305
if sprite hit(c,4) = 1
play sound 5
delete sprite (c)
d = c - 300
EnemyBulletX(d) = EnemyX(d) + EnemyBulletOutOfGunX
EnemyBulletY(d) = EnemyY(d) + EnemyBulletOutOfGunY
endif
next C
`EnmB = EnemyBullet
for EnmB = 301 to 305
if sprite hit(1,EnmB) = 1
delete sprite 1
play sound 3
PlayerX = 300
PlayerY = 400
lifes = lifes - 1 * 1
sleep 1000
endif
next EnmB
if lifes = 2 then delete sprite 7 : life1x = 680 : life1y = 680
if lifes = 1 then delete sprite 6 : life2x = 680 : life2y = 680
if lifes = 0 then delete sprite 5 : life3x = 680 : life3y = 680 : center text 320,260, "Game Over!" : sleep 2000 : end
`If players Bullet Hits
for PB = 101 to 105
if sprite hit(PB,3) = 1
SecondWave = SecondWave + 1
delete sprite PB
play sound 4
firing = 0
BulletX = PlayerX + BulletOutOfGunX
BulletY = PlayerY
KillEnemy = PB - 100
KillBullet = PB + 200
delete sprite PB
delete sprite KillBullet
EnemyBulletX(KillEnemy) = 2000
EnemyBulletY(KillEnemy) = 2000
EnemyX(KillEnemy) = 2000
EnemyY(KillEnemy) = 2000
endif
next PB
`Second Wave of Enemies
if SecondWave = 5
sprite 106,EnemyX(6),EnemyY(6),10
sprite 107,EnemyX(7),EnemyY(7),10
sprite 108,EnemyX(8),EnemyY(8),10
sprite 109,EnemyX(9),EnemyY(9),10
sprite 110,EnemyX(10),EnemyY(10),10
sprite 306,EnemyBulletX(6),EnemyBulletY(6),11
sprite 307,EnemyBulletX(7),EnemyBulletY(7),11
sprite 308,EnemyBulletX(8),EnemyBulletY(8),11
sprite 309,EnemyBulletX(9),EnemyBulletY(9),11
sprite 310,EnemyBulletX(10),EnemyBulletY(10),11
EnemyBulletSpeed = 8
EnemySpeed = 3
`If players Bullet Hits
for PB2 = 106 to 110
if sprite hit(PB2,3) = 1
delete sprite PB2
play sound 4
firing = 0
BulletX = PlayerX + BulletOutOfGunX
BulletY = PlayerY
KillEnemy2 = PB2 - 100
KillBullet2 = PB2 + 200
delete sprite PB2
delete sprite KillBullet2
EnemyBulletX(KillEnemy2) = 2000
EnemyBulletY(KillEnemy2) = 2000
EnemyX(KillEnemy2) = 2000
EnemyY(KillEnemy2) = 2000
ThirdWave = ThirdWave + 1
endif
next PB2
`Acknowledge Enemy Bullet against Sand bag
for C2 = 306 to 310
if sprite hit(C2,4) = 1
play sound 5
delete sprite (C2)
D2 = C2 - 300
EnemyBulletX(d2) = EnemyX(d2) + EnemyBulletOutOfGunX
EnemyBulletY(d2) = EnemyY(d2) + EnemyBulletOutOfGunY
endif
next C2
`Enemy Bullet hits player
for EnmB2 = 306 to 310
if sprite hit(1,EnmB2) = 1
delete sprite 1
play sound 3
PlayerX = 300
PlayerY = 400
lifes = lifes - 1 * 1
sleep 1000
endif
next EnmB2
if lifes = 2 then delete sprite 7 : life1x = 680 : life1y = 680
if lifes = 1 then delete sprite 6 : life2x = 680 : life2y = 680
if lifes = 0 then delete sprite 5 : life3x = 680 : life3y = 680 : center text 320,260, "Game Over!" : sleep 2000 : end
`End of SecondWave
endif
` Third Wave
if ThirdWave = 5
sprite 111,EnemyX(11),EnemyY(11),10
sprite 112,EnemyX(12),EnemyY(12),10
sprite 113,EnemyX(13),EnemyY(13),10
sprite 114,EnemyX(14),EnemyY(14),10
sprite 115,EnemyX(15),EnemyY(15),10
sprite 311,EnemyBulletX(11),EnemyBulletY(11),11
sprite 312,EnemyBulletX(12),EnemyBulletY(12),11
sprite 313,EnemyBulletX(13),EnemyBulletY(13),11
sprite 314,EnemyBulletX(14),EnemyBulletY(14),11
sprite 315,EnemyBulletX(15),EnemyBulletY(15),11
EnemyBulletSpeed = 12
EnemySpeed = 4
`If players Bullet Hits
for PB3 = 111 to 115
if sprite hit(PB3,3) = 1
delete sprite PB3
play sound 4
firing = 0
BulletX = PlayerX + BulletOutOfGunX
BulletY = PlayerY
KillEnemy3 = PB3 - 100
KillBullet3 = PB3 + 200
delete sprite PB3
delete sprite KillBullet3
EnemyBulletX(KillEnemy3) = 2000
EnemyBulletY(KillEnemy3) = 2000
EnemyX(KillEnemy3) = 2000
EnemyY(KillEnemy3) = 2000
BossBattle = BossBattle + 1
endif
next PB3
`Acknowledge Enemy Bullet against Sand bag
for C3 = 311 to 315
if sprite hit(C3,4) = 1
play sound 5
delete sprite (C3)
D3 = C3 - 300
EnemyBulletX(d3) = EnemyX(d3) + EnemyBulletOutOfGunX
EnemyBulletY(d3) = EnemyY(d3) + EnemyBulletOutOfGunY
endif
next C3
`Enemy Bullet hits player
for EnmB3 = 311 to 315
if sprite hit(1,EnmB3) = 1
delete sprite 1
play sound 3
PlayerX = 300
PlayerY = 400
lifes = lifes - 1 * 1
sleep 1000
endif
next EnmB3
if lifes = 2 then delete sprite 7 : life1x = 680 : life1y = 680
if lifes = 1 then delete sprite 6 : life2x = 680 : life2y = 680
if lifes = 0 then delete sprite 5 : life3x = 680 : life3y = 680 : center text 320,260, "Game Over!" : sleep 2000 : end
`End Third Wave
endif
if BossBattle = 5
sprite 8,BossX,BossY,8
sprite 9,BossBulletX,BossBulletY,9
if sprite hit(8,3) = 1
play sound 4
firing = 0
BulletX = PlayerX + BulletOutOfGunX
BulletY = PlayerY + BulletOutOfGunY
BossLife = BossLife - 1 * 1
MoveBoss = 0
endif
if sprite hit(1,9) = 1
delete sprite 1
play sound 3
PlayerX = 300
PlayerY = 400
lifes = lifes - 1 * 1
sleep 1000
endif
if lifes = 2 then delete sprite 7 : life1x = 680 : life1y = 680
if lifes = 1 then delete sprite 6 : life2x = 680 : life2y = 680
if lifes = 0 then delete sprite 5 : life3x = 680 : life3y = 680 : center text 320,260, "Game Over!" : sleep 2000 : end
if BossLife < 1
delete sprite 110
delete sprite 111
BossX = 2000
BossY = 2000
BossBulletX = 2000
BossBulletY = 2000
`Enter The Following Information that Applies to your game
`-----------------------------------------------------------------
text 200,260, "You Have Defeated Boss name and His Army/Minions!!"
`-----------------------------------------------------------------
sleep 2000
end
endif
if sprite hit(9,4) = 1
play sound 5
FireBullet = 1
endif
if FireBullet = 1
delete sprite 9
BossBulletX = BossX + BossBulletOutOfGunX
BossBulletY = BossY + BossBulletOutOfGunY
FireBullet = 0
endif
`End BossBattle
endif
sync
loop
This is mainly for people who need help starting there first game. Just Make your own images and Load them in the correct spots with the correct image # (Same goes for the sounds). I will include my images and sounds to my game I made with this engine in the codebase soon.
Plz leave me some feedback of what you think so far.
http://www.angelfire.com/games5/db_games/