InvisionFree - Free Forum Hosting
InvisionFree gives you all the tools to create a successful discussion community.

Learn More · Register for Free
Welcome to Wee Basic. We hope you enjoy your visit.


You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free.


Join our community!


If you're already a member please log in to your account to access all of our features:

Name:   Password:


 

 Pong example
axipher
Posted: Oct 25 2007, 02:28 AM


Newbie


Group: Members
Posts: 9
Member No.: 4
Joined: 24-October 07



Just thought I'd post the pong example as well, I had to download the alpha 1 release to get it, but here it is:

CODE
lab 100:
cls
let l=100
let w=50 let f=10
let p=20
print "Wee Basic - Pong demo"
for j=1 to 16
print ""
next
line 3,f,3,w,1
line l,f,l,w,2
line 3,f,l,f,3
line 3,w,l,w,4
print "Press any key to start"
let m=0
while m=0
let m=key()
wend
let X = p
let Y = f+4
let Z = y+1
let d=-1
let k=1
let a=l-1
let b= f+5
let s=1
plot X,Y,1 plot X, Z,1 plot a,b,1

lab begin:
let T= key()
IF T = 206 AND Y < > f+1
 PLOT X,Y,0 PLOT X,Z,0
 let Y = Y - 1 let Z = Z -1
 PLOT X,Y,1 PLOT X,Z,1
 let T = key()
endif
IF T = 207 AND Z < > w-1
 PLOT X,Y,0 PLOT X,Z,0
 let Y = Y + 1 let Z = Z + 1
 PLOT X,Y,1 PLOT X,Z,1
endif

IF a = l-1 let d=-1
endif

IF b >= w-1 let s=-1
endif
if b<=f+1 let s=1
endif

PLOT a,b,0
let a = a + d let b = b + s
PLOT a,b,1

if a=2 goto lose:
endif

IF X + 1 = a AND (Y = b or z=b)
 let k=1
 PLOT a, b,0
 let d = 1
 let a = a + d let b = b + s
 PLOT a,b,1
endif

goto begin:


lab lose:
lab lose:
print ""
PRINT "You Lose"
PRINT "Press A to Play Again...."
print "or any other key to exit"
let m=0
while m=0
let m=key()
wend
IF m=202 cls PLOT a,b,0  PLOT X,Y,0 PLOT X,Z,0 goto 100:
endif
END
Top
marovada
Posted: Oct 25 2007, 07:46 PM


Administrator


Group: Admin
Posts: 39
Member No.: 1
Joined: 7-September 07



thanks axipher
Top
« Next Oldest | Code Samples | Next Newest »
InvisionFree - Free Forum Hosting
InvisionFree gives you all the tools to create a successful discussion community.
Learn More · Register for Free

Topic Options



Hosted for free by InvisionFree* (Terms of Use: Updated 2/10/2010) | Powered by Invision Power Board v1.3 Final © 2003 IPS, Inc.
Page creation time: 0.1075 seconds | Archive