Welcome, Guest
You have to register before you can post on our site.

Username
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 36
» Latest member: bul71
» Forum threads: 169
» Forum posts: 1,360

Full Statistics

Online Users
There are currently 106 online users.
» 0 Member(s) | 103 Guest(s)
Applebot, Bing, Google

Latest Threads
nPixel
Forum: NaaLaa 7 Code
Last Post: 1micha.elok
7 hours ago
» Replies: 10
» Views: 776
The Shadow Master
Forum: NaaLaa 7 Code
Last Post: 1micha.elok
Yesterday, 07:08 AM
» Replies: 4
» Views: 120
N7 version 25.02.16 relea...
Forum: Announcements
Last Post: 1micha.elok
Yesterday, 01:55 AM
» Replies: 2
» Views: 48
Suggestion: support dynam...
Forum: Suggestions
Last Post: Marcus
02-15-2025, 05:23 PM
» Replies: 8
» Views: 1,053
N7 version 25.02.15 relea...
Forum: Announcements
Last Post: 1micha.elok
02-15-2025, 10:54 AM
» Replies: 1
» Views: 50
Ask help to fix errors (g...
Forum: NaaLaa 7 Questions
Last Post: 1micha.elok
02-15-2025, 09:35 AM
» Replies: 7
» Views: 422
3D Breakout, just a quick...
Forum: NaaLaa 7 Code
Last Post: Marcus
02-02-2025, 07:42 AM
» Replies: 6
» Views: 483
Render on an image before...
Forum: NaaLaa 6 Questions
Last Post: Marcus
01-27-2025, 03:56 PM
» Replies: 4
» Views: 366
Repurposed Sprite Editor
Forum: NaaLaa 7 Code
Last Post: 1micha.elok
01-27-2025, 11:58 AM
» Replies: 13
» Views: 1,067
Alien Breed 3D II: The Ki...
Forum: Everything else
Last Post: Marcus
01-26-2025, 07:58 AM
» Replies: 2
» Views: 310

 
  Animated String Art
Posted by: johnno56 - 07-11-2024, 08:36 PM - Forum: NaaLaa 7 Code - Replies (4)

Not sure if I had posted this before... If I have, let me know, and I will delete it... lol

This is a converted QB64 demo created by BPlus... 

If you are as old or older than I am then this will be a "flash back"... If you are young, then stare continuously at the rotating pattern, then transfer all your savings to the following account number... Moo Ha Ha Ha Ha....

Variable "t" on line #41 will determine the number of "points" to be drawn. The program will start with one point and increment by one until "t" is reached. Then it starts over again using a different colour... ESC to quit.

Code:
' Open a window and enable double buffering.
set window "String Art Animated", 600, 600, false
set redraw off

'   Converted from a QB64 program by BPlus

randomize clock()

visible xmax = 600
visible ymax = 600
visible a1, a2, cx, cy, r, s, n, pi, t
visible red, blue, green

r = ymax / 2
cx = xmax / 2
cy = ymax / 2
n = 250
s = 360 / n

red = 175
green = 255
blue = 255

pi = 3.141592654

t = 1

do
    set color 0, 0, 0
    cls
    'set color red, green, blue
    draw ellipse cx - 1, cy, r, r
    for i = 1 to n
        a1 = s * i
        a2 = s * i * t
        set color red, green , blue
        draw line cx + sin(d2r(a1)) * r, cy + cos(d2r(a1)) * r, cx + sin(d2r(a2)) * r, cy + cos(d2r(a2)) * r
    next
   
    t = t + 0.0125
    if t >= 20
        t = 1
        red = 32 + rnd(33, 255)
        green = 32 + rnd(33, 255)
        blue = 32 + rnd(33, 255)
    endif

    redraw
    fwait 60   
until keydown(KEY_ESCAPE, true)

'   -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
function d2r(angle)
    return angle * (pi / 180)
endfunc
'   -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Print this item

  out in memory in Malloc ,new version
Posted by: oskarg - 07-03-2024, 08:35 AM - Forum: NaaLaa 7 Questions - Replies (5)

Good morning, when I was compiling the base examples I got this :
   
Since I can solve the problem, it doesn't allow me to run Naalaa now.

Print this item

  N7 version 24.06.29 released
Posted by: Marcus - 06-29-2024, 03:31 PM - Forum: Announcements - Replies (3)

This release contains a first version of the enginea library, meant for sector based first person shooter games. This is far from the final version of the library; support for meshes is very basic and has not been tested much.

https://naalaa.com/n7/N7_240629.zip

2024-06-29

  • Added the enginea library and editor (enginea_editor.exe), for sector based first person shooter games, plus a tutorial (EngineA_Tutorial.pdf) and examples in examples/enginea_library

Print this item

  Can you beleive ...
Posted by: aurel - 06-20-2024, 04:36 PM - Forum: Everything else - Replies (27)

this shit:

Your system is outdated and exposed to attack.

Mint 17.3 Big Grin Big Grin Big Grin

Print this item

  Confused about mid() command
Posted by: johnno56 - 06-11-2024, 01:39 AM - Forum: NaaLaa 7 Questions - Replies (7)

Hi Marcus,

I was tinkering with string manipulation and came across a bit of a 'poser' in regards to the mid() command.

Here is a short example....

Code:
' Open a window and enable double buffering.
set window "Test", 800, 632, false
set redraw off

visible a = "ABCDEF"
visible b
visible c

'   display the letters "B" to "E" inclusive...
b = mid(a, 1, 4)
pln b
'   This works fine...

'   But, when I try to make the third letter "D"
'   an "X"...

'   mid(b, 3, 1) = "X"
'   pln b

'   I get a syntax error on line 17 during compile

'(remove the "remarks" from lines 17 and 18
' to see what I mean...)

system "pause"

Defining a string then assigning a variable to a "portion" of the string, using mid(), works fine...
But, trying to replace a character, using mid() causes the compilation to fail with a syntax error.

There is no rush on this one... Whenever you are able... Present situation understood... We will "keep an eye on the store" during your break...

J

Print this item

Star Gone for a while
Posted by: Marcus - 06-10-2024, 01:33 PM - Forum: Everything else - Replies (2)

I just want to say that I'll be "gone" for a while, in case you wonder why I don't post or reply. Lots of personal things going on, so I don't have any time left for n7. Probably it will get better in a week or two.

Print this item

  The Stargate
Posted by: 1micha.elok - 06-07-2024, 11:38 AM - Forum: NaaLaa 7 Code - Replies (1)

 THE STARGATE
 Don't sleep, your nightmare is coming ...

       
click each image to zoom in

 Tips
 - Each kind of weapons has certain number of power / bullet
 - Switch your weapon when it has no power / bullet anymore
 - Use gun or crossbow to shoot
 - Use trident or bare hands for close combat

 Control keys :
 - W,A,S,D    movement
 - Mouse      rotation
 - ESC        quit
 - 1,2,3,4,5  select weapon
 - left click  to shoot

Code:
'========================================================================================
' THE STARGATE
' Don't sleep, your nightmare is coming ...
'
' Tips
' - Each kind of weapons has certain number of power / bullet
' - Switch your weapon when it has no power / bullet anymore
' - Use gun or crossbow to shoot
' - Use trident or bare hands for close combat
'
' Control keys :
' - W,A,S,D     movement
' - Mouse       rotation
' - ESC         quit
' - 1,2,3,4,5   select weapon
' - left click  to shoot
'
' Acknowledgement :
' - Marcus, enginea library, https://naalaa.com/forum/thread-124-post-929.html
' - Game assets
'   *Building Pixel by LandEnd Studios https://isaquerr.itch.io/building-pixel
'   *Free 3D Fps-Shooter Models | TurboSquid https://images.app.goo.gl/NQtoZhALCWDoYFPp6
'   *Stealth Battle background music by Mark, meak363 from Pixabay.com
'   *Different kinds of weapons such as trident, hands, crossbow of The Spriting Dark
'    Carnival https://www.altarofstone.com/forums/viewtopic.php?t=42
'   *Man Silhouette https://pixabay.com/vectors/man-silhouette-male-people-4329249/
'   *Monster https://images.app.goo.gl/6HiZncjYoCaJ7zSr9
'========================================================================================


'----------------
' INITIALIZATION
'----------------
#win32
include "myassets/enginea.n7"
include "myassets/disclaimer.n7"
set window "stargate",1000,500,false
set redraw off

'constant
constant ENEMY_ID         = 6

'color definition
visible white        = [255,255,255]
visible black        = [0,0,0]
visible green        = [0,255,0,150]
visible darkgreen    = [0,50,0]
visible red          = [255,0,0]
visible gray         = [0,0,0,150]

'set stage (view, fog, player, camera)
EA_SetView(primary, rad(65), 0.1,6)
EA_SetFog(EA_NORMAL, white[0],white[1],white[2])

'load game assets (font, music, weapon, map, player, enemy)
visible font20 = createfont("Courier New", 20, false, false, false, false)
visible font40 = createfont("Courier New", 40, false, false, false, false)
visible music_ = loadmusic("myassets/battle3.wav")
play music music_,1

visible weapon  = []
visible w       = 1
weapon[1]       = loadimage("myassets/shooter.png")
weapon[2]       = loadimage("myassets/crossbow.png")
weapon[3]       = loadimage("myassets/triple.png")
weapon[4]       = loadimage("myassets/hands.png")   

visible info    = []
info.gun        = 2
info.crossbow   = 2
info.trident    = 2
info.barehands  = 2
info.lifes      = 100

visible abort       = loadimage("myassets/abort.png")
visible failed      = loadimage("myassets/failed.png")   

visible enemy1      = loadimage("myassets/man.png",4,1)
visible enemy2      = loadimage("myassets/monster.png",4,1) 
visible enemyBullet = loadimage("myassets/enemy_bullet.png",4,1)

visible playerBullet = []
playerBullet[1] = loadimage("myassets/shooter_bullet.png", 4, 1)
playerBullet[2] = loadimage("myassets/crossbow_arrow.png", 4, 1)

flags = EA_LoadMap("myassets/map.json")
visible player = unset
foreach f in flags
    select f.flag
        case "player"
            player = CreatePlayer(f.x, f.floorY, f.z)
            EA_AddObject(player)
            EA_SetCamera(player)
        case "monster"
            o = CreateEnemy(f.x, f.ceilingY, f.z)
            EA_AddObject(o)
    endsel
next


Disclaimer()
'-------------------------
' MAIN (update,draw,run)
'-------------------------   
EA_SetUpdateAction(Update)
EA_SetDrawAction(Draw)
EA_Run()
'------------------------


'-----------
' FUNCTIONS
'-----------
function Update(dt)
    if keydown(KEY_ESCAPE,true) then
        EA_SetDrawAction(Message(abort))
        EA_Stop()
    endif
    if keydown(KEY_M) then stop music music_
endfunc

function Draw()
    set color white
    if keydown(KEY_1) then w=1 'gun shooter
    if keydown(KEY_2) then w=2 'crossbow
    if keydown(KEY_3) then w=3 'trident       close combat
    if keydown(KEY_4) then w=4 'bare hands    close combat
    draw image weapon[w],
      (width(primary)-width(weapon[w]))/2 - 23 + cos(player.bobAngle*0.5)*player.bobEffect*8,
      height(primary)-height(weapon[w])+15 + sin(player.bobAngle)*player.bobEffect*6,
      0   
   
    ' info box
    set color gray
    draw rect 20,20,200,200,1   
    set color white
    set caret 40,40
    wln "INFO BOX"
    wln "-------------------"
    wln "Weapon Power"
    wln "1.Gun        : " + info.gun
    wln "2.Crossbow   : " + info.crossbow
    wln "3.Trident    : " + info.trident
    wln "4.Bare hands : " + info.barehands
    wln
    wln "Lifes        : " + info.lifes
    wln "-------------------"
               
    ' Crosshair.
    if w=1 then
        set color darkgreen
        cx = width(primary)/2+ cos(player.bobAngle*0.5)*player.bobEffect*8
        cy = height(primary)/2+10+ sin(player.bobAngle)*player.bobEffect*6
        draw ellipse cx,cy, 20, 20, false
        draw line cx-40, cy, cx+40, cy
        draw line cx,cy-40, cx, cy+40
    endif
   
    'Player's angle and coordinates
    angle = round(deg(player.Yaw())%360)'0=south, 90=west, 180= north, 270=east
    x = round(player.X())
    y = abs(round(player.Y()))
    z = round(player.Z())

    set font font20

    'Compass
    set color white 
    set caret 50,320; wln "Compass"
    set color green
    draw ellipse 80,410,70,70,1
    set color darkgreen
    draw ellipse 80,410,70,70
    draw ellipse 80,410,60,60
    draw ellipse 80,410,20,20
    set color white
    draw ellipse 80,410,10,10,1
    needle = [
    80-10*cos(rad(angle+180)),410-10*sin(rad(angle+180)),
    80+70*cos(rad(angle+90)),410+70*sin(rad(angle+90)),
    80+10*cos(rad(angle-180)),410+10*sin(rad(angle-180))
    ]
    draw poly needle,1
    draw line 80,410,80+70*cos(rad(angle+90)),410+70*sin(rad(angle+90))
       
    'Map
    size = 30
    w_map = 7
    h_map = 5
    x_rect = width(primary)-w_map*size-40
    z_rect = 340   
    set color green 'frame 
    draw rect x_rect,z_rect,(w_map+1)*size,h_map*size,1
    set color darkgreen 'grid
    for i = 0 to w_map+1 draw line x_rect+i*size,z_rect,x_rect+i*size,z_rect+h_map*size 'vertical
    for i = 0 to h_map  draw line x_rect,z_rect+i*size,x_rect+(w_map+1)*size,z_rect+i*size 'horiontal
   
    'Player's position on the map
    posx = x_rect+(w_map-x+2)*size
    posz = z_rect+(z-2)*size   
    set color white
    draw rect posx,posz,size,size,1
   
    'Map title
    set color white
    set caret x_rect,z_rect-20; wln "Map "+x+","+y+","+z
       
    set font 0 'default
endfunc

function CreatePlayer(x, y, z)
    player = EA_FpsPlayer()
    player.SetPos(x, y, z)
    player.SetMouseSens(0.3)

    player.bobAngle = 0
    player.bobEffect = 0
    player.stimer = 0
   
    player.SetYaw(rad(180)) '0=south, 90=west, 180= north, 270=east
    player.SetJumpKey(unset) 'disable jump (SPACE BAR)
   
    player.Update = function(dt)
         .bobAngle = (.bobAngle + 8*dt)%(PI*4)
         .bobEffect = min(.bobEffect + 2.0*dt, 1)
        .stimer = max(.stimer - dt, 0)
        if mousebutton(0, true) and .stimer = 0 and (w=1 or w=2) then
        'left mouse, gun shooter or crossbow
            .stimer = 0.5
           
            if w=1 and info.gun>0 then       
                EA_AddObject(CreatePlayerBullet(
                    playerBullet[w],
                    .X() + .DX()*0.2, .Y() - 0.3 + .DY()*0.2, .Z() + .DZ()*0.2,
                    .DX()*4, .DY()*4, .DZ()*4))
               
                info.gun = info.gun - 1
            endif
           
            if w=2 and info.crossbow>0 then
                EA_AddObject(CreatePlayerBullet(
                    playerBullet[w],
                    .X() + .DX()*0.2, .Y() - 0.3 + .DY()*0.2, .Z() + .DZ()*0.2,
                    .DX()*4, .DY()*4, .DZ()*4))
               
                info.crossbow = info.crossbow - 1           
            endif
        endif         
    endfunc
   
    return player
endfunc

function CreatePlayerBullet(img, x, y, z, dx, dy, dz)
    b = EA_Object()
    b.SetPos(x, y, z)
    b.SetSprite(img, 0, false)
    b.SetHeight(height(img)/64)
    b.SetRadius(0.5*width(img)/64)
    b.dx = dx
    b.dy = dy
    b.dz = dz
    b.numCels = cels(img)
    b.cel = 0
    b.Update = function(dt)
        if .numCels > 1
            .cel = (.cel + dt*30)%.numCels
            .SetCel(int(.cel))
        endif
        res = .Move(.dx*dt, .dy*dt, .dz*dt, 0)
        if res.any
            EA_RemoveObject(this)
        else
            objs = .SectorObjects()
            if objs and sizeof(objs)
                for i = 0 to sizeof(objs) - 1
                    if objs[i].id = ENEMY_ID
                        if .CollidesWith(objs[i])
                            objs[i].Hit(.dx, .dz)
                            EA_RemoveObject(this)       'remove bullet
                            EA_RemoveObject(objs[i])    'remove enemy
                            break
                        endif
                    endif
                next
            endif
        endif
    endfunc

    return b
endfunc

function CreateEnemy(x, y, z)
    enemy = EA_Object()
    enemy.id = ENEMY_ID
   
    enemy.state = 0 ' State 0 = falling, state 1 = on the gound.
    enemy.SetSprite(enemy1, 0, true)
    enemy.SetHeight(height(enemy1)/400)
    enemy.SetRadius(0.5*width(enemy1)/400)
    enemy.dy = 0.01 + rnd()/20 'vertical random speed
   
    enemy.SetPos(x, y, z)
    enemy.SetYaw(rad(rnd(360)))
    enemy.cel = 0
    enemy.push = 0
    enemy.pushDX = 0
    enemy.pushDZ = 0
   
    enemy.Update = function(dt)
        .stimer = max(.stimer - dt, 0)
        if .stimer = 0 and .state=1
            .stimer = 0.5
            EA_AddObject(CreateEnemyBullet(
                enemyBullet,
                .X() + .DX()*0.2, .Y() - 0.3 + .DY()*0.2, .Z() + .DZ()*0.2,
                .DX()*4, .DY()*4, .DZ()*4))
        endif       
   
        .cel = (.cel + dt*4)%4              'animation
        .SetCel(int(.cel))                  'animation   
        if .state = 0                       'Falling from the sky (... ceiling).
            res = .Move(0, .dy*dt, 0, 0)    'only move vertically
            if res.g                        'ground collision
               .state = 1                   'change state to 1
               .dy = 1                      'set gravity to 1
               .SetSprite(enemy2, 0, true)
            endif
        else
            res = .Move(.DX()*0.75*dt, .dy, .DZ()*0.75*dt, 0)
            if res.w 'wall
                .SetYaw(rad(deg(atan2(res.dx, res.dz)) - 90 + rnd()*180))
            endif
            .push = max(.push - 1.5*dt, 0)
        endif
       
        'collision enemy and player (close combat)
        if .CollidesWith(player) and (w=3 or w=4) then
        'close combat trident or barehands
            if info.trident > 0 and w=3 then
                EA_RemoveObject(this)
                info.trident = info.trident - 1   
            endif
           
            if info.barehands > 0 and w=4 then
                EA_RemoveObject(this)
                info.barehands = info.barehands - 1
            endif     
        endif 
       
        'collision enemy and player (not close combat)
        if .CollidesWith(player) and (w=1 or w=2) then 'not a close combat, only gun or crossbow
            info.lifes = info.lifes - 1
            if info.lifes<=0 then Message(failed)
            set color red
            draw rect 0,0,width(primary),height(primary),1
            redraw
            fwait 60
        endif   
       
    endfunc
   
    enemy.Hit = function(dx, dz)
        .pushDX = .push*.pushDX + dx
        .pushDZ = .push*.pushDZ + dz
        .push = 1
        .htimer = 0.15
    endfunc
   
    return enemy
endfunc

function CreateEnemyBullet(img, x, y, z, dx, dy, dz)
    b = EA_Object()
    b.SetPos(x, y, z)
    b.SetSprite(img, 0, false)
    b.SetHeight(height(img)/64)
    b.SetRadius(0.5*width(img)/64)
    b.dx = dx
    b.dy = dy
    b.dz = dz
    b.numCels = cels(img)
    b.cel = 0
    b.Update = function(dt)
        if .numCels > 1
            .cel = (.cel + dt*30)%.numCels
            .SetCel(int(.cel))
        endif
        res = .Move(.dx*dt, .dy*dt, .dz*dt, 0)
        if res.any
            EA_RemoveObject(this)
        else
            'collision detection enemy bullet and player
            if .CollidesWith(player)
                info.lifes = info.lifes - 1
                if info.lifes<=0 then Message(failed)
                set color red
                draw rect 0,0,width(primary),height(primary),1
                redraw
                fwait 60
            endif
        endif
    endfunc

    return b
endfunc

function Message(img)
    set color white
    draw image img,(width(primary)-width(img))/2,(height(primary)-height(img))/2
    set font font40
    set caret width(primary)/2,height(primary)-50
    center "Press ESC to continue"
    redraw
    do; wait 1 ;until keydown(KEY_ESCAPE,true)
    set font 0 'default
    Closing_Credits()
    end
endfunc



Attached Files
.zip   stargate_final.zip (Size: 3.76 MB / Downloads: 7)
Print this item

  3D Modelling - Blender
Posted by: johnno56 - 06-05-2024, 06:37 AM - Forum: Everything else - Replies (4)

Marcus,

Many years ago, and I may have mentioned this before, I attempted to use Blender to add objects to Cube2 (sauerbratten) primarily to see if I could and to determine how much work was involved. I had no idea about making models - and still don't - so I used a 'tutorial' to make a 3D wooden crate and a 3D vase.

Initially, the overall "look" of Blender was, for want of a better word, intimidating... Thankfully I had the tutorials to work through. I think it took about half an hour to create each model. Repetition would obviously improve efficiency, but both objects were created successfully... mind you, the final 'size' of the models, looked a little out of place... I think they were too big...

Back then I wasn't interested in 'animations'... ha... I had enough trouble getting my head around static objects... lol

I went online to check 3D modelling software... Yikes... Most either had some huge purchase costs or subscription based plans. There were one or two "free" packages but were quite limited in what they could do...

Found, downloaded and installed the latest version of Blender... Started it up... Almost fell off the chair... I thought the really old version of Blender was intimidating!! I am not sure I have enough years left in me to learn everything... For free and open source software it sure has pretty much all the "bells and whistles"... Really impressive... but scary!

   

Time to checkout tutorials again... *gulp*

Print this item

  return movement
Posted by: aliensoldier - 05-20-2024, 02:47 PM - Forum: NaaLaa 7 Questions - Replies (9)



In the first level there are those mechanical birds that move from left to right but at any moment they launch themselves towards the player and then return to their initial position. How can you make them return to their initial position with that motion?

Print this item

  Happy Birthday
Posted by: 1micha.elok - 05-19-2024, 04:57 AM - Forum: Everything else - Replies (4)

Happy Birthday, Marcus
May happiness be with you.

Print this item