RoboCatz.com
About FLL | Navigation | Playbook | Strategy | Models | Techniques | RobotC | Programming | Robot News |

-- Script for making a castle

--Workspace.startingScript
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local s = require(ReplicatedStorage.genericShapes)

local function buildCastle()
	local wallHeight = 20
	local wallThickness = 2
	local towerRadius = 6
	local towerHeight = 30
	local courtyardSize = 60

	-- Floor
	s.panel({
		x = 0,
		y = 0.1,
		z = 0,
		width = courtyardSize + 20,
		height = courtyardSize + 20,
	})
		:setColor(Color3.fromRGB(180, 180, 180))
		:material(Enum.Material.Concrete)
		:rotateBy(90,0,90)

	-- Four corner towers
	local towerPositions = {
		{ x = -courtyardSize/2, z = -courtyardSize/2 },
		{ x =  courtyardSize/2, z = -courtyardSize/2 },
		{ x = -courtyardSize/2, z =  courtyardSize/2 },
		{ x =  courtyardSize/2, z =  courtyardSize/2 },
	}

	for _, pos in ipairs(towerPositions) do
		s.cube({
			x = pos.x,
			y = towerHeight/2,
			z = pos.z,
			size = towerRadius * 2,
		})
			:material(Enum.Material.Cobblestone)
			:setColor(Color3.fromRGB(150, 150, 150))

		-- Tower roof (sphere)
		s.sphere({
			x = pos.x,
			y = towerHeight + towerRadius,
			z = pos.z,
			size = towerRadius * 2,
		})
			:material(Enum.Material.Slate)
			:setColor(Color3.fromRGB(120, 120, 120))
	end

	-- Walls using s.wall()
	local half = courtyardSize / 2

	-- North wall
	s.wall({
		x1 = -half, y1 = wallHeight, z1 = -half,
		x2 =  half, y2 = wallHeight, z2 = -half,
		thickness = wallThickness,
	})
		:material(Enum.Material.Cobblestone)
		:setColor(Color3.fromRGB(150, 150, 150))

	-- South wall
	s.wall({
		x1 = -half, y1 = wallHeight, z1 = half,
		x2 =  half, y2 = wallHeight, z2 = half,
		thickness = wallThickness,
	})
		:material(Enum.Material.Cobblestone)
		:setColor(Color3.fromRGB(150, 150, 150))

	-- West wall
	s.wall({
		x1 = -half, y1 = wallHeight, z1 = -half,
		x2 = -half, y2 = wallHeight, z2 =  half,
		thickness = wallThickness,
	})
		:material(Enum.Material.Cobblestone)
		:setColor(Color3.fromRGB(150, 150, 150))

	-- East wall
	s.wall({
		x1 = half, y1 = wallHeight, z1 = -half,
		x2 = half, y2 = wallHeight, z2 =  half,
		thickness = wallThickness,
	})
		:material(Enum.Material.Cobblestone)
		:setColor(Color3.fromRGB(150, 150, 150))

	-- Gatehouse (front center)
	s.cube({
		x = 0,
		y = wallHeight/2,
		z = -half - 5,
		size = 12,
	})
		:material(Enum.Material.Cobblestone)
		:setColor(Color3.fromRGB(140, 140, 140))

	-- Battlements (simple cubes)
	for x = -half, half, 6 do
		s.cube({
			x = x,
			y = wallHeight + 2,
			z = -half,
			size = 3,
		})
			:material(Enum.Material.Cobblestone)
	end
end

buildCastle()