Skip to content

Commit 10ae90a

Browse files
committed
Feedbacks da Paulinha
1 parent f0705f3 commit 10ae90a

File tree

3 files changed

+47
-60
lines changed

3 files changed

+47
-60
lines changed

FlyGame/FlyGame Shared/Controllers/GameSceneController.swift

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -151,23 +151,6 @@ class GameSceneController: NSObject, SKPhysicsContactDelegate {
151151

152152
#endif
153153

154-
func calculateObstacleMovement(allObstacles: [SKNode]) {
155-
for obstacle in allObstacles {
156-
if gameDelegate?.pausedStatus() == true {
157-
obstacle.position.x -= 0
158-
}
159-
else {
160-
#if os(iOS)
161-
let moveObstAction = SKAction.moveTo(x: (-100000), duration: duration*100)
162-
#elseif os(tvOS)
163-
let moveObstAction = SKAction.moveTo(x: (-100000), duration: durationTV*100)
164-
#endif
165-
166-
obstacle.run(moveObstAction)
167-
}
168-
}
169-
}
170-
171154
#if os(tvOS)
172155
func addTargetToPauseActionToTV() -> UITapGestureRecognizer {
173156
self.buttonTvOS.addTarget(self, action: #selector(self.tvOSAction))
@@ -393,7 +376,6 @@ class GameSceneController: NSObject, SKPhysicsContactDelegate {
393376
AudioService.shared.soundManager(with: .coin, soundAction: .play)
394377
increaseScore(player: player, enemy: enemy)
395378
coinsInRun += 1
396-
print(coinsInRun)
397379
if coinsInRun == 5 {
398380
GameCenterService.shared.showAchievements(achievementID: "firstCoinsInRunID")
399381
}

FlyGame/FlyGame Shared/Views/GameScene.swift

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ class GameScene: SKScene, SKPhysicsContactDelegate {
4343

4444
lazy var pauseMenu: PauseMenu = {
4545
var menu = PauseMenu()
46+
menu.zPosition = 4
4647
menu.gameDelegate = self
4748
return menu
4849
}()
@@ -91,9 +92,6 @@ class GameScene: SKScene, SKPhysicsContactDelegate {
9192

9293
// MARK: - setUpScenne
9394
func setUpScene() {
94-
removeAllChildren()
95-
removeAllActions()
96-
9795
#if os(tvOS)
9896
addPauseActionGesture()
9997
#endif
@@ -110,9 +108,7 @@ class GameScene: SKScene, SKPhysicsContactDelegate {
110108

111109
self.addChild(pauseMenu)
112110
self.addChild(scoreLabel)
113-
114-
setNodesSize()
115-
setNodesPosition()
111+
116112
addSwipeGestures()
117113
gameLogic.buttonActions()
118114

@@ -175,7 +171,8 @@ class GameScene: SKScene, SKPhysicsContactDelegate {
175171

176172
// MARK: didChangeSize
177173
override func didChangeSize(_ oldSize: CGSize) {
178-
self.setUpScene()
174+
setNodesSize()
175+
setNodesPosition()
179176

180177
setPhysics(node: playerNode)
181178
}

FlyGame/FlyGame Shared/Views/MenuScene.swift

Lines changed: 43 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -169,41 +169,7 @@ class MenuScene: SKScene {
169169
chandelier.setScale(self.size.height/350)
170170
chair.setScale(self.size.height/350)
171171
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-
172+
207173
default:
208174
break
209175
}
@@ -244,6 +210,48 @@ class MenuScene: SKScene {
244210

245211
flyAction.position = CGPoint(x: self.size.width/1.215, y: self.size.height/2.28)
246212
flyAction.zPosition = 1
213+
214+
#if os(iOS)
215+
switch UIDevice.current.userInterfaceIdiom {
216+
case .pad:
217+
scenarioImage.position = CGPoint(x: self.size.width/2, y: self.size.height/2)
218+
scenarioImage.zPosition = 0
219+
220+
soundButton.position = CGPoint(x: self.size.width/2, y: self.size.height/3.5)
221+
soundButton.zPosition = 1
222+
223+
scoreLabel.position = CGPoint(x: self.size.width/2, y: self.size.height/2.5)
224+
scoreLabel.zPosition = 1
225+
scoreLabel.fontSize = self.size.height/15
226+
227+
musicButton.position = CGPoint(x: soundButton.position.x + self.size.width/9.5, y: self.size.height/3.5)
228+
musicButton.zPosition = 1
229+
230+
gameCenterButton.position = CGPoint(x: soundButton.position.x - self.size.width/9.5, y: self.size.height/3.5)
231+
gameCenterButton.zPosition = 1
232+
233+
playButton.position = CGPoint(x: self.size.width/2, y: self.size.height/1.6)
234+
playButton.zPosition = 1
235+
236+
piano.position = CGPoint(x: self.size.width/8.5, y: self.size.height/3.5)
237+
piano.zPosition = 1
238+
239+
catAction.position = CGPoint(x: self.size.width/6, y: self.size.height/1.55)
240+
catAction.zPosition = 2
241+
242+
chandelier.position = CGPoint(x: self.size.width/1.3, y: self.size.height/1.13)
243+
chandelier.zPosition = 1
244+
245+
chair.position = CGPoint(x: self.size.width/1.215, y: self.size.height/7.5)
246+
chair.zPosition = 1
247+
248+
flyAction.position = CGPoint(x: self.size.width/1.215, y: self.size.height/2.6)
249+
flyAction.zPosition = 1
250+
251+
default:
252+
break
253+
}
254+
#endif
247255
}
248256

249257
#if os(tvOS)

0 commit comments

Comments
 (0)