The Lone Ninja
Written in DBpro: 500 lines or “20”compressed, 190kb media
This is a Nintendo,
Zelda style dungeon crawler with a cinematic storyline.
The storyline ate most of the (game engine) code but I still think its fun to watch and play.
Took me about 3-4 days part time to make the bit art, and program. Programs used Paint and DBpro.
I had much bigger plans for it, but hey, 20 lines is 20 lines. Hope you enjoy it.
Ps. Might want to turn your volume down to half when starting the game.
Spoiler Alert: Basic storyline
There’s two groups of ninjas the white and the black “how original”. The Black Ninja’s are the scourge of the earth and wreak havoc whenever and wherever they can. The White Ninjas are good and their sole duty is to protect the royal family.
The Princess is kidnapped buy the Black Ninjas while the White Ninja is sleeping on the job. She is taken deep underground to the Dark Ninja Master. It is your job as the White Ninja to travel into the dark catacombs and rescue the Princess fighting enemies along the way.
How to play:
Find chests, don’t get to lost, kill ninjas, avoid Chinese stars, and find the key
(W, A, S, D,) Movement
(Space) Sword.
(E) To advance the storyline and interact with objects.
(R) To buy potions with gold.
(Q) To use potions
If you die, “god forbid”, and you wish to get right back to action skipping the cinematics, just put
“
Sceneplay=2 “above the loop and a, “
If music playing (3) =1: stopmusic 3: endif,” below line 256.
Known bugs:
1. Occasionally there is an empty chest. But don’t worry because the key will always appear.
2. On occasion movement was still limited by invisible enemy. Pretty sure I fixed it though.
3. Very rare occasion enemy stops shooting
4. Some people can’t figure out how to get through the door. Try centering the character.
Changing it up: Hard mode
If you would like to change the difficulty level the game speed is limited only by the sync rate.
Line 445 and 441 can be changed from 2.8 to any positive integer to increase enemy attack speed and frequency. Health and actual damage control are more difficult to alter. Frequency of the ninjas appearance can be increase by changing line 430 by adding
"text= 0" and or ”textt= 3” to
"If textt=2 or textt=1".
Its set rnd(3) so 0,1,2,3 1&2 would be 50% of the time, 0,1,2 would be 75% & 0,1,2,3, would be 100% of the time.
Side notes: More dungeon levels can very easily be added with almost changing nothing in the code, the maps are not limited to a specific size or quality and can be easily changed and or added as long as the dimensions are a multiple or dividend of the original bitmap. For example if the map is
400pixles and sprite size=600 then keep them in proportion “200px size=1200”,” 800px size=300”, ect.
Also changing the character is cake as long as the collision sprite size is maintained
If you would like the original unaltered code neatly with comments and functions let me know, I quit commenting about half way through and compacted functions to save space.
Game code
set display mode 800,600,32
set window off
sync rate 30
hide mouse
set dir "media\"
color backdrop rgb(0,0,0)
load music "fearless.mid",2
load music "openscene.mid",3
load music "enemy.mid",4
load music "element.mid",5
load music "fight.mid",6
load sound "steps.wav",1
load music "sword.mp3",7
load bitmap "dungeon.png",3
load bitmap "test.bmp",2
get image 2,0,38,85,91,1
get image 3,103,148,120,178,1
get image 4,123,148,140,178,1
get image 5,87,93,172,146,1
get image 6,36,148,61,180,1
get image 7,64,148,102,183
get image 8,87,38,172,91,1
get image 9,145,148,162,163,1
get image 15,9,94,21,104,1
get image 21,10,106,20,117,1
get image 24,6,153,27,166,1
get image 25,6,168,30,181,1
get image 26,1,137,8,152,1
get image 27,149,161,181,181,1
get image 28,9,127,14,137,1
sprite 9,0,0,9
set sprite priority 9,5
scale sprite 9,200
hide sprite 9
ink rgb(255,255,255),0
set current bitmap 0
create animated sprite 1,"test.bmp",32,5,1
create animated sprite 13,"test.bmp",32,5,1
hide sprite 13
set sprite priority 13,4
scale sprite 1,400
sprite 1,10,10,1
set sprite priority 1,3
hide sprite 1
set sound volume 1,90
set sound speed 1,22000
ink rgb (255,255,255),0
health=20
enemyhealth=20
cloudsize=11
do
draw sprites first
if sceneplay=0
play music 3
sprite 5,150,150,5
scale sprite 5,600
if textt=0
text 150,470,"[Master]:I've heard roumors that the Dark Ninjas are plotting"
text 150,490,"against the royal family."
text 150,510,"Press (E) to continue."
if scancode()=18
wait 1000
textt=1
endif endif
if textt=1
text 150,470,"[Master]: As a white ninja you have a sworn duty to protect the"
text 150,490,"royal family. Be swift my son and stay safe."
text 150,510,"Press (E) to continue."
if scancode()=18
wait 1000
textt=2
endif endif
if textt=2
text 150,470,"[White ninja]: Yes Master."
text 150,490,"Press (E) to continue."
if scancode()=18
stop music 3
delete sprite 5
play music 2
sprite 2,150,150,2
scale sprite 2,600
wait 10000
sceneplay=1
endif endif endif
if sceneplay=1
if a >=400
if sound playing(1)=1
stop sound 1
endif
sprite 3,380,400-(a/2),4
if sprite exist(6)=0
text 150,680-(a/2),"[Voice]: Shhh! Here comes the princess. Isn't she just beautiful!"
text 150,700-(a/2),"Press (E) to continue."
endif
if scancode()=18 and sprite exist(6)=0
textt=3
endif endif
if a<400
sprite 3,380,400-(a/2),3
text 150,680-(a/2),"[Voice]: Shhh! Here comes the princess. Isn't she just beautiful!"
if sound playing(1)=0
play sound 1
loop sound 1
endif
scale sprite 3,400
inc a,1
endif
if textt=3 and c <300
for b =1 to 30
sprite 6,220+(c/4),200,6
scale sprite 6,c*1.5
rotate sprite 6,c+70
inc c,10
wait 1
next
if music playing(2)=1
stop music 2
play music 4
loop music 4
endif endif
if textt=3 and c=300
text 150,470,"[Princess]: HELP! HELP!"
text 150,490,"Press (E) to continue."
if scancode()=18
wait 2000
textt=4
endif endif
if textt=4
ink RGB(255,255,255),0
text 150,470,"[Dark Ninja]: Quiet!!... I'm taking you to my master."
text 150,510,"Press (E) to continue."
ink RGB(255,192,0),0
text 150,490, """The ninja vanishes with the princess into a cloud of smoke"""
if scancode()=18
textt=5
if music playing(4)=0
play music 4
endif endif endif
if textt=5
sprite 7,370,250,7
scale sprite 7,800+cloudsize
offset sprite 7,18,16
hide sprite 3
hide sprite 6
spriteAngle = wrapvalue(spriteAngle + 4)
rotate sprite 7, spriteAngle
if spriteangle>350 or 100 or 200
dec cloudsize,2
endif
if sprite visible(7)=1 and cloudsize<-700
textt=6
delete sprite 7
endif endif
if textt=6
ink RGB(255,255,255),0
text 150,470,"[Voice:]Oh no! The Princess. She, she, she's been kidnapped!!"
text 150,490,"Press (E) to continue."
if scancode()=18
cloudsize=0
textt=7
endif endif
if textt=7
if cloudsize<230
show sprite 1
sprite 1,380,500-cloudsize,1
play sprite 1,1,4,100
ink RGB(0,0,0),0
box 350,467,600,700
inc cloudsize,2
endif
if cloudsize>=230
textt=8
endif endif
If textt=8
ink RGB(255,255,255),0
text 150,470,"[White Ninja:]No! I'm to late! I have failed to protect the princess."
text 150,490,"I must travel into the catacombs and face the Dark Ninjas. I will..."
text 150,510,"surly die, but I must redeem myself. I will not fail again!"
text 150,530,"Press (E) to continue."
If scancode()=18
wait 100
textt=9
endif endif
if textt=9
if cloudsize >2
set sprite alpha 1,cloudsize
set sprite alpha 2,cloudsize
dec cloudsize,2
endif
if cloudsize <=2
delete sprite 2
c=0
set sprite frame 1,13
textt=10
endif endif
if textt=10
sprite 8,150,150,8
scale sprite 8,600
set sprite alpha 1,255
sprite 1,130+c,300,1
play sprite 1,13,16,125
inc c,1
if c >190
c=0
textt=11
endif endif
if textt=11
play sprite 1,1,4,100
sprite 1,320,300+(c/6),1
scale sprite 1,400+(c*2)
set sprite alpha 1,255+c*3
dec c,1
endif
if (c*3) < -250
textt=12
c=255
endif
if textt=12 and c >2
set sprite alpha 8,c
dec c,2
if music playing(4)=1
stop music 4
endif endif
if textt=12 and c <=2
set sprite alpha 1,255
sceneplay=2
endif endif
if sceneplay=2
for z= 1 to 5
sprite 15+z,505+x,490,15
set sprite priority 15+z,12
scale sprite 15+z,200
inc x,30
next
set current bitmap 3
get image 10,0,0,261,162,1
get image 11,0,219,135,325,1
get image 40,97,207,107,218,1
set current bitmap 0
sprite 10,150,150,10
sprite 11,0,0,11
scale sprite 10,600
scale sprite 11,600
set sprite priority 11,3
scale sprite 1,200
scale sprite 13,200
show sprite 1
a=0
c=0
spriteangle=1
cloudsize=1
sceneplay=3
endif
if sceneplay=3
sprite 24,150+sprite x(10),200+sprite y(10),24
sprite 25,150+sprite x(10),200+sprite y(10),25
sprite 26,150+sprite x(10)+1000,200+sprite y(10),24
sprite 27,150+sprite x(10)+1000,200+sprite y(10),25
sprite 28,150+sprite x(10),500+sprite y(10),24
sprite 29,150+sprite x(10),500+sprite y(10),25
sprite 30,150+sprite x(10)+500,500+sprite y(10),24
sprite 31,150+sprite x(10)+500,500+sprite y(10),25
sprite 32,150+sprite x(10)+1000,500+sprite y(10),24
sprite 33,150+sprite x(10)+1000,500+sprite y(10),25
sprite 34,150+sprite x(10),800+sprite y(10),24
sprite 35,150+sprite x(10),800+sprite y(10),25
sprite 36,150+sprite x(10)+500,800+sprite y(10),24
sprite 37,150+sprite x(10)+500,800+sprite y(10),25
sprite 38,150+sprite x(10)+1000,800+sprite y(10),24
sprite 39,150+sprite x(10)+1000,800+sprite y(10),25
if once=0
for hideodd= 25 to 39
hide sprite hideodd
inc hideodd,1
next
once=1
endif
for hitme =24 to 39
if sprite collision(1,hitme)=1 and sprite image(hitme)=24 and sprite visible(hitme)=1 and sprite visible(13)=0
if scancode()=18
rndchoice=rnd(2)
inc keycall,1
show sprite hitme+1
hide sprite hitme
wait 600
if rndchoice=1 and keycall<7
sprite 41,sprite x(hitme)+20,sprite y(hitme)-10,26
set sprite priority 41,2
scale sprite 41,200
endif
if rndchoice=2 or rndchoice=0 and keycall<7
sprite 42,sprite x(hitme)+20,sprite y(hitme)-10,27
set sprite priority 42,2
scale sprite 42,100
endif
if keycall=8
sprite 43,sprite x(hitme)+20,sprite y(hitme)-10,28
set sprite priority 43,2
scale sprite 43,200
endif endif endif
inc hitme,1
next
for rndsprite= 24 to 39
set sprite priority rndsprite,1
scale sprite rndsprite,200
next
if scancode()=16 and potions>=1 and health <20
dec potions,1
inc health,1
show sprite health
endif
if enemyhealth < 0
textt=1
hide sprite 13
enemyhealth=20
endif
if sprite exist(21)=1
if health >15 and sprite visible(21)=1
if sprite collision(21,1)=1
hide sprite 21
hide sprite health
dec health,1
endif endif endif
if sprite visible(13)=0 and music playing(5)=0
stop music 6
play music 5
loop music 5
endif
if sprite visible(13)=1 and music playing(6)=0
stop music 5
play music 6
loop music 6
endif
text 150,474,"Buy pot(R)$100 "+"coins "+str$(coins)+" Pot's(Q)"+str$(potions)+" keys"+str$(keys)+" Health "+str$((health-15)*20)
if c=0
set sprite frame 1,1
endif
if sprite x(1) <576
if scancode()=32
if cloudsize<3 and sprite x(1)>=574 and sprite y(1)>=270 and sprite y(1)<=285
textt=rnd(3)
sprite 10,150+(-522*cloudsize),sprite y(10),10
inc cloudsize,1
dec c,380
endif
if sprite frame(1)<13
set sprite frame 1,13
endif
play sprite 1,13,16,100
inc c,2
endif endif
if sprite x(1)>205
if scancode()=30
if cloudsize>1 and sprite x(1)<=206 and sprite y(1)>=270 and sprite y(1)<=285
textt=rnd(3)
sprite 10,150+(-522*(cloudsize-2)),sprite y(10),10
dec cloudsize,1
inc c,380
endif
if sprite frame(1)<5
set sprite frame 1,5
endif
play sprite 1,5,8,100
dec c,2
endif endif
if sprite y(1)<348
if scancode()=31
if spriteangle <3 and sprite x(1)>375 and sprite x(1)<399 and sprite y(1)>=346
textt=rnd(3)
sprite 10,sprite x(10),150+(-324*spriteangle),10
inc spriteangle,1
dec a,180
endif
if sprite frame(1)<9
set sprite frame 1,9
endif
play sprite 1,9,12,100
inc a,2
endif endif
if sprite y(1)>162
if scancode()=17
if spriteangle >1 and sprite x(1)>375 and sprite x(1)<399 and sprite y(1)<=164
textt=rnd(3)
sprite 10,sprite x(10),150+(-324*(spriteangle-2)),10
dec spriteangle,1
inc a,180
endif
if sprite frame(1)>4
set sprite frame 1,1
endif
play sprite 1,1,4,100
dec a,2
endif endif
dec delay,3
if delay < 140
hide sprite 9
if music playing(7)=1
stop music 7
endif endif
if spacekey()=1 and delay <130
show sprite 9
if sprite collision (9,13)=1 and sprite visible(13)=1
if music playing(7)=0
play music 7
loop music 7
set music speed 7,60000
endif
dec enemyhealth,1
delay= 150
endif
if sprite frame(1)>=13 and sprite frame(1)<18
set sprite frame 1,17
sprite 9,sprite x(1)+43,sprite y(1)+22,9
rotate sprite 9,45
else
set sprite frame 1,18
sprite 9,sprite x(1)-5,sprite y(1)+60,9
rotate sprite 9,225
endif endif
if scancode()=17 or scancode()= 30 or scancode()=31 or scancode()=32
if sound playing(1)=0
play sound 1
loop sound 1
endif
else
if sound playing(1)=1
stop sound 1
endif endif
if textt=2 or texxt=1
show sprite 13
endif
if sprite visible(13)=1
sprite 13,400,sprite y(1),1
if sprite exist(21)=0
star = sprite y(1)
sprite 21,400+starmove,star,21
endif
if sprite exist (21)=1 and sprite x(13)> sprite x(1)
sprite 21,400+starmove,star+30,21
dec starmove,2.8
endif
if sprite exist (21)=1 and sprite x(1)> sprite x(13)
sprite 21,400+starmove,star+30,21
inc starmove,2.8
endif
if sprite exist(21)=1
if sprite x(21)<=150 or sprite x(21)>=650
delete sprite 21
starmove=0
endif endif
if sprite x(13)>sprite x(1)
play sprite 13,19,22,200
if sprite collision(1,13)=1
dec c,2
endif endif
if sprite x(13)< sprite x(1)
play sprite 13,23,26,200
if sprite collision(1,13)=1
inc c,2
endif endif endif
sprite 40,750+sprite x(10),sprite y(10),40
sprite 1,220+c,290+a,1
scale sprite 40,600
if sprite exist(41)=1
if sprite collision(1,41)=1 and scancode()=18
inc potions,1
delete sprite 41
endif endif
if sprite exist(42)=1
if sprite collision(1,42)=1 and scancode()=18
inc coins,rnd(30)+20
delete sprite 42
endif endif
if sprite exist(43)=1
if sprite collision(1,43)=1 and scancode()=18
inc keys,1
delete sprite 43
endif endif
if sprite collision(1,40)=1 and keys=1
hide all sprites
text 50,400,"Congratulations , You saved the princess. Sorry there was no room for a cool boss fight. :("
endif
sprite 44,360,490,26
sprite 46,200,490,27
sprite 45,450,490,28 `key
for g=4 to 6
set sprite priority 40+g,3
scale sprite 40+g,200
next
if health <=15
hide all sprites
text 100,400,"It's on easy and you still died? Better restart it. press any key to exit"
wait key
end
endif
if scancode()=19 and coins>100
inc potions,1
dec coins,100
endif endif
loop
A child's dream never dies.