Lua Script Roblox Studio การสร้างเงื่อนไข if condition
เราสามารถระบุเงื่อนไขในการทำงาน เช่น ถ้าตำแหน่งของลูกบอลไปตกกระทบกำแพง ให้เปลี่ยนทิศทางของตำแหน่งเป็นด้านตรงข้าม
local velocity = Vector3.new(1, 0, 2)
local part = Vector3.new(0, 0, 0)
local box = Vector3.new(10, 0, 10) -- from origin
while true do -- Infinite Loop
part = part + velocity
print(part)
-- Update Velocity
if part.X > wall.X or part.X <0 -1="" end="" if="" part.z="" then="" velocity.x="velocity.X"> wall.Z or part.Z <0 -1="" code="" end="" task.wait="" then="" velocity.z="velocity.Z">0>0>
ความคิดเห็น
แสดงความคิดเห็น