Files
Ai/RollkofferSimulator/GameViewController.swift
T
Claude 9e501cc4e8 Add RollkofferSimulator iOS SpriteKit arcade game
Complete implementation of a 2D top-down arcade collector game where players
control a rolling suitcase through an airport, collecting good dogs and green
people while avoiding bad dogs and gray people.

Features:
- Touch & drag controls for suitcase movement
- Automatic scrolling airport floor with tile pattern
- 4 entity types: good dogs (small/big), bad dogs, green/gray humans
- Spawn system with configurable distribution rates
- Collision detection with visual feedback effects
- Score tracking with high score persistence
- 90-second time limit with 10 dogs + 5 humans goal
- 3 lives system with invincibility frames
- Menu, Game, GameOver, and Victory scenes
- German UI text (Created by Ingo K.)

Technical:
- iOS 15+ with SpriteKit framework
- Modular architecture with Nodes, Managers, Scenes
- Physics-based collision detection
- UserDefaults for score persistence
2025-12-19 16:47:49 +00:00

80 lines
1.9 KiB
Swift

//
// GameViewController.swift
// RollkofferSimulator
//
// Created by Ingo K.
//
import UIKit
import SpriteKit
import GameplayKit
class GameViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Configure the view
guard let skView = self.view as? SKView else {
fatalError("View is not an SKView")
}
// Create and configure the initial scene
let scene = MenuScene(size: skView.bounds.size)
scene.scaleMode = .aspectFill
// Configure view options
skView.ignoresSiblingOrder = true
#if DEBUG
skView.showsFPS = true
skView.showsNodeCount = true
#endif
// Present the scene
skView.presentScene(scene)
// Setup notification observers
setupNotificationObservers()
}
private func setupNotificationObservers() {
NotificationCenter.default.addObserver(
self,
selector: #selector(handlePauseNotification),
name: .pauseGame,
object: nil
)
}
@objc private func handlePauseNotification() {
guard let skView = self.view as? SKView,
let gameScene = skView.scene as? GameScene else {
return
}
// The GameScene should handle pausing internally
// This is just a notification that the app is going to background
}
override var supportedInterfaceOrientations: UIInterfaceOrientationMask {
if UIDevice.current.userInterfaceIdiom == .phone {
return .portrait
} else {
return .all
}
}
override var prefersStatusBarHidden: Bool {
return true
}
override var preferredScreenEdgesDeferringSystemGestures: UIRectEdge {
return .all
}
deinit {
NotificationCenter.default.removeObserver(self)
}
}