Latest UploadsPlatdude SpottingJayenkaiNom nom nomJayenkaiRainbow TroutPakzKing SalmonPakzSnookerJayenkaiYou've ... o have youJayenkai
 Code Snippets > Generators ( Created 07 December 2016 | Last Edited 07 December 2016)

 Bush fire maps by Pakz | No VotesCreate countries or provinces Written inOther Here the emscripten page : http://cromdesi.home.xs4all.nl/emscripten/bushfire/Untitled1.html Here a youtube video of it : https://youtu.be/VOVi-KdhQ5c I found this method online years ago. What it does is find a position on the map and see if it can burn a position next near it. So creating a surface. Here I made it so it makes different style maps each time. I made it so it goes slowly from empty to a filled screen. Would also be changeable to screen dissolve. Press mouse (tap) on the map to create new map. Code is monkey 2. #Import "" #Import "" Using std.. Using mojo.. Class bushfire Field map:Int[,] = New Int[1,1] Field mw:Int,mh:Int Field tw:Float,th:Float Field cols:Color[] = New Color[20] Method New(w:Float,h:Float,num:Int) Self.mw = 100 Self.mh = 100 Self.tw = w/mw Self.th = h/mh map = New Int[mw,mh] cols = New Color[num+1] For Local i:Int = 0 Until num map[Rnd(10,mw-10),Rnd(10,mh-10)] = i Local gs:Float=Rnd() cols[i] = New Color(gs,gs,gs) Next End Method Method burnmap(tile:Int,amount:Int) For Local i:=0 Until amount Local x1:Int=Rnd(1,mw-1) Local y1:Int=Rnd(1,mh-1) If map[x1,y1] = tile For Local y2:Int=-1 To 1 For Local x2:Int=-1 To 1 Local x3:Int=x1+x2 Local y3:Int=y1+y2 If Rnd()<.3 If map[x3,y3] = 0 map[x3,y3] = tile End If End If Next Next End If Next End Method Method draw(canvas:Canvas) canvas.Color=Color.Brown For Local y:Float=0 Until mh Step 1 For Local x:Float=0 Until mw Step 1 If map[x,y] > 0 canvas.Color = cols[map[x,y]] canvas.DrawRect(x*tw,y*th,tw,th) End If Next Next End Method End Class Global mybushfire:bushfire Class MyWindow Extends Window Field num:Int=10 field cnt:Int Method New() Title="Monkey 2 - Bushfire map generator." mybushfire = New bushfire(Width,Height,num) End Method Method OnRender( canvas:Canvas ) Override App.RequestRender() ' Activate this method canvas.Clear(Color.Black) cnt+=1 If cnt>800 Or Mouse.ButtonReleased(MouseButton.Left) cnt=0 num=Rnd(3,40) mybushfire = New bushfire(Width,Height,num) Endif For Local i:Int=0 Until num mybushfire.burnmap(i,Rnd(100,800)) Next mybushfire.draw(canvas) ' if key escape then quit If Keyboard.KeyReleased(Key.Escape) Then App.Terminate() End Method End Class Function Main() New AppInstance New MyWindow App.Run() End Function -->

There are no comments for this entry. -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- (c) WidthPadding Industries 1987 660|0 -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=-
 Latest PostsJeremy Bloody Kyle steve_ancell Mon 09:45 GamerBlock Jayenkai Mon 09:06 Laptop Aaargh... Jayenkai Mon 07:06 Changing Thumbnail Sizes Jayenkai Mon 05:27 Technology on Planes therevillsgames Sat 17:00 London Car/Stab Incident steve_ancell Sat 12:10 A New Korg Gadget! Jayenkai Sat 04:53 Happy Birthday, Spinal Jayenkai Fri 08:40 Watch Switch - Fitbit Blaze rockford Fri 03:52 Happy Birthday Evil Roy Ferguson rockford Wed 16:21 More

 Latest Items Blog : My Arduino experience.steve_ancell Fri 13:45 Snippet : Skylinesspinal Fri 06:13 Showcase : Infinitronrychan Tue 03:02 Dev-Diary : PS2 to N64 Adapterspinal Sun 10:49 Link : Vector Tutorials/Help page.Pakz Thu 23:00 Blog : mini projectspinal Sun 10:13 Showcase : Blockman ReturnsJayenkai Fri 03:04 Snippet : Wall Tracing on Random Maps (rpg)rskgames Wed 22:48 Snippet : Path FollowingPakz Mon 16:25 Snippet : Flowers (Jan 2017)Kuron Thu 01:13 Showcase : Clusters of Hextherevillsgames Mon 15:01 Article : Maths 101 - Episode 1: Basic Trigonometryshroom_monk Sun 14:07 Article : Maths 101 - Episode 5: Line Intersectionshroom_monk Sun 14:02 Dev-Diary : Normals and Dot productsPakz Sat 20:37 Pets : Molly On The CouchJayenkai Thu 04:32More

Who's Online
Jayenkai
Mon, at 11:47
spinal
Mon, at 11:26
Pakz
Mon, at 11:19
steve_ancell
Mon, at 10:52
Andy_A
Mon, at 09:02
rychan
Mon, at 08:51
rskgames
Mon, at 03:32
rockford
Mon, at 03:19
Krakatomato
Mon, at 02:11
Cower
Mon, at 00:18
Link to this page
Site : Jayenkai 2006-Infinity | MudChat's origins, BBCode's former life, Image Scaler.