Skip to content
Snippets Groups Projects
Commit 6c2903ed authored by Tobias Ullerich's avatar Tobias Ullerich
Browse files

Add monster rotation and launchscreen

parent 402f1397
Branches
Tags
No related merge requests found
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11134" systemVersion="15F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="01J-lp-oVM"> <document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="12121" systemVersion="16F73" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
<device id="retina4_7" orientation="landscape">
<adaptation id="fullscreen"/>
</device>
<dependencies> <dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11106"/> <deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12089"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies> </dependencies>
<scenes> <scenes>
...@@ -14,14 +18,27 @@ ...@@ -14,14 +18,27 @@
<viewControllerLayoutGuide type="bottom" id="xb3-aO-Qok"/> <viewControllerLayoutGuide type="bottom" id="xb3-aO-Qok"/>
</layoutGuides> </layoutGuides>
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3"> <view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/> <rect key="frame" x="0.0" y="0.0" width="667" height="375"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="LaunchScreen" translatesAutoresizingMaskIntoConstraints="NO" id="vjF-TF-aIH">
<rect key="frame" x="183" y="37" width="300" height="300"/>
</imageView>
</subviews>
<color key="backgroundColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="vjF-TF-aIH" firstAttribute="top" secondItem="Llm-lL-Icb" secondAttribute="bottom" constant="17" id="IiC-5F-LVv"/>
<constraint firstItem="vjF-TF-aIH" firstAttribute="centerX" secondItem="Ze5-6b-2t3" secondAttribute="centerX" id="g4n-x6-kS0"/>
<constraint firstItem="vjF-TF-aIH" firstAttribute="centerY" secondItem="Ze5-6b-2t3" secondAttribute="centerY" id="mqA-KI-O7V"/>
</constraints>
</view> </view>
</viewController> </viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/> <placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects> </objects>
<point key="canvasLocation" x="53" y="375"/> <point key="canvasLocation" x="52.623688155922046" y="373.60000000000002"/>
</scene> </scene>
</scenes> </scenes>
<resources>
<image name="LaunchScreen" width="300" height="320"/>
</resources>
</document> </document>
...@@ -12,7 +12,20 @@ import SceneKit ...@@ -12,7 +12,20 @@ import SceneKit
class Monster: Equatable { class Monster: Equatable {
private (set) var position: SCNVector3 private (set) var position: SCNVector3
private var direction: Direction = .north private var direction: Direction = .north {
didSet {
switch direction {
case .north:
node?.rotation = SCNVector4(x: 0, y: 1, z: 0, w: 1.5 * Float.pi - Float.pi * 0.25)
case .east:
node?.rotation = SCNVector4(x: 0, y: 1, z: 0, w: 1.0 * Float.pi - Float.pi * 0.25)
case .south:
node?.rotation = SCNVector4(x: 0, y: 1, z: 0, w: 0.5 * Float.pi - Float.pi * 0.25)
case .west:
node?.rotation = SCNVector4(x: 0, y: 1, z: 0, w: 2.0 * Float.pi - Float.pi * 0.25)
}
}
}
private let level: Level private let level: Level
private let scene: SCNScene private let scene: SCNScene
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment