Advanced game related topics
-
Fig
- Enthusiast
- Posts: 351
- Joined: Thu Apr 30, 2009 5:23 pm
- Location: Côtes d'Azur, France
Post
by Fig »
Code: Select all
;* Barnsley fern https://en.wikipedia.org/wiki/Barnsley_fern
#x=800:#y=800
If InitSprite() = 0 Or InitKeyboard() = 0 Or InitMouse() = 0 Or OpenWindow(0, 0, 0, #X+1, #Y+1, "Barnsley fern", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)=0 Or OpenWindowedScreen(WindowID(0),0,0,#X+1,#Y+1,0,0,0,#PB_Screen_NoSynchronization )=0
MessageRequester("Error", "Can't open the sprite system", 0)
End
EndIf
x.f=0.0:y.f=0.0:xn.f=0.0:yn.f=0.0
px.f=0.0:py.f=0.0
CreateSprite(0,#x+1,#y+1)
Repeat
FlipBuffers()
ExamineKeyboard()
StartDrawing(SpriteOutput(0))
For i=1 To 100
r.i=Random(100)
If r<2
xn=0
yn=0.16*y
ElseIf r<87
xn= 0.85*x + 0.04*y
yn= -0.04*x + 0.85*y + 1.6
ElseIf r<94
xn= 0.2* x + -0.26*y
yn= 0.23*x + 0.22*y + 1.6
Else
xn= -0.15*x + 0.28*y
yn= 0.26*x + 0.24*y + 0.44
EndIf
px=(xn+2.1820)*#x/4.8378
py=yn*#y/9.9983
py=Abs(py-#y)
;scale to the screen
Plot(Int(px),Int(py),#Green)
x=xn:y=yn
Next i
StopDrawing()
DisplaySprite(0,0,0)
While WindowEvent()
Wend
Until KeyboardPushed(#PB_Key_Escape)
Last edited by
Fig on Sat Jun 23, 2018 7:28 am, edited 2 times in total.
There are 2 methods to program bugless.
But only the third works fine.
Win10, Pb x64 5.71 LTS
-
idle
- Always Here
- Posts: 5092
- Joined: Fri Sep 21, 2007 5:52 am
- Location: New Zealand
Post
by idle »
Timely example fig, the All Blacks are going to play against the French's this evening
add in
Code: Select all
StopDrawing()
DisplaySprite(0,0,0)
While WindowEvent()
Wend
Until KeyboardPushed(#PB_Key_Escape)
so window doesn't hang.
Windows 11, Manjaro, Raspberry Pi OS
-
Fig
- Enthusiast
- Posts: 351
- Joined: Thu Apr 30, 2009 5:23 pm
- Location: Côtes d'Azur, France
Post
by Fig »
yes, i often forget that in small snippets...
I corrected it, thank you.
There are 2 methods to program bugless.
But only the third works fine.
Win10, Pb x64 5.71 LTS
-
Trond
- Always Here
- Posts: 7446
- Joined: Mon Sep 22, 2003 6:45 pm
- Location: Norway
Post
by Trond »
Interesting and neat. Thanks for sharing it.
-
davido
- Addict
- Posts: 1890
- Joined: Fri Nov 09, 2012 11:04 pm
- Location: Uttoxeter, UK
Post
by davido »
@
Fig,
Nicely done.
Thank you for sharing.
DE AA EB
-
Kwai chang caine
- Always Here
- Posts: 5353
- Joined: Sun Nov 05, 2006 11:42 pm
- Location: Lyon - France
Post
by Kwai chang caine »
Very nice, thanks
The happiness is a road...
Not a destination
-
dige
- Addict
- Posts: 1252
- Joined: Wed Apr 30, 2003 8:15 am
- Location: Germany
-
Contact:
Post
by dige »
the magic of mathematics..
"Daddy, I'll run faster, then it is not so far..."
-
RSBasic
- Moderator
- Posts: 1218
- Joined: Thu Dec 31, 2009 11:05 pm
- Location: Gernsbach (Germany)
-
Contact:
Post
by RSBasic »
Small code but nice effect.
-
_aNdy_
- User
- Posts: 40
- Joined: Fri Jun 17, 2016 12:06 am
-
Contact:
Post
by _aNdy_ »
Really interesting! Thanks for share!
-
Fig
- Enthusiast
- Posts: 351
- Joined: Thu Apr 30, 2009 5:23 pm
- Location: Côtes d'Azur, France
Post
by Fig »
idle wrote:Timely example fig, the All Blacks are going to play against the French's this evening
We all know for sure, Blacks is always the best team.
Too bad for us, poor froggies.
Thank you all for your nice comments.
There are 2 methods to program bugless.
But only the third works fine.
Win10, Pb x64 5.71 LTS
-
idle
- Always Here
- Posts: 5092
- Joined: Fri Sep 21, 2007 5:52 am
- Location: New Zealand
Post
by idle »
Fig wrote:idle wrote:Timely example fig, the All Blacks are going to play against the French's this evening
We all know for sure, Blacks is always the best team.
Too bad for us, poor froggies.
Thank you all for your nice comments.
Problem is everytime we play the french, I bet on the French to win!
Windows 11, Manjaro, Raspberry Pi OS
-
zefiro_flashparty
- User
- Posts: 74
- Joined: Fri Mar 04, 2005 7:46 pm
- Location: argentina
Post
by zefiro_flashparty »
nice!
Amd Vishera fx8350 ,16Gbram, Gtx650 ti, 2gb,Win 10pro. 13tbs.