Skip to content
This repository has been archived by the owner on May 5, 2020. It is now read-only.

Commit

Permalink
Added tutorial scenes for mini games.
Browse files Browse the repository at this point in the history
  • Loading branch information
identity2 committed Jul 31, 2017
1 parent ce97927 commit f3ad7e0
Show file tree
Hide file tree
Showing 41 changed files with 374 additions and 34 deletions.
4 changes: 4 additions & 0 deletions Powerup.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
D959CBD31EE64A3A00C31753 /* DatabaseAccessor.swift in Sources */ = {isa = PBXBuildFile; fileRef = D959CBD21EE64A3A00C31753 /* DatabaseAccessor.swift */; };
D95B03CC1EDE7470001DB858 /* MapViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D95B03CB1EDE7470001DB858 /* MapViewController.swift */; };
D95B03CE1EDEA680001DB858 /* MiniGameViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D95B03CD1EDEA680001DB858 /* MiniGameViewController.swift */; };
D96944AF1F2EE97900FBE0E4 /* SKTutorialScene.swift in Sources */ = {isa = PBXBuildFile; fileRef = D96944AE1F2EE97900FBE0E4 /* SKTutorialScene.swift */; };
D969D26C1EE8F36200A5133F /* FMResultSetNullCheckExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = D969D26B1EE8F36200A5133F /* FMResultSetNullCheckExtension.swift */; };
D984D3011F0F598C0006270D /* SinkToSwimGameScene.swift in Sources */ = {isa = PBXBuildFile; fileRef = D984D3001F0F598C0006270D /* SinkToSwimGameScene.swift */; };
D984D3031F0F59A40006270D /* SinkToSwimQuestion.swift in Sources */ = {isa = PBXBuildFile; fileRef = D984D3021F0F59A40006270D /* SinkToSwimQuestion.swift */; };
Expand Down Expand Up @@ -118,6 +119,7 @@
D959CBD21EE64A3A00C31753 /* DatabaseAccessor.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DatabaseAccessor.swift; sourceTree = "<group>"; };
D95B03CB1EDE7470001DB858 /* MapViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MapViewController.swift; sourceTree = "<group>"; };
D95B03CD1EDEA680001DB858 /* MiniGameViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MiniGameViewController.swift; sourceTree = "<group>"; };
D96944AE1F2EE97900FBE0E4 /* SKTutorialScene.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SKTutorialScene.swift; path = ../SKTutorialScene.swift; sourceTree = "<group>"; };
D969D26B1EE8F36200A5133F /* FMResultSetNullCheckExtension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FMResultSetNullCheckExtension.swift; sourceTree = "<group>"; };
D984D3001F0F598C0006270D /* SinkToSwimGameScene.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SinkToSwimGameScene.swift; sourceTree = "<group>"; };
D984D3021F0F59A40006270D /* SinkToSwimQuestion.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SinkToSwimQuestion.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -187,6 +189,7 @@
D9E74B771F1F145900A42B7E /* Vocab Matching Game */,
D9AAA99E1EF21C3D00287A79 /* Mine Sweeper Game */,
D984D2FF1F0F596E0006270D /* Sink to Swim Game */,
D96944AE1F2EE97900FBE0E4 /* SKTutorialScene.swift */,
D910FF181F04AB3200C444DA /* DataSource.swift */,
D959CBD21EE64A3A00C31753 /* DatabaseAccessor.swift */,
D984D3041F0F59BA0006270D /* SKMultilineLabel.swift */,
Expand Down Expand Up @@ -442,6 +445,7 @@
2A2A4DB71B373C5B00D50860 /* StartViewController.swift in Sources */,
D9E74B7B1F1F14ED00A42B7E /* VocabMatchingClipboard.swift in Sources */,
2AF82A8D1B4BA74A00307BED /* FMDatabase.m in Sources */,
D96944AF1F2EE97900FBE0E4 /* SKTutorialScene.swift in Sources */,
D984D3051F0F59BA0006270D /* SKMultilineLabel.swift in Sources */,
D959CBCB1EE6481100C31753 /* Question.swift in Sources */,
D959CBC91EE643F400C31753 /* Avatar.swift in Sources */,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "minesweeper tutorial 1.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "minesweeper tutorial 1-1.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "minesweeper tutorial 1-2.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "minesweeper tutorial 2-2.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "minesweeper tutorial 2-1.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "minesweeper tutorial 2.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "minesweeper tutorial 3-2.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "minesweeper tutorial 3-1.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "minesweeper tutorial 3.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "sink to swim end scene-2.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "sink to swim end scene.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "sink to swim end scene-1.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "sink to swim tutorial 1.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "sink to swim tutorial 1-1.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "sink to swim tutorial 1-2.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "sink to swim tutorial 2.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "sink to swim tutorial 2-1.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "sink to swim tutorial 2-2.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "sink to swim tutorial 3-2.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "sink to swim tutorial 3-1.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "sink to swim tutorial 3.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "Vocab Matching Tutorial 1.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "Vocab Matching Tutorial 1-1.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "Vocab Matching Tutorial 1-2.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "Vocab Matching tutorial 2-2.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "Vocab Matching tutorial 2.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "Vocab Matching tutorial 2-1.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 22 additions & 3 deletions Powerup/MinesweeperGameScene.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ class MinesweeperGameScene: SKScene {
// MARK: Game Constants
let gridSizeCount = 5

let tutorialSceneImages = [
"minesweeper_tutorial_1",
"minesweeper_tutorial_2",
"minesweeper_tutorial_3"
]

// How many boxes could be selected each round.
let selectionMaxCount = 5

Expand Down Expand Up @@ -96,8 +102,10 @@ class MinesweeperGameScene: SKScene {
let bannerLayer = CGFloat(0.2)
let uiLayer = CGFloat(0.3)
let uiTextLayer = CGFloat(0.4)
let tutorialSceneLayer = CGFloat(5)

// MARK: Properties
var tutorialScene: SKTutorialScene!

// Keep a reference to the view controller for end game transition.
// (This is assigned in the MiniGameViewController class.)
Expand All @@ -118,6 +126,9 @@ class MinesweeperGameScene: SKScene {
// Avoid player interaction with boxes when they are animating.
var boxSelected: Bool = false

// Avoid player interaction with boxes when the game is in tutorial scene.
var inTutorial = true

// MARK: Constructor
override init(size: CGSize) {

Expand Down Expand Up @@ -204,9 +215,6 @@ class MinesweeperGameScene: SKScene {
gameGrid[x].append(newBox)
}
}

// Start the first round.
newRound()
}


Expand Down Expand Up @@ -236,6 +244,15 @@ class MinesweeperGameScene: SKScene {
addChild(box)
}
}

// Show tutorial scene. After that, start the game.
tutorialScene = SKTutorialScene(namedImages: tutorialSceneImages, size: size) {
self.newRound()
self.inTutorial = false
}
tutorialScene.position = CGPoint(x: size.width / 2.0, y: size.height / 2.0)
tutorialScene.zPosition = tutorialSceneLayer
addChild(tutorialScene)
}

/**
Expand Down Expand Up @@ -390,6 +407,7 @@ class MinesweeperGameScene: SKScene {

// MARK: Touch inputs
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
if inTutorial { return }

// Only the first touch is effective.
guard let touch = touches.first else {
Expand Down Expand Up @@ -429,6 +447,7 @@ class MinesweeperGameScene: SKScene {
}

override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?) {
if inTutorial { return }

// Only the first touch is effective.
guard let touch = touches.first else {
Expand Down
Loading

0 comments on commit f3ad7e0

Please sign in to comment.