Recent Posts

Pages: [1] 2 3 ... 10
1
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
2
Code snippets / Re: Cloudy forces
« Last post by Rick3137 on September 08, 2017 »
 Wow...
 It looks like Hurricane Irma. 180 mph winds.
3
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)
4
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.
5
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:
6
General discussion / Requiring NaaLaa Tutorials
« Last post by NLUser60 on September 06, 2017 »
Some people have asked this before, are there any tutorials for a beginner like me to learn? Just asking though?
7
Libraries / Re: GLOOM, a new raycaster library
« Last post by Marcus on August 03, 2017 »
Aye, just set the last parameter for GLOOM_SetFog to 0 :)  Just trying to make it look retro:er with that fog effect.
8
Libraries / Re: GLOOM, a new raycaster library
« Last post by PacoMan on August 02, 2017 »
Awesomeness! I defeated the mighty box boss. :) Way better than tf2. :P
Fire-zombies are scary!

Though the hardness of the fog disturbs me a bit, the rest of the game is so good looking. Would it be possible to maybe interpolate it in some way so you get rid of the very hard and noticeable edges/zones of the fog?
9
Showcase / Re: Music Keyboard V2
« Last post by Rick3137 on July 29, 2017 »
   With this version, I use NaaLaa to make the notes before using them.
Code: [Select]
visible:
  SampleRate = 44100

  data#[ 44110 ]
  aa$ = "c4.wav"
  freq1# = 261.63

 
 event = 1; Sound = 0 ; button = 0 ; mzone = 0
  mx; my; z1 = 0 ; z2 = 0 ; z3 = 0
 
ky[] = [ 0,1,2,1,2,1,1,2,1,2,1,2,1,1,2,1,2,1,1,2,1,2,1,2,1,1,2,1,2,1,1,2,1,2,1,2,1,1,2,1,2,1,1,2,1,2,1,2,1 ]
 
randomize time()
hidden:
set redraw off
procedure start()
 ThisIsAPlaceHolder = 1
endproc
set window 0, 0, 1350, 700
proc HowToPlay
proc MakeKeys

proc Setup
proc SetupPieces
proc SetupPieces2
'proc SetupBlackKeys

proc SetupSound
proc SetupZones

   set color 0,0,0
   cls
   set color 255,255,255

    do
         wait 100
   
         set color 0,0,0
         cls;
         set color 255,255,255
                mx= mousex()
                my= mousey()
              z2 = z1
              z1 = zone(mx,my)
              if z1 <> z2 and z1 > 0
                 Sound = z1
                 play sound Sound
                 mzone = z1
              endif
 
         proc DrawBoard

         proc DisplayPieces
         proc PrintText
     
        redraw
    until event = 2
 
  end

procedure MakeKeys()

 for cnt = 1 to 48
     if cnt = 1
         aa = "data\c3.wav"
         freq1 = 130.81
     endif
     if cnt = 2
         aa = "data\c3Sharp.wav"
         freq1 = 138.59
     endif
     if cnt = 3
         aa = "data\d3.wav"
         freq1 = 146.83
     endif
     if cnt = 4
         aa = "data\d3Sharp.wav"
         freq1 = 155.56
     endif
     if cnt = 5
         aa = "data\e3.wav"
         freq1 = 164.81
     endif
     if cnt = 6
         aa = "data\f3.wav"
         freq1 = 174.61
     endif
     if cnt = 7
         aa = "data\f3Sharp.wav"
         freq1 = 185.0
     endif
     if cnt = 8
         aa = "data\g3.wav"
         freq1 = 196.0
     endif
     if cnt = 9
         aa = "data\g3Sharp.wav"
         freq1 = 207.65
     endif
     if cnt = 10
         aa = "data\a3.wav"
         freq1 = 220.0
     endif
     if cnt = 11
         aa = "data\a3Sharp.wav"
         freq1 = 233.08
     endif
     if cnt = 12
         aa = "data\b3.wav"
         freq1 = 246.94
     endif

     if cnt = 13
         aa = "data\c4.wav"
         freq1 = 261.63
     endif
     if cnt = 14
         aa = "data\c4Sharp.wav"
         freq1 = 277.18
     endif
     if cnt = 15
         aa = "data\d4.wav"
         freq1 = 293.66
     endif
     if cnt = 16
         aa = "data\d4Sharp.wav"
         freq1 = 311.13
     endif
     if cnt = 17
         aa = "data\e4.wav"
         freq1 = 329.63
     endif
     if cnt = 18
         aa = "data\f4.wav"
         freq1 = 349.23
     endif
     if cnt = 19
         aa = "data\f4Sharp.wav"
         freq1 = 369.99
     endif
     if cnt = 20
         aa = "data\g4.wav"
         freq1 = 392.0
     endif
     if cnt = 21
         aa = "data\g4Sharp.wav"
         freq1 = 415.30
     endif
     if cnt = 22
         aa = "data\a4.wav"
         freq1 = 440.0
     endif
     if cnt = 23
         aa = "data\a4Sharp.wav"
         freq1 = 466.16
     endif
     if cnt = 24
         aa = "data\b4.wav"
         freq1 = 493.88
     endif

     if cnt = 25
         aa = "data\c5.wav"
         freq1 = 523.26
     endif
     if cnt = 26
         aa = "data\c5Sharp.wav"
         freq1 = 554.36
     endif
     if cnt = 27
         aa = "data\d5.wav"
         freq1 = 587.32
     endif
     if cnt = 28
         aa = "data\d5Sharp.wav"
         freq1 = 622.26
     endif
     if cnt = 29
         aa = "data\e5.wav"
         freq1 = 659.26
     endif
     if cnt = 30
         aa = "data\f5.wav"
         freq1 = 698.46
     endif
     if cnt = 31
         aa = "data\f5Sharp.wav"
         freq1 = 739.98
     endif
     if cnt = 32
         aa = "data\g5.wav"
         freq1 = 784.0
     endif
     if cnt = 33
         aa = "data\g5Sharp.wav"
         freq1 = 830.6
     endif
     if cnt = 34
         aa = "data\a5.wav"
         freq1 = 880.0
     endif
     if cnt = 35
         aa = "data\a5Sharp.wav"
         freq1 = 932.32
     endif
     if cnt = 36
         aa = "data\b5.wav"
         freq1 = 987.76
     endif

     if cnt = 37
         aa = "data\c6.wav"
         freq1 = 1046.52
     endif
     if cnt = 38
         aa = "data\c6Sharp.wav"
         freq1 = 1108.72
     endif
     if cnt = 39
         aa = "data\d6.wav"
         freq1 = 1174.64
     endif
     if cnt = 40
         aa = "data\d6Sharp.wav"
         freq1 = 1244.52
     endif
     if cnt = 41
         aa = "data\e6.wav"
         freq1 = 1318.52
     endif
     if cnt = 42
         aa = "data\f6.wav"
         freq1 = 1396.92
     endif
     if cnt = 43
         aa = "data\f6Sharp.wav"
         freq1 = 1479.96
     endif
     if cnt = 44
         aa = "data\g6.wav"
         freq1 = 1568.0
     endif
     if cnt = 45
         aa = "data\g6Sharp.wav"
         freq1 = 1661.2
     endif
     if cnt = 46
         aa = "data\a6.wav"
         freq1 = 1760.0
     endif
     if cnt = 47
         aa = "data\a6Sharp.wav"
         freq1 = 1864.64
     endif
     if cnt = 48
         aa = "data\b6.wav"
         freq1 = 1975.52
     endif
      proc MakeNotes aa$, freq1
next

endproc

procedure MakeNotes( note$,freq# )
   
  ' freq# = 261.63 for c4
   ' period is the number of samples per cycle
   period# = 44100.0 / freq
   ' interval is the time between samples, measured in degrees.
   interval# = 360.0/period
   a# = 0.0
   vol# = 1.0
   for i = 0 to 44099
      value# = sin(a)
    data[i] = value * vol
    a = a + interval
    ' Fade out.
    vol = vol - 1.0/44100.0
   next
   ' Write file
   _WriteWave note, 44100
endproc




procedure SetupZones()
       
           create zone 1,110,380,40,70
           create zone 3,150,380,40,70
           create zone 5,190,380,40,70
           create zone 6,230,380,40,70
           create zone 8,270,380,40,70
           create zone 10,310,380,40,70
           create zone 12,350,380,40,70
           create zone 13,390,380,40,70
           create zone 15,430,380,40,70
           create zone 17,470,380,40,70
           create zone 18,510,380,40,70
           create zone 20,550,380,40,70
           create zone 22,590,380,40,70
           create zone 24,630,380,40,70

           create zone 25,670,380,40,70
           create zone 27,710,380,40,70
           create zone 29,750,380,40,70
           create zone 30,790,380,40,70
           create zone 32,830,380,40,70
           create zone 34,870,380,40,70
           create zone 36,910,380,40,70
           create zone 37,950,380,40,70
           create zone 39,990,380,40,70
           create zone 41,1030,380,40,70
           create zone 42,1070,380,40,70
           create zone 44,1110,380,40,70
           create zone 46,1150,380,40,70
           create zone 48,1190,380,40,70

           create zone  2,140,300,20,80
           create zone  4,180,300,20,80

           create zone  7,260,300,20,80
           create zone  9,300,300,20,80
           create zone  11,340,300,20,80

           create zone  14,420,300,20,80
           create zone  16,460,300,20,80

           create zone  19,540,300,20,80
           create zone  21,580,300,20,80
           create zone  23,620,300,20,80

           create zone  26,140 + 560,300,20,80
           create zone  28,180 + 560,300,20,80

           create zone  31,260 + 560,300,20,80
           create zone  33,300 + 560,300,20,80
           create zone  35,340 + 560,300,20,80

           create zone  38,420 + 560,300,20,80
           create zone  40,460 + 560,300,20,80

           create zone  43,540 + 560,300,20,80
           create zone  45,580 + 560,300,20,80
           create zone  47,620 + 560,300,20,80


endproc

procedure SetupPieces()
      for a = 1 to 48
           
         if ky[a] = 1
            create image a,38,150
            set color 250,250,255
            set image a
            draw rect 0,0,38,150,1
         endif
         if ky[a] = 2
            create image a,18,80
            set color 5,10,15
            set image a
            draw rect 0,0,18,80,1
         endif

      next

  set image primary
  set color 255,255,255

endproc

procedure SetupBlackKeys()
      for a = 51 to 99
         create image a,18,80
      next
  for a = 51 to 99
     set color 10,20,30
     set image a
     draw rect 0,0,18,80,1
  next
  set image primary
  set color 255,255,255

endproc

procedure SetupPieces2()
   for a = 1 to 50
       set image a
     set color 0,0,0

     draw line 0,0,38,0
     draw line 0,0,0,150

     draw line 37,0,37,150
     draw line 0,149,38,149

    next
  set image primary
  set color 255,255,255

endproc

 

procedure Setup()
   rem Setup Variables and other things here.
   gameover = 0
   event = 1
endproc

procedure SetupSound()
     load sound 1,"data\c3.wav"
     load sound 2,"data\c3Sharp.wav"
     load sound 3,"data\d3.wav"
     load sound 4,"data\d3Sharp.wav"
     load sound 5,"data\e3.wav"
     load sound 6,"data\f3.wav"
     load sound 7,"data\f3Sharp.wav"
     load sound 8,"data\g3.wav"
     load sound 9,"data\g3Sharp.wav"
     load sound 10,"data\a3.wav"
     load sound 11,"data\a3Sharp.wav"
     load sound 12,"data\b3.wav"
     load sound 13,"data\c4.wav"
     load sound 14,"data\c4Sharp.wav"
     load sound 15,"data\d4.wav"
     load sound 16,"data\d4Sharp.wav"
     load sound 17,"data\e4.wav"
     load sound 18,"data\f4.wav"
     load sound 19,"data\f4Sharp.wav"
     load sound 20,"data\g4.wav"
     load sound 21,"data\g4Sharp.wav"
     load sound 22,"data\a4.wav"
     load sound 23,"data\a4Sharp.wav"
     load sound 24,"data\b4.wav"
     load sound 25,"data\c5.wav"
     load sound 26,"data\c5Sharp.wav"
     load sound 27,"data\d5.wav"
     load sound 28,"data\d5Sharp.wav"
     load sound 29,"data\e5.wav"
     load sound 30,"data\f5.wav"
     load sound 31,"data\f5Sharp.wav"
     load sound 32,"data\g5.wav"
     load sound 33,"data\g5Sharp.wav"
     load sound 34,"data\a5.wav"
     load sound 35,"data\a5Sharp.wav"
     load sound 36,"data\b5.wav"
     load sound 37,"data\c6.wav"
     load sound 38,"data\c6Sharp.wav"
     load sound 39,"data\d6.wav"
     load sound 40,"data\d6Sharp.wav"
     load sound 41,"data\e6.wav"
     load sound 42,"data\f6.wav"
     load sound 43,"data\f6Sharp.wav"
     load sound 44,"data\g6.wav"
     load sound 45,"data\g6Sharp.wav"
     load sound 46,"data\a6.wav"
     load sound 47,"data\a6Sharp.wav"
     load sound 48,"data\b6.wav"

     
endproc

procedure DrawBoard()
 
  rem cls
  set color 200,200,255
    draw rect 20,20,1300,665,1


endproc

procedure DisplayPieces()
   set color 255,255,255
  ' OK I may have too many images. I needed 2.  My bad habits keep me from getting confused. When I try the "right" way, confused is what I get.
           draw image 1,110,300
           draw image 3,150,300
           draw image 5,190,300
           draw image 6,230,300
           draw image 8,270,300
           draw image 10,310,300
           draw image 12,350,300
           draw image 13,390,300
           draw image 15,430,300
           draw image 17,470,300
           draw image 18,510,300
           draw image 20,550,300
           draw image 22,590,300
           draw image 24,630,300

           draw image 25,670,300
           draw image 27,710,300
           draw image 29,750,300
           draw image 30,790,300
           draw image 32,830,300
           draw image 34,870,300
           draw image 36,910,300
           draw image 37,950,300
           draw image 39,990,300
           draw image 41,1030,300
           draw image 42,1070,300
           draw image 44,1110,300
           draw image 46,1150,300
           draw image 48,1190,300

           draw image 2,140,300
           draw image 4,180,300

           draw image 7,260,300
           draw image 9,300,300
           draw image 11,340,300

           draw image 14,420,300
           draw image 16,460,300

           draw image 19,540,300
           draw image 21,580,300
           draw image 23,620,300

           draw image 26,140 + 560,300
           draw image 28,180 + 560,300

           draw image 31,260 + 560,300
           draw image 33,300 + 560,300
           draw image 35,340 + 560,300

           draw image 38,420 + 560,300
           draw image 40,460 + 560,300

           draw image 43,540 + 560,300
           draw image 45,580 + 560,300
           draw image 47,620 + 560,300

endproc

procedure PrintText()
      set caret 30,50
      write " MouseX = " ; wln str$(mx)
      write " MouseY = " ; wln str$(my)
      write " Zone = " ; wln str$(Sound)

endproc


procedure HowToPlay()
  a = 1
  create font 0, "arial", 24

  set color 255,255,255
  set caret 200,100
  wln "  The object of this puzzle is : "
  wln " to move all of the pieces from the Right Side Board to the Left Side Board."
  wln " "
  wln "  Each piece has 4 colors and when you place the piece on the left side board,  "
  wln " each color should match the color of the piece that it touches. "
  wln " "
  wln " "
  wln "  "
  wln "  "
  wln "  "
  wln "  "
  wln "  "
  wln "  "
  wln "  "
  wln "  "
  wln " Hit any key to continue. "

  wln
  wln " http://rb23.yolasite.com "
 
     redraw
   wait keydown
 

endproc

procedure AfterGame()
   play sound 2
   'set color 0,0,0
   'cls
   create font 0, "arial", 48

   set caret 300,40
   set color 255,255,255
   wln "PUZZLE SOLVED !"
   create font 0, "arial", 16
   set caret 20,300
   wln "  "
   wln "  "
   wln "  My Web Sites: "
   wln " http://rb23.yolasite.com "
   wln " http://rb27.synthasite.com "
   wln " http://scratch2.yolasite.com "
   wln " http://rb26.synthasite.com "
   wln " http://rb29.yolasite.com "
   wln;wln
   set caret 300,630
   wln " Hit any key to play again "
   event = 2
   redraw
   wait keydown


endproc


procedure SetColor( a )
     if a = 1 then   set color 60,255,50
     if a = 2 then   set color 20,20,255
     if a = 3 then   set color 250,50,50
     if a = 4 then   set color 50,250,250
     if a = 5 then   set color 250,50,250
     if a = 6 then   set color 250,250,50
     if a = 7 then   set color 150,20,180
     if a = 8 then   set color 20,130,130
     if a = 9 then   set color 20,130,130
     sqrcolor = a
     quadColor = a
endproc

   ' This section written by Marcus Johansson
' ===============================================================================
' Write wave file from float data.
'   filename - name of output file (wav)
'   fmt      - BITS_8 or BITS_16
'   rate     - sample rate (11025, 22050, 44100 ...)
'   data     - sound data as float array, values in range [-1 .. 1]
' ===============================================================================
procedure WriteWave(filename$, rate)
rate = rate
  fmt = 16
create file 0, filename$, true
' Write header.
_WriteBytes 0, "RIFF"
if fmt = 16 then write32 0, 36 + sizeof(data)*2

_WriteBytes 0, "WAVE"
_WriteBytes 0, "fmt "
write32 0, 16
write16 0, 1
write16 0, 1
' Sampe rate.
write32 0, rate
' Byte rate.
if fmt = 16
      write32 0, rate*2
  write16 0, 2
  write16 0, 16
    _WriteBytes 0, "data"
    write32 0, sizeof(data)*2
  ' Write data.
  for i = 0 to sizeof(data) - 1
  write16 0, int(data[i]*32000.0)
  next
endif
free file 0
endproc

' ===============================================================================
' Write string as bytes.
' ===============================================================================
procedure WriteBytes(f, bytes$)
for i = 0 to len(bytes) - 1
write8 f, asc(mid(bytes, i))
next
endproc



10
Libraries / Re: GLOOM, a new raycaster library
« Last post by Marcus on July 29, 2017 »
Ah, good :)  Usually strafing left and right, by holding down Z, makes distant enemies easier to hit. But I'll add some options for tweaking the controls later. I wanna make 12 levels before I'm done with this game :)
Pages: [1] 2 3 ... 10