Welcome, Guest |
You have to register before you can post on our site.
|
Forum Statistics |
» Members: 37
» Latest member: Ludwig
» Forum threads: 195
» Forum posts: 1,498
Full Statistics
|
Online Users |
There are currently 65 online users. » 0 Member(s) | 64 Guest(s) Bing
|
|
|
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 ...
|
|
|
Sprite Editor |
Posted by: johnno56 - 12-24-2024, 08:55 AM - Forum: NaaLaa 7 Questions
- Replies (2)
|
 |
I have a listing (N5 or N6 ?) for a sprite editor that I am trying to convert to N7.
There is a command that is used in converting the colour detected by the mouse into an RGB format... That command is 'SHR' (SHift register Right).
Reason: Using pixeli(x, y), to detect the colour, produces a number like:
black = 4278190080
white = 4294967295
red = 4294901760
green = 4278255360
blue = 4278190335
To convert to RGB three functions were used: n_c is the colour detected
rem ---------------------------------------------------
rem Convert to RGB format
rem ---------------------------------------------------
function getB(n_c)
return n_c AND 255
endfunc
function getG(n_c)
return (n_c SHR 8) AND 255
endfunc
function getR(n_c)
return (n_c SHR 16) AND 255
endfunc
I need to know if there is a method to replace SHR.
|
|
|
GOLDEN WAVES (repost and modified) |
Posted by: 1micha.elok - 12-22-2024, 12:59 PM - Forum: NaaLaa 7 Code
- Replies (9)
|
 |
THE SIXTH FORM OF GOLDEN WAVES (repost and modified)
click image to zoom in
CONTROL KEYS :
ESC = quit
UP, DOWN = amplitudo value,0-100
LEFT,RIGHT = chaos value,0-2
PRESET FORMS : (Press 1-5)
1 = calm
2 = ripple
3 = shaked
4 = disturbed
5 = irregular
LOGS :
- Posted by johnno1956 on the naalaa forum.
"Here is a short graphical demo that started with Basic256, sdlBasic and RCBasiWhy not N7?"
- Modified on Dec 2024 by Micha
Add interactivity
Code: '=====================================================
' THE SIXTH FORM OF GOLDEN WAVES (repost and modified)
'
' CONTROL KEYS :
' ESC = quit
' UP, DOWN = amplitudo value,0-100
' LEFT,RIGHT = chaos value,0-2
'
' PRESET FORMS :
' 1 = calm
' 2 = ripple
' 3 = shaked
' 4 = disturbed
' 5 = irregular
'
' LOGS :
' - Posted by johnno1956 on the naalaa forum.
' "Here is a short graphical demo that
' started with Basic256, sdlBasic and RCBasic
' Why not N7?"
' - Modified on Dec 2024 by Micha
' Add interactivity
'=====================================================
'set window size
#win32
set window "The 6th Form of Golden Waves", 600, 470
set redraw off
'color definition
black = [0,0,0]
leftgold = [60, 60, 0]
rightgold = [150,150,0]
white = [255,255,255]
'initial value
amplitudo = 0
chaos = 0
name = "calm"
'main loop
do
for t = 10 to 60 step 0.1
'clear screen
set color black; cls
'infobox
set color white
set caret 10,10
wln "Amplitudo = "+amplitudo
wln "Chaos = "+chaos
wln "Name = "+name
for y1 = 0 to 24
for x1 = 0 to 24
'coordinates
x = (12 * (24 - x1)) + (12 * y1)
y = (-6 * (24 - x1)) + (6 * y1) + 300
d = ((10 - x1) ^ 2 + (10 - y1) ^ 2) ^ 0.5
'controls
if keydown(KEY_UP,true) then
amplitudo = min(amplitudo+1,100)
name = "custom"
elseif keydown(KEY_DOWN,true) then
amplitudo = max(amplitudo-1,0)
name = "custom"
elseif keydown(KEY_RIGHT,true) then
chaos = min(chaos+0.01,2)
name = "custom"
elseif keydown(KEY_LEFT,true) then
chaos = max(chaos-0.01,0)
name = "custom"
endif
if keydown(KEY_1,true) then
amplitudo = 0
chaos = 0
name = "calm"
elseif keydown(KEY_2,true) then
amplitudo = 3
chaos = 1
name = "ripple"
elseif keydown(KEY_3,true) then
amplitudo = 25
chaos = 0.1
name = "shaked"
elseif keydown(KEY_4,true) then
amplitudo = 60
chaos = 0.3
name = "disturbed"
elseif keydown(KEY_5,true) then
amplitudo = 100
chaos = 2
name = "irregular"
endif
'form/pattern
h = amplitudo*sin(d * chaos + t) + 70
'on top
set color [100 + h, 100 + h, h]
gold = [x, y - h, x + 10, y + 5 -h, x + 20, y - h, x + 10, y - 5 - h]
draw poly gold, 1
'left side
set color leftgold
gold = [x, y - h, x + 10, y + 5 - h, x + 10, y, x, y - 5]
draw poly gold, 1
'right side
set color rightgold
gold = [x + 10, y + 5 - h, x + 10, y, x + 20, y - 5, x + 20, y - h]
draw poly gold, 1
'ESC to quit
if keydown(KEY_ESCAPE) end
next
next
redraw
fwait 30
next
loop
|
|
|
Clock (repost and modified) |
Posted by: 1micha.elok - 12-21-2024, 04:12 AM - Forum: NaaLaa 7 Code
- Replies (4)
|
 |
Clock (repost and modified)
Repost from an old archive N7 Marcus
Date : 10-15-2022
Code: '====================================
'Clock (repost and modified)
'
'Repost from an old archive N7 Marcus
'Date : 10-15-2022
'
'Control key
'- ESC to quit
'====================================
'set window size
#win32
set window "Clock", 400, 400
set redraw off
'color definition
gray = [200,200,200]
black = [0,0,0]
white = [255,255,255]
red = [255,0,0]
yellow = [255,255,0]
green = [0,255,0]
orange = [255,165,0]
'font
bigfont = createfont("arial", 48, true, false, false, true)
'main loop
do
'background
set color black;cls
t = datetime()
'clock center
centerx = width()/2
centery = height()/3+20
'clock border
set color white
rx = width()/3
ry = height()/3
draw ellipse centerx, centery, rx, ry, true
'clock body
set color rnd(150,200),rnd(150,200),rnd(150,200) 'random color
draw ellipse centerx, centery, rx - 4, ry - 4, true
'clock marks
set color yellow
for i = 0 to 11
draw ellipse centerx+(rx-15)*cos(30/180*PI*i),centery+(ry-15)*sin(30/180*PI*i),4,4,true
next
set color black
i = t.hour-3
draw ellipse centerx+(rx-15)*cos(30/180*PI*i),centery+(ry-15)*sin(30/180*PI*i),6,6,true
'arrow second
set color red
a = rad(360*t.second/60 - 90)
DrawThickLine(centerx, centery, centerx + cos(a)*(centerx*0.6 - 4), centery + sin(a)*(centery*0.6 - 4), 2)
'arrow long hand
set color black
a = rad((t.minute/5*30) - 90)
DrawArrow(centerx, centery, centerx + cos(a)*(centerx*0.6 - 4), centery + sin(a)*(centery*0.6 - 4), 6)
'arrow short hand
set color black
a2 = rad(360*(t.hour%12)/12 - 90)+rad(((t.minute/5*30)+5 - 90)/12)
DrawArrow(centerx, centery, centerx + cos(a2)*(centerx*0.3 - 4), centery + sin(a2)*(centery*0.3 - 4), 5)
'clock center
set color black
draw ellipse centerx, centery, 8, 8, true
'digital clock
set color green
set font bigfont
set caret width()/2,height()-70
if len(t.hour) = 1 then
myhour = "0"+t.hour
else
myhour = t.hour
endif
if len(t.minute) = 1 then
myminute = "0"+t.minute
else
myminute = t.minute
endif
if len(t.second) = 1 then
mysecond = "0"+t.second
else
mysecond = t.second
endif
center myhour+":"+myminute+":"+mysecond
if keydown(KEY_ESCAPE,true) then end
redraw
fwait 1
loop
'functions
function DrawThickLine(x1, y1, x2, y2, thickness)
dx = x2 - x1
dy = y2 - y1
k = 0.5*thickness/sqr(dx*dx + dy*dy)
ddx = -dy*k
ddy = dx*k
p = [
round(x1 + ddx), round(y1 + ddy),
round(x2 + ddx), round(y2 + ddy),
round(x2 - ddx), round(y2 - ddy),
round(x1 - ddx), round(y1 - ddy)]
draw poly p, true
endfunc
function DrawArrow(x1, y1, x2, y2, thickness)
dx = x2 - x1
dy = y2 - y1
k = 0.5*thickness/sqr(dx*dx + dy*dy)
ddx = -dy*k
ddy = dx*k
p = [
x1, y1,
x1*0.25 + x2*0.75 - ddx, y1*0.25 + y2*0.75 - ddy,
x2, y2,
x1*0.25 + x2*0.75 + ddx, y1*0.25 + y2*0.75 + ddy]
draw poly p, true
endfunc
|
|
|
Canabis Curve (repost) |
Posted by: 1micha.elok - 12-20-2024, 02:48 PM - Forum: NaaLaa 7 Code
- Replies (1)
|
 |
Cannabis curve
repost from old archive
date:08-07-2022
Code: ' ------------------------------------------------
' Cannabis curve
' repost from old archive N7 Marcus
' date:08-07-2022
' see also
' https://www.facebook.com/groups/2057165187928233
'
' control key :
' ESC to quit
' ------------------------------------------------
'set window size
#win32
set window "Cannabis curve", 640, 480
set redraw off
randomize time()
'color definition
black = [0,0,0]
green = [0,200,0]
white = [255,255,255]
'initial value
px = 0; py = 0
detail = 0.01
'Main loop
do
set color black; cls 'clear screen
set color rnd(100,255),rnd(50,255),rnd(50,255) 'random color of canabis curve
for a = 0 to 2*PI step detail
'calculate coordinate
x = width()/2 + 100*(sin(a) + 1)*cos(a)*(9*cos(8*a)/10 + 1)*(cos(24*a)/10 + 1)*(cos(200*a)/10 + 9/10)
y = 64+100*sin(a)*(sin(a) + 1)*(9*cos(8*a)/10 + 1)*(cos(24*a)/10 + 1)*(cos(200*a)/10 + 9/10)
'each time, continue draw line from the last point
if a > 0 then
draw line px, py, x, y
draw line px-5,py-5,x-5,y-5
draw line px-10,py-10,x-10,y-10
draw line px-15,py-15,x-15,y-15
endif
px = x; py = y 'swap value
'Escape to quit
if keydown(KEY_ESCAPE,true) then end
fwait 100
redraw
next
fwait 100
loop
|
|
|
Just Another Interpreted Language |
Posted by: 1micha.elok - 12-12-2024, 12:19 PM - Forum: Programming
- Replies (1)
|
 |
Under Snow, Mistletoe, and Code
It was December 2018, a time when snow blanketed Drottninggatan ninggalike a quilt, muffling the sounds of the bustling world. The holiday spirit filled the air—shops glimmered with golden lights, the scent of mulled wine and roasted chestnuts danced through the frosty breeze, and mistletoe hung from every other doorframe, daring the shy to embrace the season's magic.
But in a small, cozy apartment overlooking the lake Vattern, Marcus was immersed in something far from festive. Instead of tinsel or wrapping paper, his desk was strewn with notebooks, half-empty coffee mugs, and a laptop that hummed faintly under its own overuse. The screen glowed with lines of text—cryptic to some, revolutionary to Marcus. He was building a language. Not one of syntax and grammar for poets or linguists, but a new programming language he called JAIL—short for "Just Another Interpreted Language."
It wasn’t the most glamorous name, but Marcus found the humor in it. "Everyone's in some kind of jail when they're coding," he’d joked to his friends when he pitched the idea. His vision was simple yet ambitious: a minimalist, flexible scripting language that could execute quickly without bogging down the programmer with unnecessary complexity.
A Cozy Cage for Creativity
The snow had begun to fall heavier outside, but Marcus was too deep into his work to notice. The heart of JAIL was almost complete. He had crafted a unique syntax that blended the readability of NaaLaa and Lua with the expressive power of C.
Code: /*
* File: input.txt
* ---------------
*/
system := import("system.txt");
string := import("string.txt");
/* Ask for name and use rln (read line) to get input from user. */
system.write("Enter your name, dude: ");
name = system.rln();
/* Annoy user until it enters y or Y. */
system.write("Your name is " + name + "? (y/n) ");
while (string.lower(string.charAt(system.rln(), 0)) <> "y") {
system.wln("You have to answer yes, or this program will never end!");
system.write("So, is " + name + " your name? (y/n) ");
}
A Visitor in the Cold
As Marcus wrestled with a bug in the interpreter, there was a knock at his door. Frowning, he glanced at the clock—it was nearly midnight. Who would be visiting now? He shuffled to the door, stepping over scattered papers, and opened it to find an older woman standing under the flickering hallway light. She wore a thick red coat and carried a basket filled with what looked like freshly baked cookies.
“Mistletoe,” she said with a smile, pointing upward. Marcus blinked, realizing there was indeed a sprig of mistletoe hanging above the doorframe.
“Oh, uh, right,” he stammered awkwardly. The woman chuckled and handed him a cookie.
“I’m Mrs. Elsa from down the hall. Just thought I’d spread a bit of cheer. Been hearing you typing away for weeks now. Whatever you’re working on, don’t forget to enjoy the holidays.”
Marcus smiled for the first time in hours. “Thanks, Mrs. Elsa. I’ll, uh, try.”
She nodded, leaving him with the cookie and a faint sense of warmth he hadn’t felt in weeks.
A Breakthrough
Back at his desk, the cookie in hand, Marcus stared at the line of code that had been driving him crazy. Mrs. Elsa’s words echoed in his head. He realized he’d been so focused on making the language perfect that he’d forgotten why he was doing it in the first place: to make coding feel fun again. He relaxed, took a bite of the cookie, and typed:
jail
Code: do enjoy_holidays():
system.write ("Take a break, Marcus.")
Of course, the interpreter spat out an error—JAIL didn’t yet support recursion in user-defined functions. But that bug, he realized, was tied to the same issue he’d been wrestling with for hours. With a newfound clarity, he rewrote the core logic. Snow continued to fall outside, mistletoe hung silently above the door, and JAIL grew closer to completion.
A Gift to the World
By the time the new year arrived, JAIL was ready for its first public test. Marcus shared the project in the deep web as NaaLaa Creator with an introductory note: “Coding should be fun. Here’s my attempt at making it so.”
Though it never became the next Python or NaaLaa, JAIL found its way into the hearts of a small but passionate community. Developers shared tips and tricks, extending the language with plugins and features Marcus had never dreamed of.
Every December, the JAIL community gathered virtually to reminisce about its quirky origins. Marcus always made sure to hang mistletoe by his desk—not as a promise of romance, but as a reminder of the kindness and joy that inspired his work under the snow six years ago.
Note :
The author remains an enigmatic figure, shrouded in an impenetrable veil of anonymity, his identity concealed within layers of obscurity, thus perpetuating an aura of mystery that both fascinates and confounds those who seek to unravel the essence of his existence.
|
|
|
|