Exobyte
|
  |
| Joined: 26 Jul 2011 |
| Total Posts: 386 |
|
|
| 06 Aug 2011 07:15 PM |
Instead of making a cube, it makes a line of 5x5x5 bricks. Like, it's supposed to be:
x.x.x.x.x x.x.x.x.x x.x.x.x.x x.x.x.x.x x.x.x.x.x
But instead, it goes:
x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x
This is pretty much my first attempt at terrain generation, I'll be making this more sophisticated eventually.
local cx,cy,cz = 0,0,0
function genTerr() for l = 1,5 do for d = 1,5 do for i = 1,5 do local p = Instance.new("Part",Workspace) p.Anchored = true p.Size = Vector3.new(5,5,5) p.Position = Vector3.new(cx,cy,cz) p.BrickColor = BrickColor.new("Bright green") p.Material = "Grass" cx = cx+5 end cx = 0 cz = cz+5 end end cz = 0 cx = 0 cy = cy+5 end
genTerr() |
|
|
| Report Abuse |
|
|
| 06 Aug 2011 07:19 PM |
Shouldn't the part where it says
"cz = 0 cx = 0 cy = cy+5"
Be before the second-last end, so it's inside the outer for loop?
-Like a boss. |
|
|
| Report Abuse |
|
Exobyte
|
  |
| Joined: 26 Jul 2011 |
| Total Posts: 386 |
|
|
| 06 Aug 2011 08:48 PM |
| It's inside the first for loop. I'm resetting the x/z positions and adding to the y position. |
|
|
| Report Abuse |
|
Exobyte
|
  |
| Joined: 26 Jul 2011 |
| Total Posts: 386 |
|
|
| 06 Aug 2011 08:49 PM |
| Oh, wait. You're right, my bad. :P |
|
|
| Report Abuse |
|
|
| 06 Aug 2011 09:04 PM |
You have 3 loops. Only 2 are needed to make a 2D terrain.
[Insert squiggles here][Say something humorous here][More squiggles go here] |
|
|
| Report Abuse |
|