This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2012-03-09 14:17:00

Knuckl3head
Scratcher
Registered: 2012-01-22
Posts: 17

Completely Random Map Generator

Hello People! I have made a random map generator! It is basic.

This is the code for it

when gf clicked
goto x: [-240] y: [180]
 repeat until << (y position) = [-172]> and < (x position) = [224]>>
   if < (x position) = [240] >
     change y by [-16]
     set x to [-240]
  else
    switch costume <pick random [1] to [2]>
    stamp
   change x by [16]
stop script
This is it!

Offline

 

#2 2012-03-09 14:54:09

Laternenpfahl
Scratcher
Registered: 2011-06-24
Posts: 1000+

Re: Completely Random Map Generator

Great script, but TiMaC is for stuff other than scratch.


http://i46.tinypic.com/6yd4c0.png

Offline

 

#3 2012-03-09 15:54:34

RedRocker227
Scratcher
Registered: 2011-10-26
Posts: 1000+

Re: Completely Random Map Generator

(Oh, the posts were deleted ._.)

That wouldn't work. The script would stop as soon as it starts. Why did you put a "stop script" block in there? ._.


Why

Offline

 

#4 2012-03-09 19:12:31

hello12345678910
Scratcher
Registered: 2009-07-11
Posts: 100+

Re: Completely Random Map Generator

this would be better, but more complex

when green flag clicked
        go to x: -240 y: -180
        clear
        set "TempHeight" to "15"
        set "Biome" to (item (pick random 1 to (length of "Biome List" )) of "Biome List" )
        repeat (80)  
            if ((Biome) = "forest")
                set "TempHeight" to ((TempHeight) + (pick random -1 to 1))
            else
                if ((Biome) = "grassland")
                    set "TempHeight" to ((TempHeight) + (round ((pick random -5 to 5) / 10)))
                else
                    if ((Biome) = "supermountain") 
                        set "TempHeight" to ((TempHeight) + (pick random -5 to 5))
                    else
                        set "TempHeight" to ((TempHeight) + (pick random -2 to 2))
            end
end
end
if ((TempHeight) < "15") 
                set "TempHeight" to "15"
            switch to costume "stone"
            repeat ((TempHeight) - 5)  
                stamp
                change y by (6)
            switch to costume "dirt"
            repeat ((TempHeight) - ((TempHeight) - 5))  
                stamp
                change y by (6)
            switch to costume "grass"
            stamp
            if ((Biome) = "forest")
                if (((pick random 1 to 2) = "2") and ((TreeSpacingCount) > "3")) 
                    set "TreeSpacingCount" to "0"
                    switch to costume "wood"
                    change y by (6)
                    stamp
                    change y by (6)
                    stamp
                    change y by (6)
                    stamp
                    change y by (6)
                    stamp
                    change y by (-6)
                    switch to costume "leaves"
                    change y by (6)
                    stamp
                    change y by (6)
                    stamp
                    change y by (-12)
                    change x by (6)
                    stamp
                    change y by (6)
                    stamp
                    change x by (-12)
                    stamp
                    change y by (-6)
                    stamp
                    change x by (6)
                    stamp
                change "TreeSpacingCount" by 1
            else
            set y to (-180)
            change x by (6)
        switch to costume "bedrock"
        go to x: -240 y: -180
        repeat (80)  
            stamp
            change x by (6)
    end
end
end

Last edited by hello12345678910 (2012-03-09 19:16:59)


http://tinyurl.com/8yt32o9 http://tinyurl.com/6tgwp5r || Fish = F+I+S+H = 6+9+19+8 = 42<<The answer to Life, the Universe and Everything

Offline

 

Board footer