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: 195
» Forum posts: 1,498

Full Statistics

Online Users
There are currently 82 online users.
» 1 Member(s) | 79 Guest(s)
Bing, Yandex, bobos2002

Latest Threads
BASIC replicator!
Forum: Everything else
Last Post: 1micha.elok
3 hours ago
» Replies: 1
» Views: 7
Backspace Key
Forum: NaaLaa 7 Questions
Last Post: 1micha.elok
3 hours ago
» Replies: 4
» Views: 58
BASIC games, Pascal games...
Forum: Everything else
Last Post: luwal
04-23-2025, 02:57 AM
» Replies: 0
» Views: 28
C64 Game Maker v1.5.5
Forum: Programming
Last Post: luwal
04-22-2025, 04:55 AM
» Replies: 0
» Views: 32
City Fighter
Forum: NaaLaa 7 Code
Last Post: 1micha.elok
04-17-2025, 11:37 PM
» Replies: 7
» Views: 548
RW3
Forum: NaaLaa 7 Code
Last Post: Marcus
04-11-2025, 05:22 AM
» Replies: 3
» Views: 350
ugBASIC! Good BASIC!
Forum: Programming
Last Post: luwal
04-04-2025, 11:35 PM
» Replies: 6
» Views: 720
Happy Birthday
Forum: Everything else
Last Post: johnno56
04-03-2025, 10:52 PM
» Replies: 3
» Views: 446
Pool - Cue Sports (Simple...
Forum: NaaLaa 7 Code
Last Post: johnno56
04-03-2025, 06:41 PM
» Replies: 3
» Views: 479
Nintendo Switch 2
Forum: Everything else
Last Post: johnno56
04-03-2025, 05:41 AM
» Replies: 2
» Views: 347

 
  Mystify
Posted by: johnno56 - 03-07-2025, 01:30 PM - Forum: NaaLaa 7 Code - Replies (7)

Cast your minds back to early Windows days (Win95) and the almost hypnotic Mystify screen saver....

Messing around with a Javascript tutorial to recreate Mystify and figured I might see if N7 could do the same.

I have included the HTML and Javascript files (for comparison) as well as my version for N7...

Feel free to tinker....

J


.zip   mystify.zip (Size: 1.59 KB / Downloads: 8)

Print this item

  Tree
Posted by: 1micha.elok - 03-04-2025, 09:36 AM - Forum: NaaLaa 7 Code - Replies (5)

           
click the image to zoom in

Code:
'---------------------------------------------------------------------
'Tree V2
'
'Steps :
'1.Draw the trunk
'2.At the end of the trunk, split by some angle and draw some branches
'3.Repeat at the end of each branch
'
'REFERENCE
'https://rosettacode.org/wiki/Fractal_tree
'---------------------------------------------------------------------

#win32
set window "Tree V2",600*screenw()/screenh(),600,false
set redraw off

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


'---------------
' MAIN PROGRAM
'---------------
counter = 0
do
    'clear screen
    set color black ; cls
    set color green
   
    'Tree(x1, y1, angle, level,enlarge)
    Tree(width()/2, height()-50, 270, 7,18)
   
    set caret 10,10
    wln "Info Box"
    wln "========================"
    wln "Press RETURN to continue"
    wln "Press ESCAPE to exit"
    wln
    wln counter
    counter = counter + 1
     
    redraw
   
    'pause
    do;wait 1;if keydown(KEY_ESCAPE,true) end;until keydown(KEY_RETURN,true)
loop


'-----------
' FUNCTIONS
'-----------
function Tree(x1, y1, angle, level,enlarge)   
    if level > 0 then
        x2 = x1 + cos(rad(angle)) * level * enlarge + rnd(3,4)
        y2 = y1 + sin(rad(angle)) * level * enlarge + rnd(3,4)
       
        'draw trunk/branch
        trunk(x1,y1,x2,y2,level)
       
        'split branch
        if rnd(0,1) then Tree(x2, y2, angle - rnd(15,48), level - 1,enlarge)
        Tree(x2, y2, angle + rnd(15,48), level - 1,enlarge)
        if rnd(0,1) then Tree(x2, y2, angle, level-1, enlarge)
        if rnd(0,1) then Tree(x2, y2, angle + rnd(10,30), level-1, enlarge)
    endif
endfunc


function trunk(x1,y1,x2,y2,t)
    'reduce thickness
    t = t/1.1

    for x = x1 to x2 step 0.01
        'equation of a line passing through 2 points
        y = (y2-y1)/(x2-x1)*(x-x1)+y1
        draw ellipse x,y,t,t,true                         
    next
endfunc

Print this item

  syntax help / example
Posted by: 1micha.elok - 02-26-2025, 02:35 PM - Forum: NaaLaa 7 Code - Replies (3)

           
click the image to zoom in

Code:
'====================================================================
'HELPME.N7
'- An attempt to make a simple syntax help/example
'- Run on windows system
'- Console mode only
'
'INSTRUCTIONS
'- Place this file in the same folder as NED.EXE
'- Compile and Run helpme.n7
'- Examples
'  Help me : abs[ENTER]        to see the example of absolute value
'  Help me : ex3_loops[ENTER]  to see the example of using loops
'  Help me : dir help[ENTER]   to see functions/commands in examples\help
'  Help me : dir basic[ENTER]  to see functions/commands in examples\basic
'  Help me : exit[ENTER]       to exit this HELPME.N7
'====================================================================

include "file.n7"

path = []

'Main Loop
do
    write "Help me : ";temp=rln()
    if lower(temp) = "exit" then end
    if lower(temp) = "dir help" then system "dir examples\help\*.n7 /w"
    if lower(temp) = "dir basic" then system "dir examples\basic\*.n7 /w"
   
    path[1] = "examples/help/"+temp+".n7"
    path[2] = "examples/basic/"+temp+".n7"
   
    if ReadAllText(path[1])=unset and ReadAllText(path[2])=unset and
        temp<>"dir help" and temp<>"dir basic" then
        pln "Not found"
    elseif temp <> "dir"
        pln
        if ReadAllText(path[1])<>unset then
            pln ReadAllText(path[1])
        else
            pln ReadAllText(path[2])
        endif
    endif
   
    pln "--------------------------------------"
    system "pause"
    system "cls"
loop

Print this item

  Color Wheel
Posted by: 1micha.elok - 02-26-2025, 01:13 AM - Forum: NaaLaa 7 Code - Replies (6)

   
click the image to zoom in

Code:
'color wheel
'converted to N7
'https://rosettacode.org/wiki/Color_wheel#Go

#win32
set window "Color Wheel",500,500,false
set redraw off

visible tau = 2 * PI
visible r,g,b

'--------------
' main program
'--------------
set color 0,0,0; cls
colorWheel()
redraw
while not keydown(KEY_ESCAPE) fwait 60

'-----------
' functions
'------------
function hsb2rgb(hue, sat, bri)
    'convert hue,saturation,brightness to RGB value
    u = int(bri*255 + 0.5)
    if sat = 0 then
        r = u
        g = u
        b = u
    else
        h = (hue - floor(hue)) * 6
        f = h - floor(h)
        p = int(bri*(1-sat)*255 + 0.5)
        q = int(bri*(1-sat*f)*255 + 0.5)
        t = int(bri*(1-sat*(1-f))*255 + 0.5)
       
        select int(h)
        case 0
            r = u; g = t; b = p
        case 1
            r = q; g = u; b = p
        case 2
            r = p ; g = u ; b = t
        case 3
            r = p ; g = q ; b = u
        case 4
            r = t ; g = p ; b = u
        case 5
            r = u ; g = p ; b = q
        endsel
       
    endif
endfunc

function colorWheel()
    'calculate center and radius
    centerX = width()/2
    centerY = height()/2
    radius = centerX-20
    if centerY < radius then
        radius = centerY-20
    endif
   
    'draw pixels for each RGB value
    for y = 0 to height()
        dy = (y - centerY)
        for x = 0 to width()
            dx = (x - centerX)
            dist = sqr(dx*dx + dy*dy)
            if dist <= radius then
                theta = atan2(dy, dx)
                hue = (theta + PI) / tau
                hsb2rgb(hue, 1, 1)
               
                set color r,g,b
                set pixel x,y
            endif
        next
    next
   
endfunc

Print this item

  N7 version 25.02.19 released
Posted by: Marcus - 02-19-2025, 04:43 PM - Forum: Announcements - Replies (4)

A bug fix: https://naalaa.com/n7/N7_250219.zip

Thanks, Kevin, for finding the bug Smile

2025-02-19

  • Fixed a bug that affected 'draw image xform'
  • Added the game Neon Breath to examples/other

Print this item

  xform question/issue?
Posted by: kevin - 02-19-2025, 10:40 AM - Forum: NaaLaa 7 Questions - Replies (4)

Hi, 
I have a question about the xform function please. In the attached example, I have a png image of 100 * 100 pixels (created in GIMP), that I am displaying on screen using the xform function with a scaling of 7. However, rather than displaying an image of 700 * 700 pixels, the image dimensions would appear to be 693 * 693 pixels? I have tried this with image files created in different applications, with the same results.

Am I maybe using the xform function incorrectly, or is there a very small issue with it? This is such a small problem that I was unsure whether to raise it, and I can work around it in my routines, so please do not rush to respond.

All the best - Kevin.

.zip   xform test.zip (Size: 848 bytes / Downloads: 5)

Print this item

  N7 version 25.02.16 released
Posted by: Marcus - 02-16-2025, 02:38 PM - Forum: Announcements - Replies (2)

Here's a new version: https://naalaa.com/n7/N7_250216.zip

2025-02-16

  • Added the 'draw poly xform' command (examples/help/draw_poly_xform.n7)
  • Added the 'draw poly image xform' command (examples/help/draw_poly_image_xform.n7)
  • Added support for loading music and sound effects in mp3 format

The new versions of the polygon commands let you specify position, scaling, rotation and pivot when you draw a polygon, meaning that you can use the same array of points to draw polygons all over the place.

Print this item

  N7 version 25.02.15 released
Posted by: Marcus - 02-15-2025, 09:43 AM - Forum: Announcements - Replies (1)

This is a tiny update. A bigger one will be released soon.

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

2025-02-15

  • wolf3d: Fixed a serious bug and added the function SetSkyTexture (examples\wolf3d_library\example_7.n7)
  • s3d: Minor improvements, such as faster fog rendering

https://naalaa.com/tmp/wolf3d_sky.mp4

Print this item

  The Shadow Master
Posted by: 1micha.elok - 02-14-2025, 10:28 AM - Forum: NaaLaa 7 Code - Replies (4)

Coming Soon ...

   
click the image to zoom-in

Print this item

  Ask help to fix errors (game with wolf3d)
Posted by: 1micha.elok - 02-05-2025, 04:09 AM - Forum: NaaLaa 7 Questions - Replies (7)

Hi, Marcus

You may reply me on weekend when you are not at work. It's not urgent  Big Grin

I am making an animation of a night driving with the wolf3d library.

           
click the images to zoom in

Could you please help me :
 - I don't know how to fixed some bugs
   1. the car is not turned smoothly on turn#4 and turn#3
   2. the zombie animation is overlapped
 - I don't know how to put the sky image as a background ( not as a tileset)


Code:
'====================================================
'
' ......
'
' Acknowlegements :
' -Haunted Night by Hot Dope
'  https://pixabay.com/music/search/mood/scary/
' -Zombie
'  https://opengameart.org/content/zombie-rpg-sprites
'====================================================

'----------------
' INITIALIZATION
'----------------
'#win32
set window "The Shadow", 1000,500,false
set redraw off; set mouse off

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

' Player.
vPlayerAngle = 0
vPlayerX = 0
vPlayerZ = 0

' Load map.
flags = w3d.LoadN6Map("assets/map.txt")

' Player.
vPlayerX = flags[0].x + 0.5
vPlayerZ = flags[0].z + 0.5
vPlayerAngle = flags[0].angle

' Zombie
zombie = loadimage("assets/zombie7.png",3,4)
vCrossFrameCounter = 0
vCrossFrame = 0

' Sky
sky = loadimage("assets/sky.jpg")

'initial value
start = true
haunted = loadmusic("assets/haunted night.wav")
play music haunted,1

'---------------
' MAIN PROGRAM
'---------------
do
    'it's a bug. the sky is not displayed
    draw image sky,0,0

    'start moving
    if vPlayerZ = 13.5 and vPlayerX < 19 then
        vPlayerX = min(vPlayerX + 0.5/10,18.5)

        'turn #4   
        vPlayerAngle = 0 'it's a bug. it should turn smoothly

    endif

    'turn #1   
    if vPlayerX = 18.5 then vPlayerAngle = max(vPlayerAngle - 2.0,-90) 'turn smoothly
    if vPlayerX = 18.5 and vPlayerZ > 2.5 then vPlayerZ = max(vPlayerZ - 0.5/10,2.5)

    'turn #2
    if vPlayerZ = 2.5 then vPlayerAngle = max(vPlayerAngle - 2.0,-180) 'turn smoothly
    if vPlayerZ = 2.5 then vPlayerX = max(vPlayerX - 0.5/10,1.5)

    'turn #3
    if vPlayerX = 1.5 then vPlayerAngle = -270 'it's a bug. it should turn smoothly  
    if vPlayerX = 1.5 then vPlayerZ = min(vPlayerZ + 0.5/10,13.5)
   
    ' zombie, it'a bug, the zombie animation is overlapped
    if vCrossFrameCounter = 0
        vCrossFrame = (vCrossFrame + 1)%12
        dst = w3d.n6.imgDefs[7].img 
        set image dst
        draw image zombie, 0, 0, vCrossFrame
        set image primary
    endif
    vCrossFrameCounter = (vCrossFrameCounter + 1)%5
       
    'render
    w3d.Render(vPlayerX, vPlayerZ, rad(vPlayerAngle))
   
    'info box
    set color 255,255,255
    set caret 10,10
    wln "x = "+vPlayerX
    wln "z = "+vPlayerZ
    wln "a = "+vPlayerAngle

    redraw
    fwait 60
   
    'pause
    if start then
        wln "Press SPACE BAR to continue"
        redraw
        do;wait 1; until keydown(KEY_SPACE,true)
        start = false
    endif
   
until keydown(KEY_ESCAPE)

free music haunted



Attached Files
.zip   the shadow.zip (Size: 2.14 MB / Downloads: 5)
Print this item