Skip to content

Instantly share code, notes, and snippets.

@lansing
Created July 17, 2008 20:38
Show Gist options
  • Select an option

  • Save lansing/16 to your computer and use it in GitHub Desktop.

Select an option

Save lansing/16 to your computer and use it in GitHub Desktop.
UIDeviceOrientation orientation = [[UIDevice currentDevice] orientation];
if (orientation == UIInterfaceOrientationLandscapeRight || orientation == UIInterfaceOrientationLandscapeLeft ) {
NSLog(@"Landscape");
self.pageWidth = size.width;
self.pageHeight = size.height;
}
else {
NSLog(@"Portrait");
self.pageWidth = size.height;
self.pageHeight = size.width;
}
@Xuantho78

Copy link
Copy Markdown

Ok

@ssunti93-del

Copy link
Copy Markdown

-- นำสคริปต์นี้ไปใส่ใน Script ของ Part หรือ NPC ในเกมของคุณ
local part = script.Parent

-- ฟังก์ชันสำหรับตรวจสอบและตีบอลอัตโนมัติเมื่อลูกบอลเข้าใกล้
local function autoHitBall(ball)
if ball and ball:FindFirstChild("AssemblyLinearVelocity") then
-- พุ่งตัวหรือส่งแรงสะท้อนกลับไปยังลูกบอล
ball.AssemblyLinearVelocity = Vector3.new(0, 50, -50)
print("Auto Hit Triggered!")
end
end

-- ตรวจจับการสัมผัสหรือลูกบอลที่เข้ามาใกล้
part.Touched:Connect(function(hit)
if hit.Name == "Ball" then
autoHitBall(hit)
end
end)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment