generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Makes a long line

Previous Thread :: Next Thread 
Exobyte is not online. 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
crazypotato4 is not online. crazypotato4
Joined: 22 Feb 2010
Total Posts: 20000
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 is not online. 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 is not online. Exobyte
Joined: 26 Jul 2011
Total Posts: 386
06 Aug 2011 08:49 PM
Oh, wait. You're right, my bad. :P
Report Abuse
swimguy777 is not online. swimguy777
Joined: 30 May 2009
Total Posts: 17092
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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image