Skip to content

Commit 8c06196

Browse files
authored
Merge pull request #62 from rebeccamello/feat/ipad
Feat/ipad
2 parents c2dad72 + 048b10d commit 8c06196

File tree

15 files changed

+147
-24
lines changed

15 files changed

+147
-24
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"images" : [
3+
{
4+
"filename" : "iPad Pro 12.9_ - 1.png",
5+
"idiom" : "universal",
6+
"scale" : "1x"
7+
},
8+
{
9+
"filename" : "iPad Pro 12.9_ - 2.png",
10+
"idiom" : "universal",
11+
"scale" : "2x"
12+
},
13+
{
14+
"filename" : "iPad Pro 12.9_ - 3.png",
15+
"idiom" : "universal",
16+
"scale" : "3x"
17+
}
18+
],
19+
"info" : {
20+
"author" : "xcode",
21+
"version" : 1
22+
}
23+
}
7.67 KB
Loading
26 KB
Loading
55.5 KB
Loading

FlyGame/FlyGame Shared/Controllers/GameSceneController.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,15 +177,15 @@ class GameSceneController: NSObject, SKPhysicsContactDelegate {
177177

178178
func buttonActions() {
179179
gameDelegate?.getButtons()[0].action = {
180-
self.gameDelegate?.restartGame()
180+
self.gameDelegate?.resumeGame()
181181
}
182182

183183
gameDelegate?.getButtons()[1].action = {
184184
self.gameDelegate?.goToHome()
185185
}
186186

187187
gameDelegate?.getButtons()[2].action = {
188-
self.gameDelegate?.resumeGame()
188+
self.gameDelegate?.restartGame()
189189
}
190190

191191
gameDelegate?.getButtons()[3].action = {
Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="19529" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
3-
<device id="retina6_1" orientation="landscape" appearance="light"/>
3+
<device id="ipad12_9" orientation="landscape" layout="fullscreen" appearance="light"/>
44
<dependencies>
5+
<deployment identifier="iOS"/>
56
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="19519"/>
67
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
78
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
@@ -12,20 +13,21 @@
1213
<objects>
1314
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
1415
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
15-
<rect key="frame" x="0.0" y="0.0" width="896" height="414"/>
16+
<rect key="frame" x="0.0" y="0.0" width="1366" height="1024"/>
1617
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
1718
<subviews>
1819
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="9" translatesAutoresizingMaskIntoConstraints="NO" id="obG-Y5-kRd">
19-
<rect key="frame" x="44" y="394" width="808" height="0.0"/>
20+
<rect key="frame" x="0.0" y="1004" width="1366" height="0.0"/>
2021
<fontDescription key="fontDescription" type="system" pointSize="17"/>
2122
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
2223
<nil key="highlightedColor"/>
2324
</label>
24-
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="cenario" translatesAutoresizingMaskIntoConstraints="NO" id="abr-8z-bf2">
25-
<rect key="frame" x="0.0" y="0.0" width="896" height="414"/>
25+
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" fixedFrame="YES" image="launchscreen" translatesAutoresizingMaskIntoConstraints="NO" id="iFs-AS-uKk">
26+
<rect key="frame" x="-25" y="-14" width="1403" height="1038"/>
27+
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
2628
</imageView>
2729
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="launch" translatesAutoresizingMaskIntoConstraints="NO" id="Og2-dS-Ur8">
28-
<rect key="frame" x="248" y="0.0" width="400" height="414"/>
30+
<rect key="frame" x="483" y="20" width="400" height="1004"/>
2931
</imageView>
3032
</subviews>
3133
<viewLayoutGuide key="safeArea" id="Bcu-3y-fUS"/>
@@ -34,23 +36,19 @@
3436
<constraint firstItem="Og2-dS-Ur8" firstAttribute="top" secondItem="Bcu-3y-fUS" secondAttribute="top" id="2cr-oZ-0OL"/>
3537
<constraint firstItem="Bcu-3y-fUS" firstAttribute="centerX" secondItem="obG-Y5-kRd" secondAttribute="centerX" id="5cz-MP-9tL"/>
3638
<constraint firstAttribute="bottom" secondItem="Og2-dS-Ur8" secondAttribute="bottom" id="9J0-j9-JVe"/>
37-
<constraint firstItem="abr-8z-bf2" firstAttribute="leading" secondItem="Ze5-6b-2t3" secondAttribute="leading" id="Kob-DS-5dY"/>
38-
<constraint firstAttribute="bottom" secondItem="abr-8z-bf2" secondAttribute="bottom" id="REB-0e-49t"/>
39-
<constraint firstAttribute="trailing" secondItem="abr-8z-bf2" secondAttribute="trailing" id="RnC-LW-hl2"/>
4039
<constraint firstItem="obG-Y5-kRd" firstAttribute="leading" secondItem="Bcu-3y-fUS" secondAttribute="leading" symbolic="YES" id="SfN-ll-jLj"/>
4140
<constraint firstItem="Bcu-3y-fUS" firstAttribute="centerX" secondItem="Og2-dS-Ur8" secondAttribute="centerX" id="VuW-Un-cBB"/>
4241
<constraint firstAttribute="bottom" secondItem="obG-Y5-kRd" secondAttribute="bottom" constant="20" id="Y44-ml-fuU"/>
43-
<constraint firstItem="abr-8z-bf2" firstAttribute="top" secondItem="Bcu-3y-fUS" secondAttribute="top" id="nTb-qg-iq5"/>
4442
</constraints>
4543
</view>
4644
</viewController>
4745
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
4846
</objects>
49-
<point key="canvasLocation" x="51.5625" y="373.91304347826087"/>
47+
<point key="canvasLocation" x="51.390922401171302" y="373.828125"/>
5048
</scene>
5149
</scenes>
5250
<resources>
53-
<image name="cenario" width="896" height="414"/>
5451
<image name="launch" width="400" height="400"/>
52+
<image name="launchscreen" width="1366" height="1024"/>
5553
</resources>
5654
</document>

FlyGame/FlyGame Shared/Services/ObstacleFetcher.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ class ObstacleFetcher {
3030
Obstacle(lanePosition: 5, weight: 1, width: 2, assetName: "estanteVasos", physicsBody: SKPhysicsBody(texture: SKTexture(imageNamed: "estanteVasos"), size: CGSize(width: laneHeight*2, height: laneHeight))),
3131
Obstacle(lanePosition: 4, weight: 2, width: 1, assetName: "estanteDeCha", physicsBody: SKPhysicsBody(texture: SKTexture(imageNamed: "estanteDeCha"), size: CGSize(width: laneHeight, height: laneHeight*2))),
3232
Obstacle(lanePosition: 2, weight: 2, width: 1, assetName: "vovo", physicsBody: SKPhysicsBody(texture: SKTexture(imageNamed: "vovo"), size: CGSize(width: laneHeight, height: laneHeight*2))),
33+
3334
Obstacle(lanePosition: 2, weight: 2, width: 2, assetName: "piano", physicsBody: SKPhysicsBody(texture: SKTexture(imageNamed: "piano"), size: CGSize(width: laneHeight*2, height: laneHeight*2))),
35+
3436
Obstacle(lanePosition: 4, weight: 2, width: 2, assetName: "armario", physicsBody: SKPhysicsBody(texture: SKTexture(imageNamed: "armario"), size: CGSize(width: laneHeight*2, height: laneHeight*2))),
3537
Obstacle(lanePosition: 2, weight: 2, width: 1, assetName: "bancoVaso", physicsBody: SKPhysicsBody(texture: SKTexture(imageNamed: "bancoVaso"), size: CGSize(width: laneHeight, height: laneHeight*2))),
3638
Obstacle(lanePosition: 2, weight: 2, width: 2, assetName: "mesaVaso", physicsBody: SKPhysicsBody(texture: SKTexture(imageNamed: "mesaVaso"), size: CGSize(width: laneHeight*2, height: laneHeight*2))),

FlyGame/FlyGame Shared/Views/GameOverScene.swift

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,17 @@ class GameOverScene: SKScene {
157157
scoreLabel.setScale(self.size.height * 0.003)
158158
homeButton.setScale(self.size.width * 0.00021)
159159
retryButton.setScale(self.size.width * 0.00021)
160+
161+
#if os(iOS)
162+
switch UIDevice.current.userInterfaceIdiom {
163+
case .pad:
164+
gameOverLabel.setScale(self.size.height * 0.0055)
165+
scoreLabel.setScale(self.size.height * 0.0027)
166+
cat.setScale(self.size.height/800)
167+
default:
168+
break
169+
}
170+
#endif
160171
}
161172

162173
#if os(tvOS)

FlyGame/FlyGame Shared/Views/GameScene.swift

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,10 +138,21 @@ class GameScene: SKScene, SKPhysicsContactDelegate {
138138
#if os(iOS)
139139
scoreLabel.position = CGPoint(x: pauseButton.position.x + scoreLabel.frame.size.width/2 + 50, y: pauseButton.position.y - scoreLabel.frame.size.height/2)
140140
plusTwo.position = CGPoint(x: scoreLabel.position.x + plusTwo.frame.size.width/2 + 20, y: pauseButton.position.y - scoreLabel.frame.size.height/2)
141-
141+
142+
switch UIDevice.current.userInterfaceIdiom {
143+
case .pad:
144+
pauseButton.setScale(self.size.height*0.000225)
145+
pauseButton.position = CGPoint(x: size.width*0.045, y: size.height*0.9)
146+
scoreLabel.position = CGPoint(x: pauseButton.position.x + scoreLabel.frame.size.width/2 + 55, y: pauseButton.position.y - scoreLabel.frame.size.height/2)
147+
plusTwo.position = CGPoint(x: scoreLabel.position.x + plusTwo.frame.size.width/2 + 25, y: pauseButton.position.y - scoreLabel.frame.size.height/2)
148+
default:
149+
break
150+
}
151+
142152
#elseif os(tvOS)
143153
scoreLabel.position = pauseButton.position
144154
plusTwo.position = CGPoint(x: scoreLabel.position.x + plusTwo.frame.size.width/2 + 50, y: scoreLabel.position.y)
155+
145156
#endif
146157
scenarioImage.position = CGPoint(x: scenarioImage.size.width/2, y: scenarioImage.size.height/2)
147158
scenarioImage2.position = CGPoint(x: scenarioImage2.size.width/2 + scenarioImage.position.x*2, y: scenarioImage2.size.height/2)
@@ -405,7 +416,7 @@ extension GameScene: GameLogicDelegate {
405416
}
406417

407418
func getButtons() -> [SKButtonNode] {
408-
return [pauseMenu.resumeButton,pauseMenu.homeButton, pauseMenu.retryButton, pauseMenu.soundButton, pauseMenu.musicButton]
419+
return [pauseMenu.resumeButton,pauseMenu.homeButton,pauseMenu.retryButton,pauseMenu.soundButton,pauseMenu.musicButton]
409420
}
410421

411422
func restartGame() {

FlyGame/FlyGame Shared/Views/MenuScene.swift

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,58 @@ class MenuScene: SKScene {
156156
chandelier.setScale(self.size.height/300)
157157
chair.setScale(self.size.height/300)
158158
flyAction.setScale(self.size.height/2800)
159+
160+
#if os(iOS)
161+
switch UIDevice.current.userInterfaceIdiom {
162+
case .pad:
163+
playButton.setScale(self.size.height/250)
164+
musicButton.setScale(self.size.height/3000)
165+
soundButton.setScale(self.size.height/3000)
166+
gameCenterButton.setScale(self.size.height/3000)
167+
piano.setScale(self.size.height/350)
168+
catAction.setScale(self.size.height/1000)
169+
chandelier.setScale(self.size.height/350)
170+
chair.setScale(self.size.height/350)
171+
flyAction.setScale(self.size.height/3150)
172+
173+
scenarioImage.position = CGPoint(x: self.size.width/2, y: self.size.height/2)
174+
scenarioImage.zPosition = 0
175+
176+
soundButton.position = CGPoint(x: self.size.width/2, y: self.size.height/3.5)
177+
soundButton.zPosition = 1
178+
179+
scoreLabel.position = CGPoint(x: self.size.width/2, y: self.size.height/2.5)
180+
scoreLabel.zPosition = 1
181+
scoreLabel.fontSize = self.size.height/15
182+
183+
musicButton.position = CGPoint(x: soundButton.position.x + self.size.width/9.5, y: self.size.height/3.5)
184+
musicButton.zPosition = 1
185+
186+
gameCenterButton.position = CGPoint(x: soundButton.position.x - self.size.width/9.5, y: self.size.height/3.5)
187+
gameCenterButton.zPosition = 1
188+
189+
playButton.position = CGPoint(x: self.size.width/2, y: self.size.height/1.6)
190+
playButton.zPosition = 1
191+
192+
piano.position = CGPoint(x: self.size.width/8.5, y: self.size.height/3.5)
193+
piano.zPosition = 1
194+
195+
catAction.position = CGPoint(x: self.size.width/6, y: self.size.height/1.55)
196+
catAction.zPosition = 2
197+
198+
chandelier.position = CGPoint(x: self.size.width/1.3, y: self.size.height/1.13)
199+
chandelier.zPosition = 1
200+
201+
chair.position = CGPoint(x: self.size.width/1.215, y: self.size.height/7.5)
202+
chair.zPosition = 1
203+
204+
flyAction.position = CGPoint(x: self.size.width/1.215, y: self.size.height/2.6)
205+
flyAction.zPosition = 1
206+
207+
default:
208+
break
209+
}
210+
#endif
159211
}
160212

161213
private func setupNodesPosition() {

0 commit comments

Comments
 (0)