Menu

micro(A) examples & programs

2022-03-02
2023-09-08
  • Zlatko Vidlanovic

    Under this topic i will try to add examples and programs written in micro(A)

     
  • Zlatko Vidlanovic

    '"Rotating Pyramid" 'b+ 2022-03-01 -microA version by Aurel
    var x1,y1,x2,y2,x3,y3,x4,y4
    var ax,ay,cx,ex,ey,xr,yr,a,width,Pi
    width=800 : Pi = 3.14159
    cx = width / 2
    ax = cx: ay = 50    ' apex
    ex = cx: ey = 330   ' ellipse
    xr = cx * 0.7 : yr = 0.33 * xr
    
    LABEL DoLoop
        fcolor 0,0,0: rect 0,0,800,600  'cls
        x1 = ex + xr * Cos(a)            : y1 = ey + yr * Sin(a)
        x2 = ex + xr * Cos(a + Pi * 0.5) : y2 = ey + yr * Sin(a + Pi * 0.5)
        x3 = ex + xr * Cos(a + Pi)       : y3 = ey + yr * Sin(a + Pi)
        x4 = ex + xr * Cos(a + Pi * 1.5) : y4 = ey + yr * Sin(a + Pi * 1.5)
        fcolor 220,200,100 
        line x1, y1, x2, y2
        line x2, y2, x3, y3
        line x3, y3, x4, y4
        line x4, y4, x1, y1
        line x1, y1, ax, ay
        line x2, y2, ax, ay
        line x3, y3, ax, ay
        line x4, y4, ax, ay
        a = a + 0.01    ' use 0.01 if is slow
        swap
    
    GoTo DoLoop
    
     
  • Zlatko Vidlanovic

    fake pyarmid by Paul Dunn

    ' Fake 3D Pyramid-by ZXdunny
    var a,x,y,ya,ab,ax,cr
    var f,ay,ox,oy,p,px
    var angle : wcolor 0,0,0 
    fcolor 100,170,200 : print 4,4,"fakePyramid": swap
    fcolor 0,0,0 : rect 20,20,400,400  : swap
    x=400/2 : y=400/2 
    ya=y-120 : a=18
    
    'main
    LABEL main
    f=1
    while f < 6
        p=0
        while  p < 6
    
           ab=a+90*f
           ax=x+100 * cos(ab)
           ay=y-50  * sin(ab)
    
           'IF f,<,4
           fcolor 0,187,250
           'line ox,ay,ax,ay
            if x > 399 :x=200 : endif
            x=x+0.01
            CIRCLE x,ya,4
            'set cr=rand(8)
            CIRCLE ax,ay,4
           LINE ox,oy,ax,ay
            'ENDIF
    
          'txcolor 0,187,250  
          ' LINE ox,oy,ax,ay
           LINE x,ya,ax,ay
           'ENDIF
    
           ox=ax 
           oy=ay
    
        p=p+0.4
        wend
    
    f=f+0.4
    wend
    a=a+1
    
    swap
    
    fcolor 0,0,0 : rect 20,20,500,400 
    
    goto main
    
     
  • Zlatko Vidlanovic

    Alien Pipes

    'alien_Pipes - micro(A)
    var lenght,angle,x,y,diff,adiff
    var x2,y2,counter,a,b,pi,r, px,py,n
    wcolor 0,0,0 
    pi=3.14596
    lenght = 300
    angle = 3.44
    x = 400
    y = 300
    x2 = 55
    diff = 1.14
    adiff = 0.8
    y2 = y
    fcolor 0,120,80
    'line x y x2 y2
    lenght = lenght - diff
    counter = 0
    
    while counter < 360 
    if counter < 80 : fcolor 0,170,180 : endif
    if counter > 80 : fcolor 30,80,150 : endif
    
        angle = angle + adiff
        lenght = lenght - diff
        a = sin(angle*pi) * lenght
        b = tan(angle*pi/2) * lenght
        x2 = x + b
        y2 = y + a
        r=(counter/pi)/3
        circle x2,y2,r
        swap    
        counter=counter + 1
    'swap
    wend 
    fcolor 200,200,220 : print 5,5,"Alien pipes"      
    
     
  • Zlatko Vidlanovic

    BlackHole...vortex animation

    'test_while/wend_blackHole 
    var w,h,a,r,ps,i,px,py,rad
    var rr,gg,bb,rx,ry 
     w=640/2 : h=480/2
    wcolor 0,0,100 
     fcolor 200,220,160
    print 10,10,"Black hole"
    a=1 : r=1  
    
    label again
    i=1
    wcolor 0,0,0
    
    while i < 60
      ps=70/(i/a)
      rx=cos(i*r)*ps+w 
      ry=sin(i*r)*ps+h
      circle ry,rx,4 
    
    'change values between 0.1 and 0.08
    i=i+0.3
    'swap
    wend
    
    a=a+0.01
    
    if a < 20
       a=a+0.1
        r = r - 0.19
    endif
    
    if r < 360
      r=r+0.01
    endif
    
    if r>360 
     r=r-1
    endif
    
    swap
    goto again
    'commenr
    
     
  • Zlatko Vidlanovic

    butterfly...

    'butterfly micro(A)
    var x,y,i,a,turn,rr,gg,bb,cx,cy,cr
    wcolor 0,0,0
    'frontpen 200,200,0
    while turn < 30 
    
    i=0
    fcolor 0,0,0 : rect 0,0,640,480
    'print 10,90,turn
       while i < 120
       rr=rand(255) :gg=rand(255): bb=rand(255)
       fcolor rr,gg,bb
        x = sin(i+a)*50 - cos(i-a)*i
        y = cos(i+a)*50 + sin(i-a)*i
        cx=x+320: cy=y+240: cr=sin(i)*5 
        circle cx,cy,cr
        'pset cx,cy
    i=i+0.6
    'swap
    wend
    
    a = a + 0.073
    
    if a > 360 
    a = -a
    endif
    
    turn = turn + 0.1
    swap
    'print 5,5,turn
    wend
    
     
  • Zlatko Vidlanovic

    'chTree
    var rise, rad, frad, xshorten 
    var left, top, width, height, bpx, bpy, tpx, tpy 
    var x1, y1, x2, y2
    var ht,xs,aa,msto
    var tpxx,tpyy,bpxx,bpyy,minus4
    var x,y,px,py
    wcolor 0,0,0
    drawStars()
    msto = -100
    minus4 = -4
    bpx=220 : bpy=410 : tpx=bpx
    
    'brown ..............................
    fcolor 130, 100, 0
    aa = minus4
    while aa < 4
       bpxx=bpx+aa : bpyy=bpy-390 
      line bpxx, bpy, bpx, bpyy 
    aa = aa + 1
    swap
    wend
    
    'green............................... 
    fcolor 30,120,40 
    rad=160 : tpy=bpy-40 
    ht=1
    while ht < 40 
    xs= -100
      while xs < 100  
        xshorten=xs/100  
        rise= rnd(0.93) : tpxx = tpx+(xshorten*rad) : tpyy = tpy-rise*rad
        line tpx, tpy, tpxx, tpyy
    
        aa=1
         while aa < 30 
           frad=rnd(0.9)*rad 
           x1=tpx+(xshorten*frad) 
           y1=tpy-rise*frad 
           x2=tpx+xshorten*(frad+rad/5) 
           y2=tpy-rise*frad+(-rise + (rnd(0.9)-0.456))*(rad/5)
           line x1, y1, x2, y2 
           aa=aa+1    
        wend
    
       xs = xs + 40
      wend 
    
    rad=rad-4 : tpy=tpy-9
    ht = ht + 1 : swap
    wend  
    
    bcolor 80,0,100 :fcolor 200,220,200 
    print 300,40," * * * Merry Christmas ! * * * "
    print 300,80," * * * Happy New Year  ! * * * "
    bcolor 60,0,120 :fcolor 200,220,200 
    print 350,120," micro(A) by Aurel "
    
    fcolor 220,200,100 : circle 190,100,6 : circle 190,100,4: circle 190,100,2
    fcolor 250,100,100 : circle 250,180,6 : circle 250,180,4: circle 250,180,2
    fcolor 150,100,250 : circle 175,165,6 : circle 175,165,4: circle 175,165,2
    fcolor 80,150,255  : circle 140,225,6 : circle 140,225,4: circle 140,225,2
    fcolor 80,250,255  : circle 270,245,6 : circle 270,245,4: circle 270,245,2
    fcolor 200,150,255 : circle 90,302,6  : circle 90,302,4 : circle 90,302,2
    fcolor 250,180,255 : circle 295,302,6 : circle 295,302,4: circle 295,302,2
    
    func drawStars()
    wcolor 0,0,80
    x=10 : y=0
       while x < 400
          px= rand(600) : py= rand(480)
          bcolor 0,0,80 : fcolor 220,220,110 : print px,py,"."
          fcolor 120,220,210 
          x=x+4
       wend
    endfn
    
     
  • Zlatko Vidlanovic

    Dipol antenna Calculator

    'Antenna Dipol Calculator 
    var mx, my, wp, cons, freq, length ,dlen
    ptr wmMouseMove ,wmKeyDown
    cons = 142.5 : freq = 100 : length = cons/freq : dlen = length * 100
    wcolor 40,60,120 : fcolor 140,180,200 : rect 0,0,800,600 : swap
    print 6,10,"FREQENCY(MHz)"
    print 6,40,"LENGTH  ( m )"
    fcolor 220,180,150 : print 300,10,"Antenna Dipol Calculator micro(A)":swap
    DisplayUpdate()
    Info()
    DrawDipol()
    
    'WinMsg wmMOUSEMOVE
       mousex mx
       mousey my
       'DisplayUpdate()
    'swap
    'EndWm
    
    WinMsg wmKEYDOWN
    
    hWparam wp
    'vkLEFT ?
    if wp = 37
       freq = freq - 1 : length = cons/freq : dlen = length + 80
       DisplayUpdate() : DrawDipol()
    endif
    
    'vkRIGHT ?
    if wp = 39
        freq = freq + 1 : length = cons/freq : dlen = length - 80
        DisplayUpdate() : DrawDipol()
    endif
    
    EndWm
    
    
    func DisplayUpdate()
       fcolor 90,90,90 :rect 124,5,100,24   
       fcolor 100,160,220 : print 130,10,freq 
       fcolor 90,90,90 :rect 124,35,100,24   
       fcolor 100,160,220 : print 130,40,length
       swap
    endfn
    
    func Info()
       fcolor 140,180,200
       print 20,410,"LEFT Key... <--  -1 MHz"
       print 20,430,"RIGHT Key.. -->  +1 Mhz"
       print 20,450,"UP Key... <--   +10 MHz"
       print 20,470,"DOWN Key... <-- -10 MHz" 
       'swap
    endfn
    
    func DrawDipol()
       'draw frame 
       fcolor 90,90,90 :rect 0,180,640,60
       fcolor 190,90,90 :rect 100,200,dlen,20 
    'swap
    endfn
    
     
  • Zlatko Vidlanovic

    'Coded By Ashish - "Dragon" in qb64
    'micro(A) by Aurel
    var sx,sy,ox,oy,z,i,x,y,xx,yy,n,a,b,r,px,py
    wcolor 0,0,0  
        z = 40
        ox = 600 * 0.46
        oy = 380 * 0.09
        fcolor 255, 180, 0
    i=0
     while i < 5000
            a = sx: b = sy
             x=a : y=b 
       label drawDragon
          r=rnd(1)
           if r > 0
             if r < 0.8
                xx = 0.824074 * x + 0.281428 * y - 1.88229
                yy = -0.212346 * x + 0.864198 * y - 0.110607
             endif
           'endif
           else
             'if r < 0
                xx = 0.088272 * x + 0.520988 * y + 0.78536
                yy = -0.463889 * x - 0.377778 * y + 8.095795
             endif
    
            px = xx * z + ox : py = yy * z + oy
            pset px,py
    
    
            if n < 5  
               n=n+1: goto drawDragon 
            else 
                sx = xx: sy = yy
                n=1
            endif
     i=i+1
    swap
    wend
    print 10,10,"     Dragon Curve in micro(A)" :swap   
    
     
  • Zlatko Vidlanovic

    Factorial with recursion

    'factorial micro(A)
    var value ,res 'value
    var number : number = 7
    var fact : fact = 1
    value = 1
    
    
    print 10, 10, "The factorial of -> " : 
    print 180,10,number
    factorial() 
    label continue
    fcolor 230,80,60: print 10,200,"RECURSION OVER!->continue..."    
    
    
    func factorial()
    
      if value < number 
           value = value + 1
           fact = fact * value
           rect 8,90,100,32 :fcolor 220,220,100: print 10,100,fact : swap
           factorial() 
      else
          goto continue
      endif
    
    endfn
    
     
  • Zlatko Vidlanovic

    'Fractal19 from mySmallBasic-> in micro(A)
    var x,y ,i,r,ux,uy
    wcolor 20,60,40 : fcolor 180,180,230
    print 10,10,"Fractal19 from MySmallBasic-github...in micro(A)"
    x = 100 : y = 100
    'change color
    fcolor 220,220,100

    while i < 10000

    r = rand(3)

    ux = 150
    uy = 30

    If r = 1   
        ux = 30     
        uy = 1000   
    EndIf
    
    If r = 2     
        ux = 1000     
        uy = 1000   
    EndIf
    

    x = (x + ux) / 2
    y = (y + uy) / 2
    pset x, y

    i=i+0.5
    wend

    swap

     
  • Zlatko Vidlanovic

    full circle by MGA

    'full_circle by [B+=MGA]2017->micro(A) by aurel
    'everything was supposed to be turning around another circle
    var xc,yc,xx,yy,x,y,x3,y3,r,w,ww,w3,pi,i,j,k,ww,loop
    xc=640/2 : yc=480/2 :pi=3.14: i=1 : j=1: k=1: loop=1
    wcolor 0,0,0
    while loop < 2400
      r = r + pi/180
      w = w + pi/72
       i=1 : j=1: k=1
      while i < 12
        x=xc+200*cos(w+i*pi/6)*sin(r)
        y=yc+200*sin(w+i*pi/6)*sin(r)
        fcolor 120,150,100 : circle x,y,40
        ww = ww + pi/80
         while j < 12
          xx=x+100*cos(ww + j*pi/6)*sin(r)
          yy=y+100*sin(ww + j*pi/6)*sin(r)
          fcolor 150,100,100 : circle xx,yy,20
          w3 = w3 + pi/80
           while k < 12
            x3=xx+50*cos(w3 + k*pi/6)*sin(r)
            y3=yy+50*sin(w3 + k*pi/6)*sin(r)
            fcolor 100,120,150 : circle x3,y3,r
            k = k + 1
          wend
        j = j + 1
        wend
        i = i + 1
      wend
    'wcolor 0,0,0
    
      loop = loop + 0.1
    swap
    wend
    
     
  • Zlatko Vidlanovic

    primitive game in microA with Johnno help

    'primitive game in microA with Johnno help 
    var r,g,b , mx , my, ax,ay, wp ,p,score
    var bf, bx, by ,bs, ex,ey,hit,eh,ev
    ptr wmKeyDown, wmTimer
     ay = 175 : ax = 120 : ex = 5 : ey = 10
    wcolor 0,0,0 : fcolor 140,180,200
    print 20,410,"primitive game in micro(A)"
    print 20,430,"move 'A' with LEFT<->RIGHT arrow keys"
    print 20,450,"Shoot with SPACE bar"
    print 20,470,"Pause with ESC key"
    print 456,10,"player" : print 456,40,"bullet" : print 456,70,"enemy"
    print 456,100,"score"
    updateScreen() : fcolor 220,10,10 : print ax,ay,"A" 
    hit = 0
    
    WinMsg wmKEYDOWN
    
    hWparam wp
    'vkLEFT ?-----------------------------------
    if wp = 37 
       if ax > 11 : ax = ax - 5 :endif 
    endif
    
    'vkRIGHT ?----------------------------------
    if wp = 39 
       if ax < 229 : ax = ax + 5 : endif
    endif
    
    'vkSpace ?----------------------------------
    if wp =32
         if bf = 0 
            bf = 1      
            bx = ax
            by = ay
         endif
    endif
    
    'empty loop ---------------------------------
    while wp ! 27 
        fcolor 180,180,120 : rect 1,1,256,192
        updateScreen()
        updateBullet()
        updateEnemy()
        testCollision()
        'delay loop
        p=0
        while p < 800
         p=p+0.1
        wend
        swap
    wend
    
    EndWm
    
    '--------------------------------------------------
    func updateScreen()
        'update ax position
        fcolor 80,80,100 :rect 524,5,68,24   
        fcolor 100,160,220 : print 530,10,ax 
    
        'display player
        fcolor 100,210,230 : print ax,ay,"A"
    
        'Display bullet  
        if bf = 1 
            fcolor 255,255,0 : print bx, by,"^"
            'update by bullet position
            fcolor 80,80,100 :rect 524,35,68,24  
            fcolor 235,218,100 : print 530,40,by
        endif
    
        'display enemy
         fcolor 0,150,100 : rect ex,ey,10,6
         'update ex enemy position
         fcolor 80,80,100 :rect 524,65,68,24  
         fcolor 100,160,100 : print 530,70,ex
         'update score
          fcolor 80,80,100 :rect 524,95,68,24  
         fcolor 245,118,0 : print 530,100,score      
    
        swap
    
    endfn
    '----------------------------------------------------------------
    func updateBullet() 
        if bf = 1 
            by = by - 5
           'Bullet has left the screen. 
           if by < 0 : bf=0 : endif 
        endif
    endfn
    '----------------------------------------------------------------
    func updateEnemy()
       if ex < 250 : ex=ex+5 : endif
       if ex > 240 : ex=5    : endif
       if ey > 100 : ey = 5  : endif
       eh=ex+10: ev=ey+10
       fcolor 0,150,100 : rect ex,ey,10,6
    endfn
    
    func testCollision()
    'if(pointX > rectX && pointX < rectX + rectWidth){
    '   if(pointY > rectY && pointY < rectY + rectHeight){
    '       //the point is inside the rectangle 
    '   }
    '}
    
        if bx > ex & bx < eh 
           if by > ey & by < ev
             hit = 1
           endif
        else
            hit = 0
       endif
    
       if hit = 1
              fcolor 220,100,100: print ex,ey,"-XX-": score = score + 10         
        endif
    
    endfn
    
     
  • Zlatko Vidlanovic

    GDI demo

    'test demo in gdi
    ptr img,img2,img3,img4
    ptr wmKeyDown, wmTimer 
    var wp,ix,iy,p,ex,ey,eh,ev,bx,by,bf,hit
    var sc
    wcolor 200,200,210
    fcolor 180,60,150 : print 10,510,"give banana to monkey"
    LoadImg img,"beach.bmp",0,640,400,16 
    'program name...
    print 10,440,"Coconut Monkey m(A)": print 10,460,"Press ESC for pause.."
    'show img on window
    ShowImgT img,0,0,640,360 
    'load another image 
    LoadImg img2,"explorer1.bmp"  , 0, 32, 32,16
    LoadImg img3,"monkey1.bmp"  , 0, 32, 32,24
    LoadImg img4,"banana.bmp" , 0, 32, 32,16
    ShowImgT img3,300, 300, 32, 32 
    ex = 300 : ey = 30 : ix = 300 : iy = 360
    updateScreen() : sc=0
    'show score rect
    fcolor 80,80,100 :rect 524,470,68,24  
    fcolor 245,118,0 : print 530,475,sc
    
    'events...
    WinMsg wmKEYDOWN
    
    hWparam wp
    
    'vkLEFT -----------------------------------
    if wp = 37 
       if ix > 0 :ix = ix - 5 : endif
    endif
    
    'vkRIGHT ?----------------------------------
    if wp = 39 
       if ix < 600 : ix = ix + 5 : endif 
    endif
    
    'vkUP --------------------------------------
    if wp = 38
         if iy > 0 : iy = iy - 5 :endif
    endif 
    
    'vkDOWN -------------------------------------- 
    if wp = 40
        if iy < 360 : iy = iy + 5 :endif
    endif
    
    'vkSPACE
    if wp = 32
         if bf = 0 
            bf = 1      
            bx = ix
            by = iy
         endif
    endif
    
    'game loop if key not ESC
    while wp ! 27 
    
    
      updateBack() 
      updateShip() 
      updateBullet()
      updateEnemy()       
      testCollision() 
      updateScreen()
    
        'delay loop
        ' p=0
        'while p < 80
         'p=p+0.1
       'wend
    
    swap
    
    wend
    
    EndWm
    
    func updateScreen()
       fcolor 80,80,100   : rect 524,415,68,24   
       fcolor 100,160,220 : print 530,420,ix 
    
       fcolor 80,80,100   : rect 524,440,68,24
       fcolor 100,160,220  : print 530,445,iy
    
       'Display bullet  
        if bf = 1 
            ShowImgT img4, bx, by, 32, 32
        endif   
    
       'show enemy
       ShowImgT img3, ex, ey, 32, 32
       'show ship 
       ShowImgT img2,ix,iy,32,32
    
    'update score
      'if hit = 1
        fcolor 80,80,100 :rect 524,470,68,24 
        fcolor 245,118,0 : print 530,475,sc
      'endif
    
    'swap
    endfn
    
    func updateBack()
     ShowImgT img,0,0,640,400
    endFn
    
    func updateShip()
      ShowImgT img2,ix,iy,32,32   
    endFn
    
    func updateBullet() 
        if bf = 1 
            by = by - 1
           'Bullet has left the screen. 
           if by < 0 : bf = 0 : endif   
        endif
    endfn
    
    func updateEnemy()
        eh = ex+32 
        ev = ey+32
       if ex = 598 : ex = 0 : endif
       if ex < 600 : ex = ex + 1 : endif
    
    endfn
    
    func testCollision()
        'hit=0
        if bx > ex & bx < eh 
           if by > ey & by < ev
             hit = 1 
          endif
        else
         hit=0
       endif
    
       if hit = 1      
          'fcolor 220,100,100
          'print ex,ey,"-XX-"
           sc=sc+1
        endif
    
    endfn
    
    'func updateScore()
        'fcolor 80,80,100 : rect 524,470,68,24  
       ' fcolor 245,118,0 : print 530,475,sc 
    'endfn
    
     
  • Zlatko Vidlanovic

    mini Solar system

    'mini solar system - micro(A)
    var x,y,x1,y1,pi,t,w,h ,r, w2, h2,fPi,fRad,r2
    var x2,y2, x3,y3, x4,y4, x5,y5, x6,y6, x7,y7, x8,y8, x9,y9
    var r2,r3,r4,r5,r6,r7,r8,r9
    w = 800 : h = 600 : w2 = w / 2 : h2 = (h / 2)-20 
    fPi = Cos(0.98) : fRad = fPi / 180
    wcolor 0,0,0 
    t = 0
    r  = 30
    r2 = 50
    r3 = 90
    r4 = 130
    r5 = 150 
    r6 = 190
    r7 = 220
    r8 = 240
    r9 = 270
    fcolor 0,100,200 
    
    '----------------------------------
    label start
    
    fcolor 160,160,160 : rect 0,0,800,600 
    fcolor 160,160,160 : circle w2,h2,r9
    fcolor 160,160,160 : circle w2,h2,r8
    fcolor 160,160,160 : circle w2,h2,r7
    fcolor 160,160,160 : circle w2,h2,r6
    fcolor 160,160,160 : circle w2,h2,r5
    fcolor 160,160,160 : circle w2,h2,r4
    fcolor 160,160,160 : circle w2,h2,r3
    fcolor 160,160,160 : circle w2,h2,r2
    fcolor 160,160,160 : circle w2,h2,r
    
    'sun
    fcolor 240,200,100 : circle w2,h2,10 : print 4,4,"MINI SOLAR SYSTEM"
    
    x = w2 + r * Cos(t + 0.5 + fRad * 90) : y = h2 + r * Sin(t+0.5 + fRad * 90)
    fcolor 150,100,20 : circle x,y,5 :print x,y,"mercury"
    
    x2 = w2 + r2 * Cos(t-0.5 + fRad * 90) : y2 = h2 + r2 * Sin(t-0.5 + fRad * 90)
    fcolor 200,180,0 : circle x2,y2,8 : print x2,y2," venus"
    
    x3 = w2 + r3 * Cos(t + fRad * 90) : y3 = h2 + r3 * Sin(t + fRad * 90)
    fcolor 0,150,200 : circle x3,y3,8 : print x3,y3," earth"  
    
    x4 = w2 + r4 * Cos(t+0.9 + fRad * 90) : y4 = h2 + r4 * Sin(t+0.9 + fRad * 90)
    fcolor 240,160,100 : circle x4,y4,7 : print x4,y4," mars"
    
    x5 = w2 + r5 * Cos(t- 0.9 + fRad * 90) : y5 = h2 + r5 * Sin(t- 0.9 + fRad * 90)
    fcolor 180,190,210 : circle x5,y5,12 : print x5,y5," jupiter"
    
    x6 = w2 + r6 * Cos(t- 2.5 + fRad * 90) : y6 = h2 + r6 * Sin(t- 2.5 + fRad * 90)
    fcolor 230,190,110 : circle x6,y6,10 : print x6,y6," saturn"
    
    x7 = w2 + r7 * Cos(t- 3.2 + fRad * 90) : y7 = h2 + r7 * Sin(t- 3.2 + fRad * 90)
    fcolor 130,190,240 : circle x7,y7,6 : print x7,y7," uranus"
    
    x8 = w2 + r8 * Cos(t- 4.2 + fRad * 90) : y8 = h2 + r8 * Sin(t- 4.2 + fRad * 90)
    fcolor 130,190,160 : circle x8,y8,6 : print x8,y8," neptune"
    
    x9 = w2 + r9 * Cos(t- 5.5 + fRad * 90) : y9 = h2 + r9 * Sin(t- 5.5 + fRad * 90)
    fcolor 160,160,160 : circle x9,y9,5 : print x9,y9," pluto"
    
    t = t + 0.001666
    swap
    
    goto start
    
     
  • Zlatko Vidlanovic

    MoveImage

    'test load image
    ptr img,img2,img3
    ptr wmKeyDown, wmTimer
    var wp,ix,iy,p,ex,ey
    wcolor 200,200,210
    fcolor 180,60,100 : print 110,10,"Test Load Bitmap Image into handler"
    'syntax-> LoadImg (1)hImg , (3)str "img.bmp" ,(5)imgType , (7)w , (9)h, (11)colorFlags
    LoadImg img,"spaceMoon.bmp" , 0, 646, 438,16 
    'print value of img handler  / if value not null -> OK!
    print 10,440,"image handler value:" : print 10,460,img
    'show img on window
    ShowImgT img,0,0,646,438 
    'load another image 
    LoadImg img2,"craft2.bmp" , 0, 116, 48,16
    LoadImg img3,"satelite2.bmp" , 0, 40, 40,24
    ShowImgT img3,300, 300, 40, 40 
    ex = 300 : ey = 300
    updateScreen()
    
    'events...
    WinMsg wmKEYDOWN
    
    hWparam wp
    'vkLEFT -----------------------------------
    if wp = 37 
       if ix > 0 : ix = ix - 6 :endif
    endif
    
    'vkRIGHT ?----------------------------------
    if wp = 39 
       if ix < 500 : ix = ix + 6 : endif
    endif
    
    'vkUP --------------------------------------
    if wp = 38
         if iy > 0 : iy = iy - 6 :endif
    endif 
    
    'vkDOWN -------------------------------------- 
    if wp = 40
        if iy < 420 : iy = iy + 6 :endif
    endif
    
    while wp ! 27 
    
     updateBack() 
      updateScreen()  
       updateShip()  
    
        'updateBullet()
        updateEnemy()
        'testCollision()
        'delay loop
       '  p=0
       ' while p < 800
        ' p=p+0.01
       'wend
    'ShowImg img,0,0,646,438 
    wend
    
    EndWm
    
    func updateScreen()
       fcolor 80,80,100   : rect 524,5,68,24   
       fcolor 100,160,220 : print 530,10,ix 
       fcolor 80,80,100   : rect 524,34,68,24
       fcolor 100,160,220  : print 530,38,iy
    ShowImgT img3, ex, ey, 40, 40 
    ShowImgT img2,ix,iy,116,48 
    endfn
    
    func updateBack()
     ShowImgT img,0,0,646,438
    endFn
    
    func updateShip()
      ShowImgT img2,ix,iy,116,48 
    swap  
    endFn
    
    func updateEnemy()
       if ex < 600 : ex = ex + 1 : endif
       if ex = 598 : ex = 10 : endif
    endfn
    
     
  • Zlatko Vidlanovic

    Jungle life

    'test demo in gdi
    ptr img,img2,img3
    ptr wmKeyDown, wmTimer
    var wp,ix,iy,p,ex,ey
    wcolor 200,200,210
    fcolor 180,60,100 : print 110,10,"Test Load Bitmap Image into handler"
    'syntax-> LoadImg (1)hImg , (3)str "img.bmp" ,(5)imgType , (7)w , (9)h, (11)colorFlags
    LoadImg img,"Jungle.bmp" , 0, 640, 360,16 
    'print value of img handler  / if value not null -> OK!
    print 10,440,"Jungle Life m(A)" 
    print 10,460,"Move ship with arrow keys..."
    'show img on window
    ShowImgT img,0,0,640,360 
    'load another image 
    LoadImg img2,"craft2.bmp" , 0, 116, 48,16
    LoadImg img3,"satelite2.bmp" , 0, 40, 40,24
    ShowImgT img3,300, 300, 40, 40 
    ex = 300 : ey = 300
    updateScreen()
    
    'events...
    WinMsg wmKEYDOWN
    
    hWparam wp
    'vkLEFT -----------------------------------
    if wp = 37 
       if ix > 0 : ix = ix - 6 :endif
    endif
    
    'vkRIGHT ?----------------------------------
    if wp = 39 
       if ix < 500 : ix = ix + 6 : endif
    endif
    
    'vkUP --------------------------------------
    if wp = 38
         if iy > 0 : iy = iy - 6 :endif
    endif 
    
    'vkDOWN -------------------------------------- 
    if wp = 40
        if iy < 420 : iy = iy + 6 :endif
    endif
    
    while wp ! 27 
    
     updateBack() 
      updateScreen()  
       updateShip()  
    
        'updateBullet()
        updateEnemy()
        'testCollision()
        'delay loop
       '  p=0
       ' while p < 800
        ' p=p+0.01
       'wend
    swap
    'ShowImg img,0,0,646,438 
    wend
    
    EndWm
    
    func updateScreen()
       fcolor 80,80,100   : rect 524,5,68,24   
       fcolor 100,160,220 : print 530,10,ix 
       fcolor 80,80,100   : rect 524,34,68,24
       fcolor 100,160,220  : print 530,38,iy
    ShowImgT img3, ex, ey, 40, 40 
    ShowImgT img2,ix,iy,116,48 
    endfn
    
    func updateBack()
     ShowImgT img,0,0,640,360
    endFn
    
    func updateShip()
      ShowImgT img2,ix,iy,116,48   
    endFn
    
    func updateEnemy()
       if ex < 600 : ex = ex + 1 : endif
       if ex = 598 : ex = 10 : endif
    endfn
    
     
  • Zlatko Vidlanovic

    Move with key UPDATED

    'windows messages test - moving letter "A" 
    var r,g,b , mx , my, cx,cy, wp ,tmp
    ptr wmMouseMove ,wmKeyDown
    r = 255 : g = 255 : B = 255 : cy = 200 : cx = 300
    wcolor r,g,b : fcolor 40,80,100
    print 100,10,"testing WM_MOUSEMOVE and WM_KEYDOWN in micro(A)"
    print 6,10,"mx"
    print 6,40,"my"
    fcolor 220,10,10 : print cx,cy,"A"
    
    WinMsg wmMOUSEMOVE
    
       mousex mx
       mousey my
       fcolor 0,0,0 :rect 24,5,68,24   
       fcolor 100,160,220 : print 30,10,mx 
       fcolor 0,0,0 :rect 24,35,68,24   
       fcolor 100,160,220 : print 30,40,my
       fcolor 30,170,100 : pset mx,my
       update()
    EndWm
    
    WinMsg wmKEYDOWN
    
    hWparam wp
    'vkLEFT ?
    if wp = 37
       tmp = cx  : wcolor 255,255,255 : print tmp,cy," " 
       cx = cx - 10
       fcolor 10,10,230 : print cx,cy,"A"
        'tmp = cx+10  : fcolor 255,255,255 : print tmp,cy," "
        update()
    endif
    
    'vkRIGHT ?
    if wp = 39
       tmp = cx  : wcolor 255,255,255 : print tmp,cy," " 
       cx = cx + 20
       fcolor 10,140,30 : print cx,cy,"A"
       update()
    endif
    
    EndWm
    
    func update()
    fcolor 0,0,0 :rect 24,5,68,24   
       fcolor 100,160,220 : print 30,10,mx 
       fcolor 0,0,0 :rect 24,35,68,24   
       fcolor 100,160,220 : print 30,40,my
       fcolor 30,170,100 : pset mx,my
       swap
    endfn
    
     
  • Zlatko Vidlanovic

    PONG in micro(A)
    'origin by Aurel

    ' pong game in micro(A) use o2_compile function
    $ filename "Pong.exe"
    include "rtl32.inc"
    include "window.inc"
    
    Window "Pong in micro(A) by Aurel",320, 240, 1
    
    'SetFPS 10
    
    x = 50
    y = 50
    x2 = 130
    y2 = 160
    pspeed = 1
    xadj = 1
    yadj = 1
    delay = 1
    score = 0
    
    'haha = "wav/haha.wav"
    'pong = "wav/pong.wav"
    
    WHILE Key(27) = 0
      ClsColor (200, 200, 247)
      Circle   (x, y, 8, 0, 0, 255)
      FillBox  (x2, y2, 30, 4, 255, 255, 255)
      Box      (20, 20, 280, 160, 4,255, 255, 0)
      Text     (10, 0, "SCORE:" & score, 255, 0, 0)
      IF y <= 20 
        yadj = 1
        'PlayWav pong
      END IF
      IF y >= 180 
        yadj = -1
       ' PlayWav pong
      END IF
      IF x >= 300 
        xadj = -1
       ' PlayWav pong
      END IF
      IF x <= 20 
        xadj = 1
       ' PlayWav pong
      END IF
      IF Key(37) AND x2 > 18  :  x2 = x2 - pspeed : end if
      IF Key(39) AND x2 < 270 :  x2 = x2 + pspeed : end if
      x = x + xadj
      y = y + yadj
      IF y > y2 - 7 AND y2 < y2 + 2 AND x < x2 + 30 AND x > x2 
        yadj = -1
        score = score + 1
      END IF
      IF y > y2 + 10 
        'Text( sys x, y, string txt, sys r,g,b) 
        Text (100, 200, "GAME OVER!", 0, 160, 55)
        'Playwav haha
        Waitkey(27)
        score = 0
        x = 5
        y = 5
        x2 = 130
        y2 = 150
      END IF
      FlipBuffer()
      SetFps 60
    WEND
    WinEnd
    
     
  • Zlatko Vidlanovic

    GDI Robot in bush:

    'gdi 2d platformer robot demo 3.7.2023
    ptr img0,img1,img2,img3,img4 
    ptr wmKeyDown
    var wp,ix,iy,p,ex,ey,lx,ly,bx,by,cell, tmpx,tmpy,tmpCell
    var bx1,by1,bx2,by2,bx3,by3
    var tbx ,tby ,bushCell ,tbx1 ,tby1 ,bushCell1 ,tbx2 ,tby2 ,bushCell2, tbx3 ,tby3 ,bushCell3
    var plants[360] ,plantCell ,i, pcx, pcy, col, tempX, energy ,run 
    'var moveLeft,moveRight,moveUp,moveDown
    wcolor 0,0,0:swap
    'syntax-> LoadImg (1)hImg , (3)str "img.bmp" ,(5)imgType , (7)w , (9)h, (11)colorFlags 
    'load another image
    'LoadImage(0, strRes, imgType, imgW, imgH, cFlag)
    LoadImg img0,"grid.bmp"  ,0, 770,482, 24
    'green blocks
    LoadImg img1,"bush.bmp"  ,0, 32,32, 24
    'print 10,200,img1
    LoadImg img2,"player4.bmp",0, 32,32, 24
    'print 10,250,img2
    LoadImg img3,"alien.bmp",0, 32,32, 24
    'print 10,300,img3
    LoadImg img4,"plant.bmp",0, 32,32, 24
    'plant img
    ShowImgT img4, 32*5, 32*2, 40, 40
    energy = 100 : info() : fillPlants()
    bx = 128 : by = bx + 32 : bx1 = 256 : by1 = bx1 + 32 : bx2 = 384 : by2 = 128 + 32 : bx3 = 512 : by3 = 288
    updateBush() : updateBush1() : updateBush2() : updateBush3() 
    ex = 300 : ey = 300 
    
    run = 1
    'main loop
    While run = 1
    'read keys...
    hWparam wp
    'vkLEFT -------------------------------------------
    if wp = 37
          if ix > 0 : ix = ix - 32 : endif
    endif
    
    'vkRIGHT ?-----------------------------------------
    if wp = 39
          if ix < 736 : ix = ix + 32 : endif
    endif
    
    'vkUP --------------------------------------------
    if wp = 38
         if iy > 0 : iy = iy - 32 : endif
    endif 
    
    'vkDOWN -----------------------------------------
    if wp = 40
          if iy < 436 : iy = iy + 32 : endif
    endif
    
    '--------------------------------------------------
    
        updateBack()  
        updatePosition()
        'updatePlants()
        updatePlayer() 
        updatePlants()
    
    swap
    
    Wend
    
    func updatePosition()
       fcolor 80,80,100    : rect 524,512,68,24  : fcolor 100,160,220  : print 530,514,ix 
       fcolor 80,80,100    : rect 610,512,68,24  : fcolor 100,160,220  : print 612,514,iy
       'calculate cell position using sprite upper/left pixel pos
       tmpx = int((ix + 32) / 32)
       'tmpy = int((iy + 32) / 32)
       tmpy = int(iy/32) + 1
       'calc temp cell
       'tmpCell = tmpx + tmpy -> player cell
       tmpCell = int(iy/32)*24 + int(ix/32) + 1 
    
       fcolor 180,100,50  : rect 306,512,56,24 : print 310,514, tmpx
       fcolor 180,100,50  : rect 406,512,56,24 : print 410,514, tmpy
       'show cell number
       fcolor 50,170,100  : rect 206,512,56,24 : print 210,514, tmpCell
    
      if tmpCell = bushCell
          energy = energy - 1
          fcolor 50,170,100  : rect 206,482,56,24 : print 210,484,energy
          ix = ix + 32  ' move player one cell 
      endif 
      if tmpCell = bushCell1
          energy = energy - 1
          fcolor 50,170,100  : rect 206,482,56,24 : print 210,484,energy
          ix = ix + 32  ' move player one cell 
      endif
      if tmpCell = bushCell2
          energy = energy - 1
          fcolor 50,170,100  : rect 206,482,56,24 : print 210,484,energy
          ix = ix + 32  ' move player one cell 
      endif
      if tmpCell = bushCell3
          energy = energy - 1
          fcolor 50,170,100  : rect 206,482,56,24 : print 210,484,energy
          ix = ix + 32  ' move player one cell 
      endif
    
    endfn
    '----------------------------------------
    func updateBack()
      ShowImgT img0,0,0,770,482
      updateBush() : updateBush1() : updateBush2() : updateBush3()
      'update plant
      'updatePlants()
    endFn
    '----------------------------------------
    func updatePlayer()
      ShowImgT img2,ix,iy,32,32  
    endFn
    '-----------------------------------------
    func updateEnemy()
       if ex < 600 : ex = ex + 1 : endif
       if ex = 598 : ex = 10 : endif
       fcolor 0,0,0 : rect 0,0,800,512 
       ShowImgT img3, ex, ey, 40, 40 
    swap
    endfn
    '------------------------------------------------
    func updateBush()
       ShowImgT img1,bx,by,32,32 
       'calculate bush position
         tbx = int((bx + 32) / 32)
         tby = int(by/32) + 1
         bushCell = int(by/32)*24 + int(bx/32) + 1 
    endFn
    '------------------------------------------------
    func updateBush1()
       ShowImgT img1,bx1,by1,32,32 
       'calculate bush1 position
         tbx1 = int((bx1 + 32) / 32)
         tby1 = int(by1/32) + 1
         bushCell1 = int(by1/32)*24 + int(bx1/32) + 1 
    endFn
    '------------------------------------------------
    func updateBush2()
       ShowImgT img1,bx2,by2,32,32 
       'calculate bush2 position
         tbx2 = int((bx2 + 32) / 32)
         tby2 = int(by2/32) + 1
         bushCell2 = int(by2/32)*24 + int(bx2/32) + 1 
    endFn
    '-------------------------------------------------
    func updateBush3()
       ShowImgT img1,bx3,by3,32,32 
       'calculate bush2 position
         tbx3 = int((bx3 + 32) / 32)
         tby3 = int(by3/32) + 1
         bushCell3 = int(by3/32)*24 + int(bx3/32) + 1 
    endFn
    '-------------------------------------------------
    func updatePlants()
        i=1 : pcx = 0 : pcy = 0
        while i < 361
    
              plants[1] = 0          
               if plants[i] = 1
                   'show plant sprite 
                   ShowImgT img4, pcx, pcy, 32, 32 
               endif
              ' if plants[i] = 0
               '   print pcx,pcy,"0" 
              ' endif 
    
              pcx = pcx + 32
              'modulus operator work
              cell = (i % 24)*24
              if cell = i :  pcy = pcy + 32 :pcx = 0  : endif
    
              'check bush positions   
              if bushCell  = i : plants[i] = 0 : endif
              if bushCell1 = i : plants[i] = 0 : endif
              if bushCell2 = i : plants[i] = 0 : endif
              if bushCell3 = i : plants[i] = 0 : endif
    
              if tmpCell = i : plants[i] = 0 : endif
    
        i = i + 1
        wend
    endfn
    
    func fillPlants()
    'fill plants array with rand 0 or 1
    i=1
    while i < 361
        plants[i] = rand(1)    
    i = i + 1
    wend 
    
    endfn
    
    '*********************************************
    '***  I N F O   ******************************
    '*********************************************
    func info()
    'clear screen 
    fcolor 0,0,0 : rect 6,518,200,32 :
    fcolor 200,180,100: print 10,520,"Robot by Aurel"
    fcolor 50,190,100 : print 140,484,"ENERGY:"
    print 140,514,"CELL:"
    rect 206,482,56,24 : print 210,484,energy
    fcolor 180,100,50  : print 270,514,"ROW:" : print 370,514,"COL:"
    endfn
    
     
  • Zlatko Vidlanovic

    'qb program starfield.bas
    var num,inc,vis,i : mode 1 : wcolor 0,0,0 : swap
    num = 200 : inc = 40 : vis = 50
    var x[num]
    var y[num]
    var z[num]
    'fill
    i=1
    while i < num
    x[i] = RAND(640) - 320
    y[i] = RAND(480) - 240
    z[i] = RAND(vis)
    i=i+1
    wend
    
    label doLoop
    rect 0,0,800,600
    i=1
    while i < num
    fcolor 200,230,250
    PSET inc * (x[i] / z[i]) + 320 , inc * (y[i] / z[i]) + 240
    
    IF z[i] < 1 
    z[i] = vis
    x[i] = RAND(640) - 320
    y[i] = RAND(480) - 240
    ELSE
    z[i] = z[i] - 1
    ENDIF
    
    'PSET (INC * (x(i) / z(i)) + 160, INC * (y(i) / z(i)) + 100), z(i) MOD 17 + 15
    
    i=i+1
    wend
    swap
    goto doLoop
    
     
  • Zlatko Vidlanovic

    ~'gdi 2d platformer robot demo 3.7.2023
    ptr img0,img1,img2,img3,img4 
    ptr wmKeyDown
    var wp,ix,iy,p,ex,ey,lx,ly,bx,by,cell, tmpx,tmpy,tmpCell
    var bx1,by1,bx2,by2,bx3,by3
    var tbx ,tby ,bushCell ,tbx1 ,tby1 ,bushCell1 ,tbx2 ,tby2 ,bushCell2, tbx3 ,tby3 ,bushCell3
    var plants[360] ,plantCell ,i, pcx, pcy, col, tempX, energy ,run 
    'var moveLeft,moveRight,moveUp,moveDown
    wcolor 0,0,0:swap
    'syntax-> LoadImg (1)hImg , (3)str "img.bmp" ,(5)imgType , (7)w , (9)h, (11)colorFlags 
    'load another image
    'LoadImage(0, strRes, imgType, imgW, imgH, cFlag)
    LoadImg img0,"grid.bmp"  ,0, 770,482, 24
    'green blocks
    LoadImg img1,"bush.bmp"  ,0, 32,32, 24
    'print 10,200,img1
    LoadImg img2,"player4.bmp",0, 32,32, 24
    'print 10,250,img2
    LoadImg img3,"alien.bmp",0, 32,32, 24
    'print 10,300,img3
    LoadImg img4,"plant.bmp",0, 32,32, 24
    'plant img
    ShowImgT img4, 32*5, 32*2, 40, 40
    info() : fillPlants() : energy = 100
    bx = 128 : by = bx + 32 : bx1 = 256 : by1 = bx1 + 32 : bx2 = 384 : by2 = 128 + 32 : bx3 = 512 : by3 = 288
    updateBush() : updateBush1() : updateBush2() : updateBush3() 
    ex = 300 : ey = 300 
    
    run = 1
    'main loop
    While run = 1
    'read keys...
    hWparam wp
    'vkLEFT -------------------------------------------
    if wp = 37
          if ix > 0 : ix = ix - 32 : endif
    endif
    
    'vkRIGHT ?-----------------------------------------
    if wp = 39
          if ix < 736 : ix = ix + 32 : endif
    endif
    
    'vkUP --------------------------------------------
    if wp = 38
         if iy > 0 : iy = iy - 32 : endif
    endif 
    
    'vkDOWN -----------------------------------------
    if wp = 40
          if iy < 436 : iy = iy + 32 : endif
    endif
    
    '--------------------------------------------------
    
        updateBack()  
        updatePosition()
        'updatePlants()
        updatePlayer() 
        updatePlants()
    
    swap
    
    Wend
    
    func updatePosition()
       fcolor 80,80,100    : rect 524,512,68,24  : fcolor 100,160,220  : print 530,514,ix 
       fcolor 80,80,100    : rect 610,512,68,24  : fcolor 100,160,220  : print 612,514,iy
       'calculate cell position using sprite upper/left pixel pos
       tmpx = int((ix + 32) / 32)
       'tmpy = int((iy + 32) / 32)
       tmpy = int(iy/32) + 1
       'calc temp cell
       'tmpCell = tmpx + tmpy -> player cell
       tmpCell = int(iy/32)*24 + int(ix/32) + 1 
    
       fcolor 180,100,50  : rect 306,512,68,24 : print 310,514, tmpx
       fcolor 180,100,50  : rect 406,512,68,24 : print 410,514, tmpy
       'show cell number
       fcolor 50,170,100  : rect 206,512,68,24 : print 210,514, tmpCell
    
      if tmpCell = bushCell
          energy = energy - 1
          fcolor 50,170,100  : rect 206,482,68,24 : print 210,484,energy
          ix = ix + 32  ' move player one cell 
      endif 
      if tmpCell = bushCell1
          energy = energy - 1
          fcolor 50,170,100  : rect 206,482,68,24 : print 210,484,energy
          ix = ix + 32  ' move player one cell 
      endif
      if tmpCell = bushCell2
          energy = energy - 1
          fcolor 50,170,100  : rect 206,482,68,24 : print 210,484,energy
          ix = ix + 32  ' move player one cell 
      endif
      if tmpCell = bushCell3
          energy = energy - 1
          fcolor 50,170,100  : rect 206,482,68,24 : print 210,484,energy
          ix = ix + 32  ' move player one cell 
      endif
    
    endfn
    '----------------------------------------
    func updateBack()
      ShowImgT img0,0,0,770,482
      updateBush() : updateBush1() : updateBush2() : updateBush3()
      'update plant
      'updatePlants()
    endFn
    '----------------------------------------
    func updatePlayer()
      ShowImgT img2,ix,iy,32,32  
    endFn
    '-----------------------------------------
    func updateEnemy()
       if ex < 600 : ex = ex + 1 : endif
       if ex = 598 : ex = 10 : endif
       fcolor 0,0,0 : rect 0,0,800,512 
       ShowImgT img3, ex, ey, 40, 40 
    swap
    endfn
    '------------------------------------------------
    func updateBush()
       ShowImgT img1,bx,by,32,32 
       'calculate bush position
         tbx = int((bx + 32) / 32)
         tby = int(by/32) + 1
         bushCell = int(by/32)*24 + int(bx/32) + 1 
    endFn
    '------------------------------------------------
    func updateBush1()
       ShowImgT img1,bx1,by1,32,32 
       'calculate bush1 position
         tbx1 = int((bx1 + 32) / 32)
         tby1 = int(by1/32) + 1
         bushCell1 = int(by1/32)*24 + int(bx1/32) + 1 
    endFn
    '------------------------------------------------
    func updateBush2()
       ShowImgT img1,bx2,by2,32,32 
       'calculate bush2 position
         tbx2 = int((bx2 + 32) / 32)
         tby2 = int(by2/32) + 1
         bushCell2 = int(by2/32)*24 + int(bx2/32) + 1 
    endFn
    '-------------------------------------------------
    func updateBush3()
       ShowImgT img1,bx3,by3,32,32 
       'calculate bush2 position
         tbx3 = int((bx3 + 32) / 32)
         tby3 = int(by3/32) + 1
         bushCell3 = int(by3/32)*24 + int(bx3/32) + 1 
    endFn
    '-------------------------------------------------
    func updatePlants()
        i=1 : pcx = 0 : pcy = 0
        while i < 361
    
    
              plants[1] = 0          
               if plants[i] = 1 
                   ShowImgT img4, pcx, pcy, 32, 32 
               endif
              ' if plants[i] = 0
               '   print pcx,pcy,"0" 
              ' endif 
    
              pcx = pcx + 32 
              if i = 24 :  pcy = pcy + 32 :pcx = 0  : endif
              if i = 48 :  pcy = pcy + 32 :pcx = 0  : endif 
              if i = 72 :  pcy = pcy + 32 :pcx = 0  : endif
              if i = 96 :  pcy = pcy + 32 :pcx = 0  : endif
              if i = 120 : pcy = pcy + 32 :pcx = 0  : endif
              if i = 144 : pcy = pcy + 32 :pcx = 0  : endif 
              if i = 168 : pcy = pcy + 32 :pcx = 0  : endif
              if i = 192 : pcy = pcy + 32 :pcx = 0  : endif
              if i = 216 : pcy = pcy + 32 :pcx = 0  : endif
              if i = 240 : pcy = pcy + 32 :pcx = 0  : endif
              if i = 264 : pcy = pcy + 32 :pcx = 0  : endif
              if i = 288 : pcy = pcy + 32 :pcx = 0  : endif
              if i = 312 : pcy = pcy + 32 :pcx = 0  : endif
              if i = 336 : pcy = pcy + 32 :pcx = 0  : endif
    
              if bushCell = i : plants[i] = 0 : endif
              if bushCell1 = i : plants[i] = 0 : endif
              if bushCell2 = i : plants[i] = 0 : endif
              if bushCell3 = i : plants[i] = 0 : endif
    
    
    
        i = i + 1
        wend
    endfn
    
    func fillPlants()
    'fill plants array with rand 0 or 1
    i=1
    while i < 361
        plants[i] = rand(1)    
    i = i + 1
    wend 
    
    endfn
    
    '*********************************************
    '***  I N F O   ******************************
    '*********************************************
    func info()
    'clear screen 
    fcolor 0,0,0 : rect 6,518,200,32 :
    fcolor 200,180,100: print 10,520,"GDI Robot by Aurel"
    endfn
    
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.