Warning

You're browsing the old v2.x documentation. This version is no longer maintained. Click here to go the v3.x documentation.

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
examples [2019/06/26 13:35] neilsexamples [2020/11/12 14:48] (current) neils
Line 19: Line 19:
     if nx < max then goto loop     if nx < max then goto loop
   end   end
 +
 +===== Example 2: Kaleidoscope effect =====
 +
 +Submitted by Eugenio Rapella. Note that it is valid to use line numbers instead of labels in **XC=BASIC**.
 +
 +  1 const D12=12
 +  2 const D55=55296
 +  3 const D40=40
 +  4 const D23=23
      
-===== Example 2: Bouncing ball =====+  10 poke 53280,0:poke 53281,0 
 +  20 for t=0 to 999 
 +  30 poke 1024+t,81 : rem pallino 
 +  40 poke 55296+t,0 : rem nero 
 +  50 next t 
 +  60 let x!=cast!(D12*rnd%()) 
 +  65 let y!=cast!(D12*rnd%()) 
 +  67 let c!=rshift!(rnd!(),4) 
 +   
 +  70 m1 = D40 * y! : m2 = D40 * x! 
 +  75 n1 = D23 - x! : n2 = D23 - y! 
 +   
 +  90 poke D55+x!+m1,c! 
 +  95 poke D55+y!+m2,c! 
 +  100 poke D55+n1+m1,c! 
 +  105 poke D55+n2+m2,c! 
 +  110 poke D55+x!+D40*n2,c! 
 +  115 poke D55+y!+D40*n1,c! 
 +  120 poke D55+n1+D40*n2,c! 
 +  125 poke D55+n2+D40*n1,c! 
 +  130 goto 60 
 + 
 + 
 +===== Example 3: Bouncing ball =====
  
   rem ** bouncing ball **   rem ** bouncing ball **
Line 62: Line 94:
     return     return
          
-===== Example 3: USR() function =====+===== Example 4: USR() function =====
  
 This example implements the << (left shift) operation on an integer for demonstration purposes. This example implements the << (left shift) operation on an integer for demonstration purposes.
Line 87: Line 119:
     "     "
  
-===== Example 4: Puralax!, a game written in XC=BASIC ===== 
- 
-  * Read the [[https://github.com/neilsf/XC-BASIC/blob/master/examples/puralax/puralax.bas|source code]] 
-  * Download the [[https://github.com/neilsf/XC-BASIC/blob/master/examples/puralax/puralax.prg|compiled program]]