로블록스 개발 3단계

Oak_Cassia·2022년 5월 17일
0

로블록스 개발기

목록 보기
3/5

점점 형태를 띄어 간다.

local function onTouch(part)
	local humanoid = part.Parent:FindFirstChild("Humanoid")
	if (humanoid) then
		humanoid.Health-=10
		wait(2)
	end
end

script.Parent.Touched:connect(onTouch)

Touched 만 알아도 되게 많은 걸 할 수 있다.

밟으면 피가 달거나 피가 차는 발판도 만들고


속도가 빨라지는 발판도 만들고

local boostPart = script.Parent
local boostedWalkSpeed = 40

local function onTouch(part)
	local partParent = part.Parent
	local humanoid = partParent:FindFirstChild("Humanoid")

	if (humanoid) then
		local currentWalkSpeed = humanoid.WalkSpeed
		if (currentWalkSpeed < boostedWalkSpeed) then
			humanoid.WalkSpeed = boostedWalkSpeed
			wait(1)
			humanoid.WalkSpeed = currentWalkSpeed
		end
	end
end

boostPart.Touched:Connect(onTouch)

높게 점프하는 발판도 만들었다.

local boostPart = script.Parent
local boostedJumpPower = 200

local function onTouch(part)
	local partParent = part.Parent
	local humanoid = partParent:FindFirstChild("Humanoid")

	if (humanoid) then
		local currentJumpPower = humanoid.JumpPower
		if (currentJumpPower < boostedJumpPower) then
			humanoid.JumpPower = boostedJumpPower
			wait(0.2)
			humanoid.JumpPower = currentJumpPower
		end
	end
end

boostPart.Touched:Connect(onTouch)

이제 부가 기능을 집어 넣은 뒤 새로운 맵을 만들어야 겠다.
지금 생각하는 것은 테런을 오마주로 달리기 게임?

profile
rust로 뭐할까

0개의 댓글