02-17-2025, 01:46 AM (This post was last modified: 02-17-2025, 03:40 AM by 1micha.elok.)
click the images to zoom-in
Night driving feels so dim, like a shadowy night,
I long for the daylight, so vivid, so right.
A touch of soft azure, some cirrus so thin,
To brighten my world, let the sunshine pour in.
'=============================================================
' THE SHADOW
' compiled with N7_250216 version
' - support mp3 play
' - support w3d.SetSkyTexture(skyImage)
'
' ACKNOWLEDGEMENTS
' Watch the Closing Credits at the end of the game
'
' DISCLAIMER
' This tiny game is a work of fiction.
' It is not intended for commercial use and not for sale
' No person or entity associated with this game received payment
' or anything of value, or entered into any agreement,
' in connection with any game assets used in this game.
' Names, characters, places, events and incidents
' are either the products of the author’s imagination
' or used in a fictitious manner.
' Any resemblance to actual persons, animals, aliens, zombies and creatures,
' living or dead, or actual events is purely coincidental.
'
'=============================================================
' Introduction
include "assets/intro.n7"
intro()
set font 0
'----------------
' INITIALIZATION
'----------------
#win32
set window "The Shadow", 1000,500,false
set redraw off
'background music
haunted = loadmusic("assets/haunted night.wav")
play music haunted,1
'color definition
black = [0,0,0]
white = [255,255,255]
'sky texture work since N7_250215 version
'Then use SetSkyTexture to set image used for sky.
'w3d.SetSkyTexture(skyImage)
skyImage = loadimage("assets/sky.png")
'---------------
' MAIN PROGRAM
'---------------
do
' Measure time passed in seconds since last time we were here.
t = clock()
dt = (t - lastTime)/1000
lastTime = t
'Player start moving
if player.z = 13.5 and player.x < 19 then
player.x = min(player.x + 0.5/10,18.5)
'turn #4
if player.angle > -360 and player.angle <> 0 then
player.angle = player.angle - 2.0
else
player.angle = 0
endif
endif
'turn #1
if player.x = 18.5 then player.angle = max(player.angle - 2.0,-90)
if player.x = 18.5 and player.z > 2.5 then player.z = max(player.z - 0.05,2.5)
'turn #2
if player.z = 2.5 then player.angle = max(player.angle - 2.0,-180)
if player.z = 2.5 then player.x = max(player.x - 0.05,1.5)
'turn #3
if player.x = 1.5 then player.angle = max(player.angle - 2.0,-270)
if player.x = 1.5 then player.z = min(player.z + 0.05,13.5)
'draw pistol
if sprite.name ="Soldier" or sprite.name = "Officer" then
set color 255,255,255
px = (width()-width(pistol))/2
py = (height()-height(pistol))+rnd(10)
draw image pistol,px,py
endif
'pause
if keydown(KEY_P) or start then
wln "Press P to continue"
redraw
do;wait 1;if keydown(KEY_ESCAPE,true) then break; until keydown(KEY_P,true)
start = not start
endif
until keydown(KEY_ESCAPE)
'-----------------
' Closing Credits
'-----------------
words = []
words[1] = "CLOSING CREDITS"
words[2] = ""
words[3] = "A special thanks to Marcus, the creator of Naalaa"
words[4] = "for his dedication, support and encouragement"
words[5] = "in the making of this tiny game."
words[6] = ""
words[7] = "Heartfelt thanks to all the talented artists"
words[8] = "who created the amazing game assets"
words[9] = "I couldn't have made it without them"
words[10] = ""
words[11] ="-Robowack in N7 version by Marcus"
words[12] ="-Haunted Night by Hot Dope"
words[13] =" https://pixabay.com/music/search/mood/scary/"
words[14] ="-Zombie by Curt"
words[15] =" https://opengameart.org/content/zombie-rpg-sprites"
words[16] ="-Zombie and Skeleteon by Reemax"
words[17] =" https://opengameart.org/content/zombie-and-skeleteon-32x48"
words[18] ="-Fire Golem by teasloth"
words[19] =" https://opengameart.org/content/fire-golem"
words[20] ="-Alien The Revolution by AntumDeluge"
words[21] =" https://opengameart.org/content/alien-the-revolution"
words[22] ="-Soldier, physician, officer from wolf3d by jseidelin"
words[23] =" https://github.com/jseidelin/wolf3d"
words[24] ="-Pistol"
words[25] =" https://wolfenstein.fandom.com/wiki/Pistol"
words[26] ="-Top Down RPG Enemy by 10kstudios"
words[27] =" https://10kstudios.itch.io/top-down-enemy-animated-8-directions"
words[28] ="-Racing resources by drummyfish"
words[29] =" https://opengameart.org/content/25d-racing-resources"
words[30] ="-Ancient power of serpents composed by Kevin MacLeod"
words[31] =" https://opengameart.org/content/ancient-power-of-serpents"
'text animation of the closing credits
do
for i = height(primary)-30 to -height(primary)
set color 0,0,0; cls; set color 255,255,255
set caret width(primary)/2,i
for j = 1 to sizeof(words)
center words[j]
if keydown(KEY_Q,true) then
free music haunted
end
endif
next
redraw
fwait 40
next
loop
enemies = fill(0, sizeof(flags) - 1, 6)
j = 0
for i = 1 to sizeof(flags) - 1
' Set type
enemies[j].type = flags[i].flag
enemies[j].x = flags[i].x + 0.5
enemies[j].z = flags[i].z + 0.5
' Check type of enemy
if enemies[j].type = 1
' Type 1 moves along the x axis.
enemies[j].dx = 0.04 'speed
enemies[j].dz = 0.0
enemies[j].sprite = w3d.AddFloorSprite(enemies[j].x, enemies[j].z, sprite.img, 1)
elseif enemies[j].type = 2
' Type 2 moves along the z axis.
enemies[j].dx = 0.0
enemies[j].dz = 0.04 'speed
enemies[j].sprite = w3d.AddFloorSprite(enemies[j].x, enemies[j].z, sprite.img, 1)
endif
j = j + 1
next
endfunc
function UpdateEnemies()
set color 255, 255, 255
' Update the sprite animation
set image sprite.img
draw image sprite.sheet, 0, 0, sprite.frame
if sprite.frame < sprite.total-1 then
sprite.frame = sprite.frame + 1*0.1
else
sprite.frame = sprite.start
endif
set image primary
' Update all enemies.
s = sizeof(enemies) - 1
for i = 0 to s
type = enemies[i].type
if type = 1
UpdateSprite(i,"x")
elseif type = 2
UpdateSprite(i,"z")
endif
next
endfunc
function UpdateSprite(i,direction)
' Move.
pos = w3d.Move(enemies[i].x, enemies[i].z, enemies[i].dx, enemies[i].dz, 0.1)
enemies[i].x = pos.x
enemies[i].z = pos.z
' When an enemy hit a wall, change direction.
if w3d.AnyCollision()
if direction="x" then
enemies[i].dx = -enemies[i].dx
elseif direction="z" then
enemies[i].dz = -enemies[i].dz
endif
endif
' Update location
enemies[i].sprite.x = enemies[i].x
enemies[i].sprite.z = enemies[i].z
endfunc
File : [ intro.n7 ]
Code:
function intro()
#win32
set window "The Shadow", 500,250,false,2
set redraw off
'color definition
black = [0,0,0]
white = [200,200,200]
grey = [117,142,168]
blue = [0,0,255]
'Run once only : createfont and save font
'full path asset/filename if this file is used as a library (include section)
'arial15 = createfont("Arial", 15, false, false, false, false)
'save font arial15, "assets/arial15"
font2 = loadfont("assets/arial15")
set font font2
'loadimage by 10kstudios
'https://10kstudios.itch.io/top-down-enemy-animated-8-directions
'full path asset/filename if this file is used as a library (include section)
idle = loadimage("assets/midle_sheet.png",12,1)
attack = loadimage("assets/mattack_sheet.png",24,1)
death = loadimage("assets/mdeath_sheet.png",24,1)
'background music composed by Kevin MacLeod
'https://opengameart.org/content/ancient-power-of-serpents
ancient = loadmusic("assets/ancient.mp3")
play music ancient,1
set music volume ancient,0.5
'idle
totalframe = 12
img = idle
frame = 0
'initial value
count = 0
first = true
out = false
'main loop
do
set color white;cls
'attack
if keydown(KEY_SPACE,true) and count<11 then
totalframe = 24
img = attack
frame = 0
count = count + 1
play sound sword,10
endif
if frame < totalframe-1 then
frame = (frame + 1)%totalframe
elseif first = true
'idle
frame = totalframe+1
img = idle
totalframe = 12
frame = 0
endif
if count > 10 and first then
'death
img = death
frame = 0
first = false
else
if frame < totalframe - 1 then
'animate death
frame = (frame+1)%totalframe
else
'death is disappeared
if img = death then
frame = totalframe + 1
out = true
play sound vanish,5
endif
endif
endif
draw image img,0,0,frame
set color black
set caret 220,60
wln "Strike the sword tenfold strong"
wln "Only then you ride along"
wln "Through the streets where darkness creeps"
wln "Past the place where silence sleeps"
wln
wln
wln
wln "Press SPACE BAR"
if count < 11 then wln count
redraw
fwait 10
if out then
do; wait 1; until keydown(KEY_SPACE,true)
break
endif
loop
'transition effect
set color black; cls
play sound thunder,1,2
for y = 0 to height()
set color white
draw image background,0,0
draw rect 0,0-y,width(),height(),true
set color black
set caret 220,60-y
wln "Strike the sword tenfold strong"
wln "Only then you ride along"
wln "Through the streets where darkness creeps"
wln "Past the place where silence sleeps"
wln
wln
wln
wln "Press SPACE BAR"
redraw
fwait 30
next
play sound thunder,1,2
set color black;cls
'free memories
free sound sword
free sound vanish
free image idle
free image attack
free image death
free music ancient
02-17-2025, 07:08 AM (This post was last modified: 02-17-2025, 07:20 AM by 1micha.elok.)
(02-17-2025, 06:00 AM)johnno56 Wrote: Nice demo... Any plans to develop it any further?
Hi, Thanks....actually, there are several ideas to develop the night driving animation into a real game, such as
- collecting items as bonus,
- adding shooting scenes,
- earning points when hitting targets,
- losing points if the enemy shoots first,
- having a limited number of bullets,
- enemies that appear randomly with varying difficulty levels.
However, it takes time to learn those techniques again. For now, I am intentionally giving the opportunity to anyone who wants to develop it further.
It is "open source" and it is ready to be modified and developed for further enhancement ...