Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
The Shadow Master
#1
Coming Soon ...

   
click the image to zoom-in
Reply
#2
Just compiled the source file with the latest version of Naalaa (N7 250215)


Attached Files
.zip   theShadow_N720250215.zip (Size: 4.02 MB / Downloads: 8)
Reply
#3
           
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.

 CONTROL KEYS
 - Key 1 = Skeleton
 - Key 2 = Little Zombie
 - Key 3 = Baby Zombie
 - Key 4 = Fire Golem
 - Key 5 = Alien
 - Key 6 = Soldier
 - Key 7 = Physician
 - Key 8 = Officer
 - P    = pause on/off
 - ESC  = quit game
 - Q    = quit closing credits


File : [ the shadow.n7 ]
Code:
'=============================================================
' 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

' Library : wolf3d
include "wolf3d.n7"
visible w3d = Wolf3D()
w3d.SetView(0, 0, width(primary), height(primary), rad(72))

' Player.
visible player = []

' Enemies aka zombies :)
visible enemies = []

visible sprite = []
sprite.img = 0
sprite.name = "Skeleton"
sprite.start = 3
sprite.frame = 3
sprite.total = 6
sprite.sheet = loadimage("assets/zs_sheet.png",9,4)
sprite.w     = width(sprite.sheet)
sprite.h     = height(sprite.sheet)
create image sprite.img, sprite.w, sprite.h
set image colorkey sprite.img, 255, 0, 255 'magenta as color key

'pistol
pistol = loadimage("assets/pistol.png")

' load map and loader flags
LoadMap()

'initial value
start = true
lastTime = clock()

'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)
   
    'Choose which sprite sheet you like
    if keydown(KEY_1,true) then
        sprite.start = 3
        sprite.frame = 3
        sprite.total = 6
        sprite.sheet = loadimage("assets/zs_sheet.png",9,4)
        sprite.name = "Skeleton"
    elseif keydown(KEY_2,true) then
        sprite.start = 0
        sprite.frame = 0
        sprite.total = 3
        sprite.sheet = loadimage("assets/zs_sheet.png",9,4)
        sprite.name = "Little Zombie"
    elseif keydown(KEY_3,true) then
        sprite.start = 0
        sprite.frame = 0
        sprite.total = 3
        sprite.sheet = loadimage("assets/zombie_sheet.png",3,4)
        sprite.name = "Baby Zombie"
    elseif keydown(KEY_4,true) then
        sprite.start = 0
        sprite.frame = 0
        sprite.total = 4
        sprite.sheet = loadimage("assets/golem_sheet.png",2,2)
        sprite.name = "Fire Golem"
    elseif keydown(KEY_5,true) then   
        sprite.start = 6
        sprite.frame = 6
        sprite.total = 9
        sprite.sheet = loadimage("assets/alien_sheet.png",3,4)
        sprite.name  = "Alien"
    elseif keydown(KEY_6,true) then
        sprite.start = 0
        sprite.frame = 0
        sprite.total = 12
        sprite.sheet = loadimage("assets/419_430.png",12,1)
        sprite.name = "Soldier"
    elseif keydown(KEY_7,true) then
        sprite.start = 0
        sprite.frame = 0
        sprite.total = 14
        sprite.sheet = loadimage("assets/311_324.png",14,1)
        sprite.name  = "Physician"
    elseif keydown(KEY_8,true) then
        sprite.start = 0
        sprite.frame = 0
        sprite.total = 10
        sprite.sheet = loadimage("assets/364_373.png",10,1)
        sprite.name  = "Officer"   
    endif
    sprite.w     = width(sprite.sheet)
    sprite.h     = height(sprite.sheet)
    create image sprite.img, sprite.w, sprite.h
    set image colorkey sprite.img, 255, 0, 255 'magenta as color key       
   
    UpdateEnemies()    
   
    'sky texture work in N7_250215 version
    'Then use SetSkyTexture to set image used for sky.
    w3d.SetSkyTexture(skyImage)
                           
    'render w3d
    w3d.Render(player.x, player.z, rad(player.angle))
   
    '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
   
    'info box
    set color 255,255,255
    set caret 10,10
    wln "INFO BOX"
    'wln "x = "+player.x
    'wln "z = "+player.z
    'wln "a = "+player.angle
    'wln
    wln "1. Skeleton"
    wln "2. Little Zombie"
    wln "3. Baby Zombie"
    wln "4. Fire Golem"
    wln "5. Alien"
    wln "6. Soldier"
    wln "7. Physician"
    wln "8. Officer"
    wln "------------------"
    wln  sprite.name
    wln "------------------"
    wln
    wln "P    = pause on/off"
    wln "ESC  = quit"
    wln

    redraw
    fwait 60
       
    '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




'-----------
' FUNCTIONS
'-----------
function LoadMap()
    ' Map file, loader flags 0 = player, loader flags 1,2 = enemies
    flags = w3d.LoadN6Map("assets/map.txt")

    ' Player.
    player.x = flags[0].x + 0.5
    player.z = flags[0].z + 0.5
    player.angle = flags[0].angle

    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 image
    background = loadimage("assets/scene1.png")
   
    'load sound effect
    sword   = loadsound("assets/sword.wav")
    vanish  = loadsound("assets/vanish.wav")
    thunder = loadsound("assets/thunder.wav")
   
    '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
   
endfunc
Reply
#4
Nice demo... Any plans to develop it any further?
Logic is the beginning of wisdom.
Reply
#5
(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 ...  Big Grin
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)