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

Username
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 37
» Latest member: Ludwig
» Forum threads: 191
» Forum posts: 1,485

Full Statistics

Online Users
There are currently 83 online users.
» 0 Member(s) | 82 Guest(s)
Bing

Latest Threads
City Fighter
Forum: NaaLaa 7 Code
Last Post: johnno56
9 hours ago
» Replies: 3
» Views: 125
RW3
Forum: NaaLaa 7 Code
Last Post: Marcus
04-11-2025, 05:22 AM
» Replies: 3
» Views: 171
ugBASIC! Good BASIC!
Forum: Programming
Last Post: luwal
04-04-2025, 11:35 PM
» Replies: 6
» Views: 533
Happy Birthday
Forum: Everything else
Last Post: johnno56
04-03-2025, 10:52 PM
» Replies: 3
» Views: 372
Pool - Cue Sports (Simple...
Forum: NaaLaa 7 Code
Last Post: johnno56
04-03-2025, 06:41 PM
» Replies: 3
» Views: 363
Nintendo Switch 2
Forum: Everything else
Last Post: johnno56
04-03-2025, 05:41 AM
» Replies: 2
» Views: 285
Pixel Editor
Forum: NaaLaa 7 Code
Last Post: kevin
03-31-2025, 06:52 PM
» Replies: 12
» Views: 1,119
Shell
Forum: NaaLaa 7 Questions
Last Post: johnno56
03-29-2025, 08:11 AM
» Replies: 3
» Views: 349
Rectangle (simple physics...
Forum: NaaLaa 7 Code
Last Post: johnno56
03-25-2025, 07:26 PM
» Replies: 3
» Views: 500
Some textures
Forum: Everything else
Last Post: 1micha.elok
03-23-2025, 10:24 AM
» Replies: 5
» Views: 638

 
  Repurposed Sprite Editor
Posted by: johnno56 - 01-23-2025, 07:57 PM - Forum: NaaLaa 7 Code - Replies (13)

Marcus,

Back in December of 2024, I mention that I was having difficulty(s), with my Sprite Editor. The fix you provided worked like a charm... The project has been "gathering dust" since then because of lack of planning on my part. Creating an editor without considering, "Do I have the skill set to complete it?" The answer was a resounding "NO."...

Then I got to thinking (Ok, you can stop laughing now... very funny...) that the Sprite Editor is very similar to a Tile Map Editor.  Mind you, a bare-bones, editor... lol  Functions like, New, Load, Save, Quit, Draw and Erase tile... Seeing that Wolf3D does not seem to have a Editor per se, maybe the Sprite Editor, could be repurposed?

Here is my idea: Wolf3D uses a standard 64x64 tiled "map". Single level (ie: no layers). The Sprite Editor is already configured for a 64x64 "pixel" display. Give the different walls etc a specific colour. "Draw" the wall "pixel" etc to create the "map". Scan the main grid to convert it to a 64x64 character text grid then convert that grid to the standard Wolf3D "map = [[ ]]" layout.

No prizes for guessing that I have already started... kind of... The four main function are working (sort of) and the selection of the "tiles" can be drawn and erased. Saving and loading are my biggest issues at the moment... After all - it's only been 1 day... lol

I realize that EngineA already has a Tile Based editor and was wondering if your intentions are focused more toward that type of game creation than the Wolf3D game style? Reason: If the focus is on EngineA then it would be illogical to continue with the W3D editor... What do you think? Is a W3D editor a kind of "re-inventing the wheel" type of deal?

Print this item

  spoop hunt (enginea)
Posted by: Marcus - 01-18-2025, 09:09 AM - Forum: NaaLaa 7 Code - Replies (3)

Nothing finished here. This was one of my "test programs" when writing the enginea library and editor, so it's just a couple of enemies in some few rooms. The graphics and the music are ai generated, love the tune Smile  Some of the code might be of interest to others, so I'm posting it.

It's this thing: 



Attached Files
.zip   spoop_hunt.zip (Size: 3.08 MB / Downloads: 6)
Print this item

  Thunderbird Methuselah (Game of Life)
Posted by: 1micha.elok - 01-17-2025, 11:22 AM - Forum: NaaLaa 7 Code - Replies (7)

             
click each image to zoom in

CONWAY'S GAME OF LIFE
 Just a quick conversion to N7 

 Reference :
 "Thunderbird" methuselah evolution in the Game of Life
 https://rosettacode.org/wiki/Conway%27s_...e#BASIC256


Code:
'==============================================================
' CONWAY'S GAME OF LIFE
' Just a quick conversion to N7 
'
' Reference :
' "Thunderbird" methuselah evolution in the Game of Life
' https://rosettacode.org/wiki/Conway%27s_Game_of_Life#BASIC256
'==============================================================

'set window
#win32
set window "Game of Life",236,140,true
set redraw off

'color definition
black   = [0,0,0]
white   = [255,255,255]
purple  = [128,0,128]
green   = [0,255,0]
red     = [255,0,0]
yellow  = [255,255,0]

X = 59 ; Y = 35 ; H = 4

c = dim(X,Y)
cn = dim(X,Y)
cl = dim(X,Y)

'Thunderbird methuselah pattern
c[X/2-1][Y/3+1] = 1
c[X/2][Y/3+1]   = 1 
c[X/2+1][Y/3+1] = 1   
c[X/2][Y/3+3]   = 1
c[X/2][Y/3+4]   = 1
c[X/2][Y/3+5]   = 1

'initial value
s = 0
start = 1

'main loop
do
    'clear screen
    set color black
    cls
   
    alive = 0 
    stable = 1
    s = s + 1
   
    for y = 0 to Y-1
        for x = 0 to X-1
            xm1 = (x-1+X)%X
            xp1 = (x+1+X)%X
            ym1 = (y-1+Y)%Y
            yp1 = (y+1+Y)%Y
            cn[x][y] = c[xm1][y] + c[xp1][y]
            cn[x][y] = c[xm1][ym1] + c[x][ym1] + c[xp1][ym1] + cn[x][y]
            cn[x][y] = c[xm1][yp1] + c[x][yp1] + c[xp1][yp1] + cn[x][y]
           
            if c[x][y] = 1 then
                if cn[x][y] < 2 or cn[x][y] > 3 then
                    cn[x][y] = 0
                else
                    cn[x][y] = 1
                    alive = alive + 1
                endif
            else
                if cn[x][y] = 3 then
                    cn[x][y] = 1
                    alive = alive + 1
                else
                    cn[x][y] = 0
                endif
            endif
           
            if c[x][y] then
                if cn[x][y] then
                    if cl[x][y] then
                        set color purple        # adult
                    endif
                    if not cl[x][y] then
                        set color green         # newborn
                    endif
                else
                    if cl[x][y] then
                        set color red           # old
                    endif
                    if not cl[x][y] then
                        set color yellow        # shortlived
                    endif
                endif
               
                draw rect x*H,y*H,H,H,true
               
            endif
           
        next
    next
   
    redraw
    fwait 10
   
    # Copy arrays
    for i = 0 to X-1
        for j = 0 to Y-1
            if cl[i][j]<>cn[i][j] then stable = 0
            cl[i][j] = c[i][j]
            c[i][j] = cn[i][j]
        next
    next   
   
    if start then
        set color white
        set caret width()/2, height()-15
        center "Press Enter to Continue"
        redraw
        do;wait 1;until keydown(KEY_RETURN,true)
        start = false
    endif   
   
until not alive or stable

'final message
set color white
set caret width()/2,height()-15
if not alive then
    center "Died in "+s+" iterations"
else
    center "Stabilized in "+(s-2)+" iterations"   
endif
redraw

'Escape to quit
do;wait 1;until keydown(KEY_ESCAPE,true)

Print this item

  Irregular Beauty
Posted by: 1micha.elok - 01-07-2025, 12:46 AM - Forum: NaaLaa 7 Code - Replies (2)

IRREGULAR BEAUTY 3D


 Beyond isometric, the world unfolds,
 In 3D grace, its secrets told.
 Irregular forms, yet beauty reigns,
 Elegance shines where chaos remains.

   
click the image to zoom-in

Code:
'==================================================
' IRREGULAR BEAUTY 3D
' Beyond isometric, the world unfolds,
' In 3D grace, its secrets told.
' Irregular forms, yet beauty reigns,
' Elegance shines where chaos remains.
'
' References :
' - Pillars s3d (Marcus)
'==================================================

#win32

'library
include "s3d.n7"

'window size
set window "Irregular Beauty 3D", 480*screenw()/screenh(), 480, false
set redraw off

'color definition
black = [0,0,0]
white = [255,255,255]

'set up 3D view
S3D_SetView(primary, rad(90), 0.1, 360)
S3D_SetPerspectiveCorrection(S3D_NORMAL)

'cube 3D
cube = S3D_BeginMesh()
    S3D_Translate(0, -1, 0)
    S3D_Begin(S3D_QUADS)
   
        S3D_Color(0,0,0) 'bottom
        S3D_Vertex(1, 1, -1, 0, 0)
        S3D_Vertex(1, 1, 1, 0, 0)
        S3D_Vertex(-1, 1, 1, 0, 0)
        S3D_Vertex(-1, 1, -1, 0, 0)
       
        S3D_Color(200, 200, 0) 'top color
        S3D_Vertex(1, -1, 1, 0, 0)
        S3D_Vertex(1, -1, -1, 0, 0)   
        S3D_Vertex(-1, -1, -1, 0, 0)
        S3D_Vertex(-1, -1, 1, 0, 0)
       
        S3D_Color(200, 200, 0) 'back
        S3D_Vertex(1, 1, 1, 0, 0)
        S3D_Vertex(1, -1, 1, 0, 0)
        S3D_Vertex(-1, -1, 1, 0, 0)
        S3D_Vertex(-1, 1, 1, 0, 0)
       
        S3D_Color(150, 150, 0) 'front color
        S3D_Vertex(1, -1, -1, 0, 0)
        S3D_Vertex(1, 1, -1, 0, 0)
        S3D_Vertex(-1, 1, -1, 0, 0)
        S3D_Vertex(-1, -1, -1, 0, 0)
       
        S3D_Color(60, 60, 0) 'left color
        S3D_Vertex(-1, 1, 1, 0, 0)
        S3D_Vertex(-1, -1, 1, 0, 0)
        S3D_Vertex(-1, -1, -1, 0, 0)
        S3D_Vertex(-1, 1, -1, 0, 0)
       
        S3D_Color(60, 60, 0) 'right color
        S3D_Vertex(1, 1, -1, 0, 0)
        S3D_Vertex(1, -1, -1, 0, 0)
        S3D_Vertex(1, -1, 1, 0, 0)
        S3D_Vertex(1, 1, 1, 0, 0)
       
    S3D_End()           
S3D_EndMesh()


'-----------
' MAIN LOOP
'-----------
while not keydown(KEY_ESCAPE, true)
    angleA = (angleA + 90*0.01)%360
    S3D_Clear()
     
    'clear screen
    set color black;cls
    set color white

    'rotate
    S3D_RotateX(rad(90))
    S3D_RotateY(rad(135))
           
    'the whole pillars translation
    S3D_Translate(-43,83,-45)   
   
    for z = 0 to 30 - 1
        for x = 0 to 30 - 1         
           
            'pattern
            d = ((15-x) ^ 2 + (15-z) ^ 2) ^ 0.5
            s = 1.5*sin(d*2+rad(angleA))+2

            S3D_Push()
            S3D_Translate(x*3, 0, z*3)
            S3D_Scale(1.2, s, 1.2)
            S3D_Mesh(cube,0)
            S3D_Pop()                                        
                                                                                                                                                                 
        next
    next
           
    S3D_Render()

    redraw
    fwait 60
wend

Print this item

  Burning polygon mess
Posted by: Marcus - 01-06-2025, 08:41 AM - Forum: NaaLaa 7 Code - Replies (3)

Code:
visible vPolyT = dim(64)

set window "Burning polygon mess", screenw()/screenh()*512, 512, true
set redraw off
set color 0, 8, 32
cls

particles = []
while not keydown(KEY_ESCAPE)
    i = 0
    while i < sizeof(particles)
        if particles[i].Update()  i = i + 1
        else  free key particles, i
    wend
    particles[sizeof(particles)] = FireParticle(width(primary)/2, height(primary) - 64)
    set color 0, 8, 32, 96
    cls
    set additive true
    foreach p in particles p.Draw()
    set additive false
    redraw
    fwait 60
wend

function FireParticle(x, y)
    p = []
    p.pts = []
    for i = 1 to 3 + rnd(4)
        p.pts[sizeof(p.pts)] = (rnd() - 0.5)*48
        p.pts[sizeof(p.pts)] = (rnd() - 0.5)*48
    next
    p.x = x + rnd(32) - 16; p.y = y + rnd(32) - 16
    p.a = rnd(2*PI); p.as = (rnd() - 0.5)*0.2
    p.dx = (rnd() - 0.5)*2; p.dy = (rnd() - 0.75)*2
    p.r = 96; p.g = 80; p.b = 64
    p.fi = 0; p.p = 0
    p.Update = function()
        .x = .x + .dx; .y = .y + .dy
        .r = 8 + (.r - 8)*0.98; .g = 8 + (.g - 8)*0.96; .b = 8 + (.b - 8)*0.9
        .dx = .dx*0.975; .dy = max(.dy - 0.01, - 4)
        .a = .a + .as
        .fi = min(.fi + 0.05, 1); .p = .p + 0.003
        if .p >= 1 return false
        return true
    endfunc
    p.Draw = function()
        set color .r, .g, .b, .fi*(1 - .p)*255
        DrawPolyXForm(.pts, .x, .y, (1 - .p)*2, 2, .a, false)
    endfunc
    return p
endfunc

' n7 needs something like this in its core: 'draw poly xform', 'draw poly image xform'
function DrawPolyXForm(points, x, y, sx, sy, a, scaleFirst)
    if scaleFirst
        for i = 0 to sizeof(points)/2 - 1
            px = points[i*2]*sx; py = points[i*2 + 1]*sy
            vPolyT[i*2] = x + px*cos(a) - py*sin(a)
            vPolyT[i*2 + 1] = y + py*cos(a) + px*sin(a)
        next
    else
        for i = 0 to sizeof(points)/2 - 1
            px = points[i*2]; py = points[i*2 + 1]
            vPolyT[i*2] = x + (px*cos(a) - py*sin(a))*sx
            vPolyT[i*2 + 1] = y + (py*cos(a) + px*sin(a))*sy
        next
    endif
    draw poly vPolyT, true, sizeof(points)/2
endfunc

Print this item

  Things falling down
Posted by: Marcus - 01-04-2025, 09:51 AM - Forum: NaaLaa 7 Code - Replies (4)

I don't know, things falling down.

Code:
set window "Falling things", 480*screenw()/screenh(), 480, true
set redraw off
thing = createimage(63, 63)
set image thing
set color 0, 0, 0
cls
set color 255, 255, 255
draw ellipse 31, 31, 20, 20, true
set image primary
BoxBlur(thing, 8, 8)
set image thing
for y = 0 to height(thing) - 1  for x = 0 to width(thing) - 1
    set color 255, 255, 255, pixel(x, y)[0]
    set pixel x, y
next
set image primary
particles = []
for i = 1 to 256  particles[sizeof(particles)] = Particle(thing)
set color 32, 32, 96
cls
blura = rnd(2*PI)
while not keydown(KEY_ESCAPE)
    blura = blura + 0.01
    foreach p in particles  p.Update()
    set color 32, 32, 96, 64 + sin(blura)*32
    cls
    set additive true
    foreach p in particles  p.Draw()
    set additive false
    redraw
    fwait 60
wend

function Particle(img)
    return [
        img: img,
        x: rnd(width(primary)), y: rnd(height(primary)),
        alpha: 16 + rnd(16),
        scale: 0.25 + rnd()*1.75,
        spd: 0.25 + rnd()*2.75,
        rota: rnd(PI*2), rotspd: rnd()*0.1 - 0.05,
        offsa: rnd(PI*2), offse: rnd(128), offsspd: rnd()*0.1 - 0.05,
        Update: function()
            .y = .y + .spd
            if .y > height(primary) + height(.img)*0.5 then .y = .y - height(primary) - height(.img)
            .rota = (.rota + .rotspd)%(2*PI)
            .offsa = (.offsa + .offsspd)%(2*PI)
        endfunc,
        Draw: function()
            set color 255, 255, 255, .alpha
            draw image xform .img, .x + sin(.offsa)*.offse, .y,
                    .scale*(0.6 + sin(.rota)*0.4), .scale, .offsa, 0.5*width(.img), 0.5*height(.img)
        endfunc
        ]
endfunc

' BoxBlur
' -------
function BoxBlur(img, rx, ry)
    rx = max(int(rx), 0); ry = max(int(ry), 0)
    set image img
    w = width(img); h = height(img)
    data = dim(w, h)

    ' Blur vertically
    for y = 0 to h - 1  for x = 0 to w - 1  data[x][y] = pixeli(img, x, y)
    count = ry*2 + 1
    for x = 0 to w - 1
        sr = 0; sg = 0; sb = 0; sa = 0
        for y = -ry to ry
            p = data[x][y%h];
            sr = sr + Red(p); sg = sg + Green(p); sb = sb + Blue(p); sa = sa + Alpha(p)
        next
        for y = 0 to h - 1
            set color sr/count, sg/count, sb/count, sa/count
            set pixel x, y
            p = data[x][(y - ry)%h]
            sr = sr - Red(p); sg = sg - Green(p); sb = sb - Blue(p); sa = sa - Alpha(p)
            p = data[x][(y + ry + 1)%h]
            sr = sr + Red(p); sg = sg + Green(p); sb = sb + Blue(p); sa = sa + Alpha(p)
        next
    next
    ' Blur horizontally.
    for y = 0 to h - 1  for x = 0 to w - 1  data[x][y] = pixeli(img, x, y)
    count = rx*2 + 1
    for y = 0 to h - 1
        sr = 0; sg = 0; sb = 0; sa = 0
        for x = -rx to rx
            p = data[x%w][y]
            sr = sr + Red(p); sg = sg + Green(p); sb = sb + Blue(p); sa = sa + Alpha(p)
        next
        for x = 0 to w - 1
            set color sr/count, sg/count, sb/count, sa/count
            set pixel x, y
            p = data[(x - rx)%w][y]
            sr = sr - Red(p); sg = sg - Green(p); sb = sb - Blue(p); sa = sa - Alpha(p)
            p = data[(x + rx + 1)%w][y]
            sr = sr + Red(p); sg = sg + Green(p); sb = sb + Blue(p); sa = sa + Alpha(p)
        next
    next
    set image primary

    ' Pixeli helpers.
    function Alpha(c); return int(c/16777216); endfunc
    function Red(c); return int((c/65536))%256; endfunc
    function Green(c); return int((c/256))%256; endfunc
    function Blue(c); return c%256; endfunc
endfunc

Print this item

  Fireworks
Posted by: Marcus - 01-02-2025, 07:53 AM - Forum: NaaLaa 7 Code - Replies (3)

Happy new year, a bit late!

Code:
#win32
set window "2025", 640, 480
set redraw off
particles = []; t = 60
while not keydown(KEY_ESCAPE, true)
    t = t - 1
    if t <= 0
        particles[sizeof(particles)] = Firework(true, particles,
                rnd(width(primary)), height(primary))
        t = 30 + rnd(4)*30
    endif
    i = 0
    while i < sizeof(particles)
        if particles[i].Update()  i = i + 1
        else  free key particles, i
    wend
    set color 0, 0, 0, 16; cls
    foreach p in particles  p.Draw()
    redraw
    fwait 60
wend

function Firework(goingUp, list, x, y)
    if goingUp  a = 225 + rnd(90)
    else  a = rnd(360)
    p = [
        goingUp: goingUp, list: list,
        x: x, y: y,
        dx: cos(rad(a)), dy: sin(rad(a)),
        r: 128 + rnd(128), g: 128 + rnd(128), b: 128 + rnd(128), a: 255, spd: 0.5 + rnd()*0.5,
        Update: function()
            if .goingUp
                .x = .x + .dx*0.5; .y = .y + .dy*4; .dy = .dy + 0.005
                if .dy >= 0.25
                    for i = 1 to 100
                        .list[sizeof(.list)] = Firework(false, .list, .x, .y)
                    next
                    return false
                else
                    return true
                endif
            else
                .x = .x + .dx*.spd; .y = .y + .dy*.spd; .dy = .dy + 0.005
                .a = .a - 1.5*.spd
                return .a > 0
            endif
        endfunc,
        Draw: function()
            set color .r, .g, .b, .a
            draw pixel .x, .y
        endfunc]
    return p
endfunc

Some sound effects would be nice ...

Print this item

  Happy New Year 2025
Posted by: johnno56 - 12-30-2024, 09:14 PM - Forum: Everything else - Replies (3)

Here, downunder, it's new year's eve... Wishing that you all have a wonderful and safe new year!!

J

Print this item

  Start of a Christmas platformer
Posted by: Marcus - 12-28-2024, 09:19 AM - Forum: NaaLaa 7 Code - Replies (2)

Here's the start of a Christmas platform game. I won't finish it, but maybe the source code could be of interest to someone!

All the graphics were generated using Microsoft's free ai image generator thing (its output is in the works folder). It's such a nice thing to use instead of "programmer's art".

Video from other thread: https://naalaa.com/tmp/c2k24.mp4



Attached Files
.zip   c2k24.zip (Size: 8.56 MB / Downloads: 6)
Print this item

  Merry Christmas
Posted by: johnno56 - 12-24-2024, 10:59 AM - Forum: Everything else - Replies (4)

Well... For those of us in the land down under it's Christmas Eve...

Just want to wish everyone a very merry Christmas and an even better New Year!!

J Big Grin  Cool Rolleyes Confused  Big Grin

Print this item