Created
July 17, 2008 20:38
-
-
Save lansing/16 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; | |
| } |
-- นำสคริปต์นี้ไปใส่ใน 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
Ok