|
Post by Gordon Rahman on Jun 15, 2020 18:16:48 GMT -5
Want to try writing a game together? Follow the LB Workshop in the Netherlands here. This is what the game structure looks like. libertybasiccom.proboards.com/attachment/download/200The course starts like this. Build part1 I reached my max (pictures) in this message, so here is the listing. nomainwin WindowWidth =800 WindowHeight = 600
caption$ = str$(int(rnd(0)* 1000)+2) +"th UNIVERSE" 'print caption$
open caption$ for graphics_nsb_nf as #w #w "when rightButtonDown [rBDown]" #w "trapclose [quit]"
#w "down; size 3;fill black" #w "place 400 300"
for t = 1 to 512 step 2 #w "color 0 0 ";t/2 #w "circle "; 512 - t next t
for t = 0 to 255 step 1 #w "color 0 0 ";t #w "circle "; 255-t next t
wait
[quit] close #w end
|
|
|
Post by Gordon Rahman on Jun 16, 2020 18:29:01 GMT -5
Hi Beginner, Finish your first window like this and save it. This will become your background in 4 command centra in the game. I'll post a listing .... and .... a link to the game in progress. Attachments:
|
|
|
Post by Gordon Rahman on Jun 28, 2020 14:32:40 GMT -5
Ok, here is the listing.
nomainwin
WindowWidth = 800 WindowHeight = 600
caption$ = str$(int(rnd(0)* 1000)+2) +"th UNIVERSE" 'print caption$
open caption$ for graphics_nsb_nf as #w #w "when rightButtonDown [rBDown]" #w "trapclose [quit]" #w "down; size 3;fill black" #w "place 400 300"
for t = 1 to 512 step 2 #w "color 0 0 ";t/2 #w "circle "; 512 - t next t
for t = 0 to 255 step 1 #w "color 0 0 ";t #w "circle "; 255-t next t
#w "size 1" call star 900,"12 141 147","3 67 65",800,600,10,10,4 call star 50,"12 141 147","3 67 65",800,600,80,60,8 call star 20,"157 29 15","3 67 65",890,600,80,60,4 call star 20,"157 29 15","3 67 65",890,600,80,60,8 call star 50,"147 151 10","3 67 65",900,700,360,100,10 call star 10,"66 147 4","3 67 65",900,700,360,100,10 call star 20,"101 6 153","3 67 65",800,600,360,100,6 call star 15,"12 141 147","3 67 65",800,400,120,50,26 wait
[rBDown] confirm "plaatje bewaren?";yn$ if yn$ = "yes" then [kiesNaam] wait
[kiesNaam] prompt "naam voor jouw plaatje";heelalNaam$ heelalNaam$ = Upper$(heelalNaam$) if heelalNaam$ = "" then wait end if
#w "getbmp plaat 0 0 800 600" if right$(heelalNaam$,4) <> ".BMP" then heelalNaam$ = heelalNaam$ + ".BMP" print heelalNaam$ bmpsave "plaat",heelalNaam$ :print "done" end if wait
[quit] close #w end
sub star nstars,bkl$,kl$,X1,Y1,xo,yo,r for n = 1 to nstars #w "backcolor "+bkl$ #w "color "+kl$ #w "place ";rnd(0)*(X1-3*xo)+xo;" ";(rnd(0)*(Y1-3*yo))+yo #w "circlefilled ";rnd(0)*r next n end sub
Use the right mouse button to save a screen.
Gordon
|
|
|
Post by Gordon Rahman on Jun 29, 2020 15:02:56 GMT -5
|
|
|
Post by Gordon Rahman on Jul 5, 2020 8:45:30 GMT -5
Here is an example of a technic we will often use.
'Demo at the Compufair 12-4-2014 'G. Rahman
'drag mouse (left-mouse button and move mouse) and draw a box 'hint use rule XOR
nomainwin WindowWidth = 440 WindowHeight = 440 UpperLeftX = 100 UpperLeftY = 100
'het venster open "Rubberband box between mouse and starting point" for graphics_nsb as #w #w "backcolor green" #w "down; rule XOR" #w "when leftButtonDown [startpunt]" #w "when leftButtonMove [dragline]" #w "when leftButtonUp [eindpunt]" wait
[startpunt] startx = MouseX : starty = MouseY lastx = MouseX : lasty = MouseY #w "place ";startx;" ";starty #w "circlefilled 10" wait
[dragline] #w "box ";lastx;" ";lasty #w "box ";MouseX;" ";MouseY lastx = MouseX : lasty = MouseY wait
[eindpunt] #w "place ";lastx;" ";lasty #w "circlefilled 10" wait
|
|
|
Post by Gordon Rahman on Jul 14, 2020 11:33:23 GMT -5
Example to program
Wow this works. Try to program the above screen. Next week I'll post a way to do that. Gordon
|
|
|
Post by Gordon Rahman on Jul 14, 2020 11:48:41 GMT -5
OK, it's next week already.
nomainwin WindowWidth = 800 WindowHeight = 600 UpperLeftX = 500 UpperLeftY = 200
dim knX(10,7),knY(10,7) degtorad = asn(1)/90 global pX,pY,x1,y1,x2,y2,r1,r2,degtorad ',deg pX = 400 :pY = 300
open "Click on the screen" for graphics_nsb_nf as #w #w "trapclose [quit]" #w "when leftButtonDown [startpunt]"
[startpunt] #w "cls" #w "down; size 3; backcolor cyan; place 400 300" #w "circlefilled 30" p = 0: t = 0
for deg = -60 to -360 step -90 '4 truncks t = t + 1 pX = 400 :pY = 300 r1 = 30 :r2 = 250 :bkcl$ ="green" if int(rnd(0)*4)=2 then bkcl$="red" #w "size 2; color black; backcolor ";bkcl$ call stam1,pX,pY,deg,r1,r2 #w "backcolor ";bkcl$ #w "circlefilled 6"
pX = x2 : pY = y2 deg0 = deg-180 r1 = 8 :p=0 for r2 = 40 to 160 step 20 ' max 7 branches per trunck p = p + 1 call stam1,pX,pY,deg0,r1,r2 #w "circlefilled 4" knX(p,t)=x2:knY(p,t)=y2 next r2
for p = 1 to 5 pX = knX(p,t):pY = knY(p,t) deg1 = deg+90 :r1 = 1 : r2 = int((rnd(0)*25)+20) bc$="white" if int(rnd(0)*6)+1=4 then bc$="green" if int(rnd(0)*3)+1=2 then r2 = int((rnd(0)*35)+30) call stam1,pX,pY,deg1,r1,r2, #w "backcolor ";bc$ #w "circlefilled 6" deg2 = deg+270 :r1 = 1 : r2 = int((rnd(0)*45)+40) bc$="white" if int(rnd(0)*3)+1=2 then r2 = 40 if int(rnd(0)*6)+1>4 then bc$="green" call stam1,pX,pY,deg2,r1,r2 #w "backcolor ";bc$ #w "circlefilled 6" next p next deg
for deg = -20 to -180 step -90 '2 nieuwe stammen pX = 400 : pY = 300 deg3 = deg r1 = 30 :r2 = 30 call stam1,pX,pY,deg3,r1,r2 gosub [extraGeleBal] #w "backcolor yellow"
for r2 = 270 to 180 step -20 call stam1,pX,pY,deg3,r1,r2 #w "backcolor yellow" #w "circlefilled 6" gosub [extraGeleBal] next r2
deg4 = 2*deg + 40 'en nog 2 nieuw stammen 'met een andere hoekverdraaiing for r2 = 160 to 80 step -40 call stam1,pX,pY,deg4,r1,r2 #w "backcolor white" #w "circlefilled 6" next r2 next deg wait
[extraGeleBal] return
[quit] close #w end '================--------------================
sub stam1 pX,pY,n,r1,r2 #w "color black" deg = int(n/15)*15 sn = sin(deg*degtorad) cs = cos(deg*degtorad) x1 = pX + cs*r1 : y1 = pY + sn*r1 x2 = pX + cs*r2 : y2 = pY + sn*r2 #w "line ";x1;" ";y1;" ";x2;" ";y2 end sub
The SUB just draws a line with an angle given by deg (degrees) and goes thru pX,pY . The line starts at a circle with radius r1 and goes to a circle with radius r2.
Gordon
|
|