Recent Posts

Pages: 1 [2] 3 4 ... 10
11
Code snippets / Re: Mandala Rock Painting
« Last post by Marcus on September 30, 2017 »
Beautiful :)

Thanks for all your programs, Rick. I'll include lots of your stuff in the next update if you don't mind :)
12
Code snippets / Mandala Rock Painting
« Last post by Rick3137 on September 29, 2017 »
 I was recently on YouTube and ran across some artwork that got me inspired.
 Someone was painting mandala patterns on rocks. I decided to give it a try, (as soon as I find the proper rocks.)
  Before I did any painting, I decided to use NaaLaa to make some patterns to see what they look like.
  This is a first try. It needs work:

13
Code snippets / Re: Super plasma moving things
« Last post by Rick3137 on September 29, 2017 »
 Nice work.

 Your code could give someone a headache.  ::)
14
Tutorials / Re: Tutorials for beginners
« Last post by cvirus on September 27, 2017 »
I would also like to get into NaaLaa so all the tutorials are welcome. Please feel free to point me in the direction of any useful resources for beginners.

Here you have some to beggin with.
http://www.naalaa.com/forum/index.php?topic=29.0
http://www.naalaa.com/forum/index.php?topic=35.0
http://www.naalaa.com/forum/index.php?topic=34.0
15
Tutorials / Re: Tutorials for beginners
« Last post by RodgerGum on September 27, 2017 »
I would also like to get into NaaLaa so all the tutorials are welcome. Please feel free to point me in the direction of any useful resources for beginners.
16
Code snippets / Super plasma moving things
« Last post by Marcus on September 23, 2017 »
Trying to mimic a screen saver I've seen on mac. Looks like beams, but it's particles following moving cubic Bezier curves.

Code: [Select]
import "ifx.lib"
import "Speed.lib"

constant:
W 800
H 600
HW# 400.0
HH# 300.0

visible:
curves?[6]
particles?[500]

hidden:

randomize 3

create image 1, 31, 31
set image 1
set color 0, 0, 0
cls
for y = 0 to 30;
dy# = float(y - 15)
dysqr# = dy*dy
for x = 0 to 30
dx# = float(x - 15)
d# = sqr(dx*dx + dysqr)
if d < 15.0
c = int(32.0*(1.0 - d/15.0))
set color c, c, c
set pixel x, y
endif
next
next
set image primary


set window (screenw() - W)/2, (screenh() - H)/2, W, H
set redraw off

if not IFX_Init() then end

for i = 0 to sizeof(curves) - 1
_InitCurve curves[i]
next

for i = 0 to sizeof(particles) - 1
particles[i].c = -1
next

tick = 0
do
tick = tick + 1
for i = 0 to sizeof(curves) - 1
_UpdateCurve curves[i]
if tick%6 = i
_AddParticle i
endif
next

last = sizeof(particles) - 1
for i = 0 to last
if particles[i].c >= 0
particles[i].p# = particles[i].p# + 0.00225
if particles[i].p# > 1.0
particles[i].c = -1
endif
endif
next

set color 0, 0, 0, 16; cls
_IFX_Blur 16
_DrawParticles

redraw
_SPD_HoldFrame 60
until keydown(27, true)

procedure InitCurve(&curve?)
curve.x0# = HW
curve.y0# = HH
curve.d1# = 100.0 + float(rnd(300))
curve.a1# = float(rnd(360))
curve.x1# = HW + cos(curve.a1#)*curve.d1#
curve.y1# = HH + sin(curve.a1#)*curve.d1#
curve.s1# = float(rnd(100) - 50)*0.02
curve.d2# = 300.0 + float(rnd(300))
curve.a2# = float(rnd(360))
curve.x2# = HW + cos(curve.a2#)*curve.d2#
curve.y2# = HH + sin(curve.a2#)*curve.d2#
curve.s2# = float(rnd(100) - 50)*0.02
curve.d3# = 300.0 + float(rnd(300))
curve.a3# = float(rnd(360))
curve.x3# = HW + cos(curve.a3#)*curve.d3#
curve.y3# = HH + sin(curve.a3#)*curve.d3#
curve.s3# = float(rnd(100) - 50)*0.02
endproc

procedure UpdateCurve(&curve?)
curve.a1# = curve.a1# + curve.s1#
curve.x1# = HW + cos(curve.a1#)*curve.d1#
curve.y1# = HH + sin(curve.a1#)*curve.d1#
curve.a2# = curve.a2# + curve.s2#
curve.x2# = HW + cos(curve.a2#)*curve.d2#
curve.y2# = HH + sin(curve.a2#)*curve.d2#
curve.a3# = curve.a3# + curve.s3#
curve.x3# = HW + cos(curve.a3#)*curve.d3#
curve.y3# = HH + sin(curve.a3#)*curve.d3#
endproc

procedure EvaluateCurve(&curve?, p#, &x#, &y#)
ip# = 1.0 - p
a# = ip*ip*ip
b# = 3.0*ip*ip*p
c# = 3.0*ip*p*p
d# = p*p*p
x = a*curve.x0# + b*curve.x1# + c*curve.x2# + d*curve.x3#
y = a*curve.y0# + b*curve.y1# + c*curve.y2# + d*curve.y3#
endproc

' debug.
procedure PlotCurve(&curve?, points)
step# = 1.0/float(points)
p# = 0.0
x#; y#
for i = 0 to points - 1
_EvaluateCurve curve, p, x, y
set pixel int(x), int(y)
p = p + step
next
endproc

procedure AddParticle(index)
last = sizeof(particles) -1
for i = 0 to last
if particles[i].c < 0 then break
next
if i <= last
particles[i].c = index
particles[i].p# = 0.0
endif
endproc

procedure DrawParticles()
last = sizeof(particles) - 1
set additive true
for i = 0 to last
if particles[i].c >= 0
alpha = int((1.0 - particles[i].p#)*255.0)
set color 64, 128, 255, alpha
x#; y#
_EvaluateCurve curves[particles[i].c], particles[i].p#, x, y
'draw pixel int(x), int(y)
draw image 1, int(x), int(y)
endif
next
endproc
17
Code snippets / Re: Cloudy forces
« Last post by Rick3137 on September 08, 2017 »
 Wow...
 It looks like Hurricane Irma. 180 mph winds.
18
Code snippets / Cloudy forces
« Last post by John on September 08, 2017 »
Random code :)

Code: [Select]
import "Random.lib"
import "ifx.lib"

constant:
FORCE_X 0
FORCE_Y 1
FORCE_R 2
FORCE_DX 3
FORCE_DY 4
FORCE_PARAM 5

PRT_X 0
PRT_Y 1
PRT_DX 2
PRT_DY 3

BG_R 128
BG_G 32
BG_B 0

hidden:

if not IFX_Init() then end

forces#[8][6]
for i = 0 to sizeof(forces, 0) - 1
forces[i][FORCE_X] = RandomFloat(640.0 + 100.0) - 50.0
forces[i][FORCE_Y] = RandomFloat(480.0 + 100.0) - 50.0
forces[i][FORCE_R] = 100.0 + RandomFloat(200.0)
a# = RandomFloat(360.0)
spd# = 2.0 + RandomFloat(3.0)
forces[i][FORCE_DX] = cos(a)*spd
forces[i][FORCE_DY] = sin(a)*spd
forces[i][FORCE_PARAM] = RandomFloat(1.0)
next

particles#[512][4]
for i = 0 to sizeof(particles, 0) - 1
particles[i][PRT_X] = RandomFloat(640.0)
particles[i][PRT_Y] = RandomFloat(480.0)
particles[i][PRT_DX] = 0.0
particles[i][PRT_DY] = 0.0
next

set redraw off

set color BG_R, BG_G, BG_B
cls

do
for i = 0 to sizeof(forces, 0) - 1
forces[i][FORCE_PARAM] = forces[i][FORCE_PARAM] + 0.005
if forces[i][FORCE_PARAM] >= 1.0
forces[i][FORCE_PARAM] = 0.0
forces[i][FORCE_X] = RandomFloat(640.0 + 100.0) - 50.0
forces[i][FORCE_Y] = RandomFloat(480.0 + 100.0) - 50.0
a# = RandomFloat(360.0)
spd# = 2.0 + RandomFloat(3.0)
forces[i][FORCE_DX] = cos(a)*spd
forces[i][FORCE_DY] = sin(a)*spd
forces[i][FORCE_R] = 100.0 + RandomFloat(200.0)
endif
s# = sin(forces[i][FORCE_PARAM]*180.0)
r# = forces[i][FORCE_R]*s
forces[i][FORCE_X] = forces[i][FORCE_X] + forces[i][FORCE_DX]*s
forces[i][FORCE_Y] = forces[i][FORCE_Y] + forces[i][FORCE_DY]*s
r = r*r
for j = 0 to sizeof(particles, 0) - 1
dx# = particles[j][PRT_X] - forces[i][FORCE_X]
dy# = particles[j][PRT_Y] - forces[i][FORCE_Y]
'd# = sqr(dx*dx + dy*dy)
d# = dx*dx + dy*dy
if d < r
k# = (r - d)/r
particles[j][PRT_DX] = particles[j][PRT_DX] + dx*k*0.01
particles[j][PRT_DY] = particles[j][PRT_DY] + dy*k*0.01
endif
next
next

for i = 0 to sizeof(particles, 0) - 1
particles[i][PRT_DX] = particles[i][PRT_DX]*0.99
particles[i][PRT_DY] = particles[i][PRT_DY]*0.99
particles[i][PRT_X] = particles[i][PRT_X] + particles[i][PRT_DX]
particles[i][PRT_Y] = particles[i][PRT_Y] + particles[i][PRT_DY]
if particles[i][PRT_X] < 0.0
particles[i][PRT_X] = 0.0
particles[i][PRT_DX] = abs#(particles[i][PRT_DX])
endif
if particles[i][PRT_Y] < 0.0
particles[i][PRT_Y] = 0.0
particles[i][PRT_DY] = abs#(particles[i][PRT_DY])
endif
if particles[i][PRT_X] > 640.0
particles[i][PRT_X] = 640.0
particles[i][PRT_DX] = -abs#(particles[i][PRT_DX])
endif
if particles[i][PRT_Y] > 480.0
particles[i][PRT_Y] = 480.0
particles[i][PRT_DY] = -abs#(particles[i][PRT_DY])
endif
next

set color BG_R, BG_G, BG_B, 2
cls
set color 255, 200, 128
for i = 0 to sizeof(particles, 0) - 1
' draw pixel int(particles[i][PRT_X]), int(particles[i][PRT_Y])
draw rect int(particles[i][PRT_X]) - 2, int(particles[i][PRT_Y]) - 2, 4, 4, true
next

_IFX_Blur 12

redraw
wait 16
until keydown(27, true)
19
General discussion / Re: Requiring NaaLaa Tutorials
« Last post by Marcus on September 08, 2017 »
Yeah, the built in examples and the stuff that you can find on this forum is it, I'm afraid. But if there's anything you want an example of, just make a post and I'll put something together :) Even if you asked something big like "How do I make a Super Mario Bro's clone?", I'd happily respond with code examples quickly :)

Also, most of the games at http://games.naalaa.com come with full sourcecode, but they might be too complex to start with.
20
General discussion / Re: Requiring NaaLaa Tutorials
« Last post by Rick3137 on September 07, 2017 »
   The best place to learn NaaLaa is the built in examples.
   Turn on the editor, hit the file menu, then hit "Browse Examples"

   I found two old tutorials that might be useful:
Pages: 1 [2] 3 4 ... 10