Skip to content

Instantly share code, notes, and snippets.

@loldi
Created February 19, 2017 22:00
Show Gist options
  • Save loldi/5404abb365955d200f59935b1a608344 to your computer and use it in GitHub Desktop.
Save loldi/5404abb365955d200f59935b1a608344 to your computer and use it in GitHub Desktop.
//
// menuScreen.swift
// SheepCounter
//
// Created by Roxanne Farkas on 2/17/17.
// Copyright © 2017 newschool. All rights reserved.
//
import SpriteKit
import GameplayKit
import UIKit
class menuScene: SKScene {
//when play button pressed
//switch view to GameScene.sks
var button: SKSpriteNode?
override func didMove(to view: SKView) {
button = self.childNode(withName: "playButton") as! SKSpriteNode?
}
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
for touch in touches {
print(touch)
let location = touch.location(in: self)
let node: SKNode = self.atPoint(location)
if node.name == "playButton"{
let nextScene = SKScene(fileNamed: "GameScene")
nextScene?.scaleMode = .aspectFit
self.view?.presentScene(nextScene)
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment