Ooops
January 21, 2021, 02:48:41 AM
Welcome,
Guest
. Please
login
or
register
.
Did you miss your
activation email
?
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Home
Forum
Help
Search
Gallery
Login
Register
SyntaxBomb - Indie Coders
»
Languages & Coding
»
Blitz Code Archives
»
Algorithms
»
[bb] Create 2D terrains by skn3 [ 1+ years ago ]
« previous
next »
Print
Pages: [
1
]
Go Down
Author
Topic: [bb] Create 2D terrains by skn3 [ 1+ years ago ] (Read 393 times)
BlitzBot
Jr. Member
Posts: 1
[bb] Create 2D terrains by skn3 [ 1+ years ago ]
«
on:
June 29, 2017, 12:28:38 AM »
Title :
Create 2D terrains
Author :
skn3
Posted :
1+ years ago
Description :
Creates a nice 2D terrain. In my oppinion, perect random landscapes
Code :
Code: BlitzBasic
Graphics
1024
,
768
,
32
,
1
Repeat
SetBuffer
BackBuffer
(
)
Cls
CreateMap
(
GraphicsWidth
(
)
,
GraphicsHeight
(
)
)
Flip
WaitKey
(
)
Until
KeyDown
(
1
)
=
True
Function
CreateMap
(
width,height
)
y2=height
y1=
(
height-
100
)
/
2
+
Rand
(
50
,
300
)
For
x=
0
To
width
SeedRnd
MilliSecs
(
)
y1=y1+
Cos
(
x
)
*
Rand
(
-
(
Sin
(
x
)
*
Rand
(
5
)
)
,
(
Sin
(
x
)
*
Rand
(
5
)
)
)
If
y1>y2
Then
y1=y2
If
y1<
(
height-
150
)
/
3
Then
y1=
(
height-
150
)
/
3
Plot
x,y1
Next
End Function
Comments :
Berserker [swe](Posted 1+ years ago)
Thank you!This has surely helped me!I have made an edit to the code at: <a href="codearcs71e3.html?code=1339" target="_blank">
http://www.blitzbasic.com/codearcs/codearcs.php?code=1339
[/url]Hope you dont mind.
ozak(Posted 1+ years ago)
And the simple filled terrain edition.Simply replace
Code:
[Select]
Plot x,y1
with
Code:
[Select]
Line x,y1,x+1,GraphicsHeight()
Logged
Print
Pages: [
1
]
Go Up
« previous
next »
SyntaxBomb - Indie Coders
»
Languages & Coding
»
Blitz Code Archives
»
Algorithms
»
[bb] Create 2D terrains by skn3 [ 1+ years ago ]
SimplePortal 2.3.6 © 2008-2014, SimplePortal