January 20, 2021, 02:04:46 PM

### Author Topic: [bb] Quick Planets by _PJ_ [ 1+ years ago ]  (Read 636 times)

#### BlitzBot

• Jr. Member
• Posts: 1
##### [bb] Quick Planets by _PJ_ [ 1+ years ago ]
« on: June 29, 2017, 12:28:40 AM »
Title : Quick Planets
Author : _PJ_
Posted : 1+ years ago

Description : Uses some simple routines to randomly generate a selection of planet textures to give quick, on-the-fly visuals.

Very messy code (sorry, if I get the chance soon, Il clean it up) - it's just lifted straight from where I was toying with it. Anyway, it should be easy to implement into a custom function.

Code :
Code: BlitzBasic
1. Function createplanettexture(t)
2.
3. t=CreateTexture(256,256)
4.
5. SetBuffer TextureBuffer(t)
6.
7. ClsColor 0,0,0
8. Cls
9.
10. SeedRnd MilliSecs()
11. colred=Rand(80,160)
12. colgreen=Rand(80,160)
13. colblue=Rand(80,160)
14.
15. d=Rand(6)
16.
17. For g=0 To 32
18. For h=32 To 0 Step-1
19.
20. If d=0
21. Color g*4,colgreen+g,h*2
22. Rect 0,g,256,1,1
23. Color h*3,colgreen+g,g*3
24. Rect 0,g+h+32,256,1,1
25. Color g*4,colgreen+g,h*4
26. Rect 0,g+64,256,1,1
27. Color h*2,colgreen+g,g*2
28. Rect 0,g+h+96,256,1,1
29. Color g*5,colgreen+g,h*3
30. Rect 0,g+128,256,1,1
31. Color h*3,colgreen+g,g*4
32. Rect 0,g+h+160,256,1,1
33. Color g*2,colgreen+g,h*3
34. Rect 0,g+192,256,1,1
35. Color h*3,colgreen+g,g*2
36. Rect 0,g+h+224,256,1,1
37. Color g*5,colgreen+g,h*3
38. Rect 0,g+224,256,1,1
39. Color h*3,colgreen+g,g*4
40. Rect 0,g+h+256,256,1,1
41. End If
42.
43.
44. If d=1
45. Color colred+g+h,colgreen+g/2,h*2
46. Rect 0,g,256,1,1
47. Color colred+g-h,colgreen+h/2,h*2
48. Rect 0,g+h+32,256,1,1
49. Color colred+g+h,colgreen+g/2,h*2
50. Rect 0,g+64,256,1,1
51. Color colred+g-h,colgreen+h/2,h*2
52. Rect 0,g+h+96,256,1,1
53. Color colred+g+h,colgreen+g/2,h*2
54. Rect 0,g+128,256,1,1
55. Color colred+g-h,colgreen+h/2,h*2
56. Rect 0,g+h+160,256,1,1
57. Color colred+g+h,colgreen+g/2,h*2
58. Rect 0,g+192,256,1,1
59. Color colred+g-h,colgreen+h/2,h*2
60. Rect 0,g+h+224,256,1,1
61. Color colred+g+h,colgreen+g/2,h*2
62. Rect 0,g+224,256,1,1
63. Color colred+g-h,colgreen+h/2,h*2
64. Rect 0,g+h+256,256,1,1
65. End If
66.
67. If d=2
68.
69. For i=1 To 300
70.
71. lx=Rand(256)
72. ly=Rand(256)
73.
74. Color colred+(ly/10),colgreen+(ly/10),colblue
75. Line lx,ly,lx+(Rand(5,30)),ly
76. Color colred,colgreen,colblue
77. Line lx,ly+1,lx+(Rand(5,25)),ly+1
78. Next
79.
80. EndIf
81.
82. If d=3
83. Color Colred/2,colgreen/2,g+colblue/10
84. Rect 0,g,256,1,1
85. Color Colred/2,colgreen/2,g+32+colblue/10
86. Rect 0,g+32,256,1,1
87. Color Colred/2,colgreen/2,g+64+colblue/10
88. Rect 0,g+64,256,1,1
89. Color Colred/2,colgreen/2,g+96+colblue/10
90. Rect 0,g+96,256,1,1
91. Color Colred/2,colgreen/2,g+128+colblue/10
92. Rect 0,g+128,256,1,1
93. Color Colred/2,colgreen/2,g+160+colblue/10
94. Rect 0,g+160,256,1,1
95. Color Colred/2,colgreen/2,g+192+colblue/10
96. Rect 0,g+192,256,1,1
97. Color Colred/2,colgreen/2,g+224+colblue/10
98. Rect 0,g+224,256,1,1
99. EndIf
100.
101.
102.
103.
104.
105.
106.
107.
108.
109.
110.
111.
112.
113.
114.
115. If d=5
116. for i=1 to 500
117. Color colred+(Rand(h)),colgreen+(Rand(g)),colblue+(Rand(h))
118. Plot Rand(255),Rand(255)
119. next
120. EndIf
121.
122.
123.
124.
125.
126.
127.
128.
129.
130. Next
131. Next
132.
133.
134. If d=3
135. lx1=Rand(64,192)
136. ly1=Rand(64,192)
137.
138. For g=1 To 5000
139. mx1=lx1+(Rand(-32,32))
140. my1=ly1+(Rand(-32,32))
141. If mx1<1 Then mx1=1
142. If mx1>254 Then mx1=254
143. If my1<1 Then my1=1
144. If my1>254 Then my1=254
145.
146. Color colred*2,colgreen*1.5,colblue*0.7
147. Line lx1,ly1,mx1,my1
148. Color colred,colgreen,colblue/2
149. Line lx1-1,ly1-1,mx1-1,my1-1
150. lx1=mx1
151. ly1=my1
152. Next
153.
154. EndIf
155.
156. If d=4
157. Color colred/2,colgreen/2,colblue/2
158. Rect 0,0,255,255,1
159. For g=1 To 20000
160. mx1=Rand(-64,255)
161. my1=Rand(-64,255)
162. lx1=Rand(16)
163. Color colblue+lx1,colblue+lx1,colblue+lx1
164. Oval mx1+(lx1/2),my1+(lx1/2),lx1,lx1,0
165. Color colblue/2,colblue/2,colblue/2
166. Oval mx1+(lx1/2),my1+(lx1/2),lx1-1,lx1-1,0
167. Next
168. EndIf
169.
170. If d=6
171. Color colred,colgreen,colblue
172. Rect 0,0,255,255,1
173. For g=1 To 500
174. mx1=Rand(-64,255)
175. my1=Rand(-64,255)
176. lx1=Rand(64)
177. Color colblue+lx1,colred+lx1,colgreen+lx1
178. Oval mx1+(lx1/2),my1+(lx1/2),lx1,lx1,0
179. Color colblue/2,colblue/2,colblue/2
180. Oval mx1+(lx1/2),my1+(lx1/2),lx1-1,lx1-1,0
181. Next
182. EndIf
183.
184.
185.
186.
187.
188.
189.
190.
191.
192. If d<>2 And Rand(10)<3 And d<3
193. lx1=Rand(64,192)
194. ly1=Rand(64,192)
195. For g=20 To 0 Step -1
196. Color colred+(g*2),colgreen-g,colblue/2
197. Oval lx1-g,ly1-g,g*2,g,1
198. Next
199. EndIf
200.
201.
202. If d=2 And Rand(10)>7
203.
204. For g=1 To 10
205.
206. lx1=Rand(64,192)
207. Ly1=Rand(64,192)
208.
209. For h=1 To 50
210. mx=lx1+(Rand(-30,30))
211. my=ly1+(Rand(-30,30))
212.
213. Color colred+((lx-mx))/8,colgreen-((ly-my)/8),colblue/2
214. Oval mx,my,Rand(16),Rand(16),1
215.
216. Next
217. Next
218. EndIf
219.
220. SetBuffer BackBuffer()
221. End Function