Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - Rick3137

Pages: [1]
1
Code and examples / CyberSlots...... Game made with Blitz3d
« on: 06. July 2019, 23:54:13 »
  I purchased Blitz3d several years ago for 100 dollars. I played with it for awhile and got sidetracked.

  There are a lot of languages out there to try out, so I got side tracked.

  I recently noticed that it has been recently pushed to the open source category and it occurred to me that it might be a good choice for this website, so I decided to give it another try. ( Go to google to get a copy)

 I updated an old game I made called "Cyberslots". It is a simple math game that I use to keep my mind from going to a complete stop.

2
Examples / DoodleBot3 Made with PulsarLua
« on: 01. June 2016, 00:00:27 »
    Art experiment. Some code translated from Small Basic and SDLBasic.
Code: [Select]
      -- By Rick3137
win = openwindow ("Start",-1,-1,1200,700)
setactivewindow (win)


backcolor (0,0,0,255)

cls()
    wx = 1000 ; wy = 700 ; a = 0
    clr = 1 ; --wx = windowwidth ; wy = windowheight
    color (255,225,255,255)
   
   
    function MakeColor()
     local  r = 255
     if (clr == 1) then ; color (255,255,255,r) ; end
     if (clr == 2) then ; color(255,0,0,r) ; end
     if (clr == 3) then ; color(255,100,0,r) ; end
     if (clr == 4) then ; color(255,255,0,r) ; end
     if (clr == 5) then ; color(100,255,0,r) ; end
     if (clr == 6) then ; color(255,255,0,r) ; end
     if (clr == 7) then ; color(0,255,100,r) ; end
     if (clr == 8) then ; color(0,100,255,r) ; end
     if (clr == 9) then ; color(0,0,255,r) ; end
     if (clr == 10) then ; color(100,0,255,r) ; end
     if (clr == 11) then ; color(255,0,255,r) ; end
     if (clr == 12) then ; color(255,0,100,r) ; end
     if (clr == 13) then ; color(100,0,150,r) ; end
     if (clr > 14) then ; clr = 0 ; end
 end
   da = .1 -- change of angle
   ang = 0 -- Angle
   c = .01  -- circle size
   r = 1 -- radius
   dr = .4 -- change of radius
   clr =0  -- color
 
   for a = 0 , 6000  do             
   
           x = cos(ang ) * r
           y = sin(ang ) * r
           MakeColor()
            circle (wx/2 + x, wy/2 + y, c/2)  ; MakeColor()         
            circle (wx/2 + x, wy/2 + y, c)   ; MakeColor()
            circle (wx/2 + x, wy/2 + y, c*2)  ; MakeColor()
            circle (wx/2 + x, wy/2 + y, c*4)  ; MakeColor()                     
            clr = clr + 1
            if (clr>16) then
              clr = 1
            end
            r = r + dr
            --da = da + .01
            ang = ang  + da
            c = c +.02
    end

sync()
key=inkey()

closewindow(win)
closeapplication()


3
Examples / DoodleBot (PulsarLua)
« on: 14. May 2016, 15:15:13 »
   I plan to make a new series of Graphics on several Basic Dialects, using multistage fractals.
 They are a lot more easier to make than games.

Code: [Select]
   
time1 = timerticks()
time2 = 0
win = openwindow ("Fractal Test",-1,-1,800,600)
setactivewindow (win)

textsize(2)
backcolor (100,140,180,255)

--cls()   
Pi2=6.28318 ; Type = 3 ; Count = 0 ; Count2 = 0
 Ang1 = Pi2/Type ; Ang = 0 ; x = 490 ; y = 580
 red = 100 ; green = 0 ; blue = 255
 color (255,0,0,255)

 function SetColor( clr )
         if( clr == 0 ) then
          red = 0 ; green = 0 ; blue = 0
         end
         if( clr == 1 ) then
          red = 255 ; green = 200 ; blue = 200
         end
         if( clr == 2 ) then
          red = 255 ; green = 0 ; blue = 0
         end
         if( clr == 3 ) then
          red = 255 ; green = 200 ; blue = 0
         end
         if( clr == 4 ) then
          red = 255 ; green = 255 ; blue = 0
         end
         if( clr == 5 ) then
          red = 0 ; green = 255 ; blue = 0
         end
         if( clr == 6 ) then
          red = 0 ; green = 0 ; blue = 255
         end
         if( clr == 7 ) then
          red = 255 ; green = 0 ; blue = 255
         end
         if( clr == 8 ) then
          red = 200 ; green = 200 ; blue = 200
         end
         if( clr == 9 ) then
          red = 255 ; green = 255 ; blue = 255
         end
         if( clr == 10 ) then
          red = 100 ; green = 100 ; blue = 100
         end
          if( clr == 11 ) then
          red = 200 ; green = 180 ; blue = 160
         end
          if( clr == 12 ) then
          red = 200 ; green = 0 ; blue = 0
         end
          if( clr == 13 ) then
          red = 200 ; green = 160 ; blue = 0
         end
          if( clr == 14 ) then
          red = 200 ; green = 200 ; blue = 0
         end
          if( clr == 15 ) then
          red = 0 ; green = 200 ; blue = 0
         end
          if( clr == 16 ) then
          red = 0 ; green = 0 ; blue = 200
         end
          if( clr == 17 ) then
          red = 200 ; green = 0 ; blue = 200
         end
          if( clr == 18 ) then
          red = 150 ; green = 0 ; blue = 0
         end
          if( clr == 19 ) then
          red = 0 ; green = 150 ; blue = 0
         end
          if( clr == 20 ) then
          red = 0 ; green = 0 ; blue = 150
         end
          if( clr == 21 ) then
          red = 100 ; green = 0 ; blue = 0
         end
          if( clr == 22 ) then
          red = 0 ; green = 100 ; blue = 0
         end
         if( clr == 23 ) then
          red = 0 ; green = 0 ; blue = 100  -- Jesus Is Comming
         end
         color (red, green, blue,255)     
   
 end

 function RotateLeft()
      Ang = Ang + Ang1
      if Ang > Pi2 then
      Ang = Ang - Pi2
  end
   
 end
 function MoveSteps ( distance )
        dx = cos(Ang) * distance
        dy = sin(Ang) * distance
        x2 = x + dx
        y2 = y - dy
        line( x,y,x2,y2)
        x = x2 ; y = y2
 end   
 function Fractal(size)
         local    cnt = 0
          Ang1 = Pi2/Type
          Count = Count + 1
          while cnt < 3
          do                 
             MoveSteps ( size )
             RotateLeft()
             cnt = cnt + 1
               if size > 10 then
                  Fractal(size/2)
               end
               
          end
 end

  x = 400 ; y = 290 ; Ang = 0     
  Count2 = 0
  color (red, green, blue,0)
   while ( Count2 < 20)
     do         
      Fractal(250)
      Count2 = Count2 + 1 ;   Ang = Count * 9
      SetColor( Count2 ) 
      end
 time2 = timerticks() - time1
drawtext("Press any key to exit ..",10,0)
drawtext( time2,10,30 )
drawtext(" ms. Drawing time ",60,30)
sync()

key=inkey()
closewindow(win)             -- This ends the program.
closeapplication()






4
Examples / Rotating Cube
« on: 10. November 2015, 20:29:46 »
    Since Pulsar seems to lack a 3D system like opengl, I have become interested in pre-windows methods for faking 3D.
    What I have so far is just simple Isometric drawing. I might not make it all the way to real 3d, but at least it is interesting.
    The rotating cube idea would give me something to build a Rubik's Cubic on . I hope it is not too big a problem to solve.

Code: [Select]

   -- Written by Rick3137.   Tested on Windows10
win = openwindow ("Start",-1,-1,1200,700)
setactivewindow (win)
backcolor (0,0,0,255)
cls()

sync()
    x=0 ; y=0 ; f= 0 ; x1=0 ; y1 = 0 ; Ang = 0 ; r = 500
    Pi = math.pi ; AngleS = Pi / 180 -- Angle Segment equal to 1.0 degrees
    px = {0,0,0,0,0,0,0,0,0,0}    --  Point X
    py = {0,0,0,0,0,0,0,0,0,0}    --  Point Y
    Ang = { 0,0,0,0 }             -- Holds the 4 bottom cube angles           
    color (255,225,255,100)

function DrawQuad( cx,cy,radius, Ang1)
          --Ang1 moves from 0 to 200
          local Angle = 0 ; a1 = Pi / 180 ; x2=0 ; y2=0 ; x3=400 ; y3 = 400
          Ang[1] = Ang1     
       for a=0,360 do
           Angle = a * AngleS
           x2 = cos(Angle) * radius + cx
           y2 = -.3 * sin(Angle) * radius + cy
           --dot(x2,y2)
           Ang[2] = Ang1 + 90 ; Ang[3] = Ang1 + 180 ; Ang[4] = Ang1 + 270
                for b=1,4 do
                    if (Ang[b] > 360 ) then
                        Ang[b] = Ang[b] - 360
                    end
                    if (a == Ang[b] ) then      -- start at 45
                         px[b] =  x2  ; py[b] = y2
                    end
                end
       
       end
       DrawLines(radius)
end

function DrawLines(radius)
       line( px[1], py[1], px[2], py[2] ) ;line( px[2], py[2], px[3], py[3] ) ;line( px[3], py[3], px[4], py[4] )
       line( px[1], py[1], px[4], py[4] )
       line( px[1], py[1] - radius, px[2], py[2] - radius ) ;line( px[2], py[2] - radius, px[3], py[3] - radius )
       line( px[3], py[3] - radius, px[4], py[4] - radius ) ; line( px[1], py[1] - radius, px[4], py[4] - radius )     
       line( px[1], py[1], px[1], py[1] - radius ) ; line( px[2], py[2], px[2], py[2] - radius )
       line( px[3], py[3], px[3], py[3] - radius ) ; line( px[4], py[4], px[4], py[4] - radius )
       
       drawtext ( Ang1,0,30)
       sync()
       --wait( 100)
end

   color (100,100,0,255)

  a = 45 ; cnt = 0 ; key = 200
    while key > 100 do
        color (0,0,0,255)
        --cls()
        fillrectangle( 0,40,1000,700 )
        color (255,255,255,255)
        DrawQuad( 400,400,200,a )   -- x,y,radius,angle
        wait(5)
        sync()
        a = a + 1 ; cnt = cnt + 1
        if (a>360) then
           a = a - 360
        end
        key = getkey()
        drawtext ("Press any key to exit ..",0,0)
        sync()
     end
sync()
closewindow(win)
closeapplication()



5
Examples / LuaCurliqueFractal
« on: 28. October 2015, 22:15:24 »
 
win = openwindow ("Start",-1,-1,1200,700)
setactivewindow (win)


backcolor (0,0,0,255)

cls()
--float x,y,f,i
    x=0 ; y=0 ; f= 0 ; x1=0 ; y1 = 0 ; Ang = 0 ; r = 50
    color (255,225,255,255)
for a=0,500000 do
     Ang = Ang + .00001
       if(Ang >  8 ) then
            Ang = 0
       end
       r = r +.000001 
    f = f - math.pi   
    x = x + cos(f*f)
    y = y + sin(f*f)
    x1 = x + r + cos(Ang)*r/8  ; y1 =  y + r + sin(Ang)*r
    x3 =  r - cos(Ang)*r/8 -x
     color (x,y,255,f)
    dot( x1 + 500 ,y1 + 300  )
    dot( x3 + 500 ,y1 + 300 )   
end

color (255,255,0,255)
--textsize (2)

drawtext ("Press any key to exit ..",0,0)

sync()
key=inkey()

closewindow(win)
closeapplication()

6
Pulsar2D / Math Functions
« on: 22. October 2015, 17:38:35 »
 I did a short study of the Lua math functions and have the results here.
 I left out a few that were too hard to bother with.

                PulsarLua Math Functions

abs       ceil      cos        sin       
exp       floor     sqrt       rnd       round           
math.fmod     math.modf     math.log           math.log10
math.pi          math.pow      math.random    math.randomseed   
math.min       math.max      math.deg          math.tan          math.rad

 Here's how to use them in a program:

Code: [Select]
   

 ------------ START OF PROGRAM ---------------
 win = openwindow ("Math Functions",-1,-1,1000,700)
       setactivewindow (win)
       textsize(2)
       backcolor (0,0,0,255)
 color (0,0,255,255)       
a = math.pi                  -- returns 3.14....
b = abs(-2)                   -- converts to positive number
c = ceil(a)                   -- rounds a float up to the next integer
d = floor(a)                  -- rounds a float down to the next integer
e = math.max( 1,2,3,4 )      -- returns highest number in list: 4
f = math.min(1,2,3,4)        -- returns lowest number in list: 1
g = math.modf(a)             -- returns the integer part of a float 
h = math.fmod(10,4)          -- returns the integer part of a division 10/4
i = sqrt(81)                  -- Square Root
j = math.rad(60)             -- convert angles to radians
k = math.pow(10,6)           -- same as 10^6
l = math.log10(1000000)      -- base 10 logarithm
m = math.log(1000000)         -- base e logarithm
n = exp(2)                    -- returns e^x
    math.randomseed(10)            -- set up random number generator
o = math.random(10)                -- get random number from 1 to 10
p = math.random(10,100)            -- get random number from 10 to 100
q = sin(j)                          -- main trig functions
r = cos(j)
s = math.tan(j)
t = rnd(20)                          -- returns random number from 0 to 1
u = round(a)                        -- returns integer part of decimal fraction
v = math.deg( a/3)                  -- converts radians to degrees

           
 
drawtext( a,0,0)
drawtext( b,0,20)
drawtext( c,0,40)
drawtext( d,0,60)
drawtext( e,0,80)
drawtext( f,0,100)
drawtext( g,0,120)
drawtext( h,0,140)
drawtext( i,0,160)
drawtext( j,0,180)
drawtext( k,0,200)
drawtext( l,0,220)
drawtext( m,0,240)
drawtext( n,0,260)
drawtext( o,0,280)
drawtext( p,0,300)
drawtext( q,0,320)
drawtext( r,0,340)
drawtext( s,0,360)
drawtext( t,0,380)
drawtext( u,0,400)
drawtext( v,0,420)
drawtext( w,0,440)
drawtext( x,0,460)
drawtext( y,0,480)
drawtext( z,0,500)


sync()
key=inkey()
closewindow(win)             -- This ends the program.
closeapplication()





7
Examples / TriangleFill for PulsarLua
« on: 20. October 2015, 15:47:51 »
  Here's an example of a simple Fill function for equilateral triangles that I came up with to use in another program.





function TriangleFill(x1,y1,d)       -- x1,y1 is the bottom left point
       d2 = d/2               
       dx = 1
       dy =  math.tan(math.pi/3) 
       x2 = x1 + d
       y2 = y1
       x3 = x2 + d             
     while x1 < x2
     do 
          line( x1,y1,x2,y2)
          line( x2,y2,x3,y2)
          x1 = x1 + .5
          y1 = y1 - dy/2 
          y2 = y1
          x3 = x3 - .5   
     end
 end
 ------------ START OF PROGRAM ---------------
 win = openwindow ("Hexagon",-1,-1,1000,700)
       setactivewindow (win)
       textsize(2)
       backcolor (0,0,0,255)
 color (0,0,255,255)       
 TriangleFill(100,600,200)
drawtext("Press any key to exit ..",0,0)
sync()
key=inkey()
closewindow(win)             -- This ends the program.
closeapplication()




8
Pulsar2D / Using Geany with Pulsarlua
« on: 18. October 2015, 18:35:10 »
    I managed to get the Geany IDE working with Pulsarlua.
    It's a really nice setup.
    After putting filetypes.lua into the geany Data folder I got everything in color.
    It even gives me the line numbers of all my functions. I can go to any function with one click of the mouse.
    Now, I am working on the Build buttons. I got the execute button to work, but it only works if your .lua file is in the PulsarluaWin32 folder. If you put it in another folder it doesn't seem to work.
 
   

9
Games / Easy Yukon ( Made with NaaLaa )
« on: 12. February 2015, 18:52:35 »
  The first card game in a series.

10
Examples / Hello World for Pusar2d
« on: 12. March 2014, 16:52:03 »
  my example of  "HELLO WORLD" is also a simple test of FileIO.
Code: [Select]
      -- By Rick3137  http://rb23.yolasite.com/


  -- Starts Program
   b = 0    c = "a"
   win=openwindow ("Files",-1,-1,800,600)
      setactivewindow (win)
      color (25,25,20,255)
      backcolor (240,240,255,255)
      cls()

         fh1 = open("test.txt", "w")
         fprint(fh1, "HELLO WORLD")
         close(fh1)



     filehandle = open("test.txt", "r")
     x = 0 a = 0
     color (0,0,0,255)
     fillcircle (x,y,w)
     textsize (2)
     drawtext ("This will create a file on your DiskDrive",10,30)
     drawtext ("It will then read it and print it to your screen.",10,60)
     drawtext ("Press any key to exit ..",10,90)
     sync()
     

     while (eof(filehandle) == false) do
x = x + 20
        a = finput(filehandle)

        drawtext ( a,200+x,200)
     end
     close(filehandle)

     sync()
     key=inkey()
     closewindow(win)
     closeapplication()

   



















 

11
BrowserBasic / Edit Bug
« on: 17. July 2013, 20:13:50 »
         
     I keep running into a bug that you all should be aware of.  You may already know about it , but I'll post it any way.
    My style of cut and paste causes too much white space in the editor. The compiler gets confused and leaves out semicolons in the Java Script output code. When I try to run it, I just get a blank screen. Windows Explorer fails to run it and will not give a clue as to why.
   The solution is to find the bad code in the Java Script and go back to the editor and select and delete the extra spaces at the end of the line.
    Compile again. No problems after this.
   

12
Examples / Sample Programs for BrowserBasic
« on: 09. July 2013, 22:13:58 »
     This first program is a simple Game Board Demo.

 
Code: [Select]
'    Game Board Demo by Rick3137    http://rb23.yolasite.com/


Var btn as string
Var mx as number
Var my as number
Var column as number
Var row as number


Function OnLoad()
setBackgroundColor( 0, 0, 40)
EndFunction

Function OnDraw()

setColor( 255, 255, 255 )
Print( Str$( mx ) , 20, 100)
Print( Str$( my ) , 20, 120)
Print( Str$( column ) , 20, 140)
Print( Str$( row ) , 20, 160)
    setColor ( 50 , 50 , 100 )
FillRectangle ( 90 , 0, 520, 520)
    setColor ( 90 , 90 , 150 )
FillRectangle ( 100 , 10, 500, 500)
Squares()

EndFunction

Function Squares()
Var x as number
    Var y as number
Var x2 as number
    Var y2 as number
Var x3 as number
    Var y3 as number
setColor ( 255 , 255 , 255 )
    x=100
y=10   
x2 = x+2
y2 = y+3
x3 = x+48
y3 = y+48
For a = 1 to 100     
StrokeRectangle ( x , y, 50, 50)
for b = 1 to 2
setColor ( 0 , 0 , 0 )
Line(x2,y2,x3,y2)
Line(x3,y2,x3,y3)
setColor ( 255 , 255 , 255 )
Next
x=x+50
if x > 590 then
x=100
y = y + 50
endif
x2 = x+2
    y2 = y+3
    x3 = x+48
    y3 = y+48
    Next
endfunction



Function OnMouseMoved(x as number, y as number)

mx = x
my = y
mx = Int ( mx )
my = Int ( my )
    x = mx -50
    y = my - 10
column = Int ( x/50 )
row = Int ( y/50 + 1 )
EndFunction


Function OnMouseReleased(x as number ,y as number, button as string)

Select button
Case "l"
btn = "Left"
break
Case "r"
btn = "Right"
break
EndSelect

EndFunction









 By Rick3137---  http://rb23.yolasite.com/

13
EGSL / System command
« on: 02. June 2013, 20:23:06 »
 I have been doing a study of EGSL and I got stuck with the system() command. How does that work?

14
EGSL / EGSL Samples
« on: 25. May 2013, 14:59:44 »
 I've just started using EGSL and I am starting a series of EGSL sample programs. I like script languages over compiled languages because they are so much more easy to use. You can trade them with your friends and not worry about having a virus hiding somewhere in the code where you can't find it.

  I am active on another website that uses building blocks instead of scripts. This is also a safe way to program. I am now busy trying to translate these programs to EGSL and other free scripting languages. The idea that we are pushing is called "Remixing" Anyone can take another users program, add to it and then repost it. I want to try and do the same with scripting languages.
    My website: http://rb23.yolasite.com        ( still being built)


Pages: [1]