diff --git a/Privyet/Assets.xcassets/panelback.imageset/Contents.json b/Privyet/Assets.xcassets/panelback.imageset/Contents.json
new file mode 100644
index 0000000..7ed96a4
--- /dev/null
+++ b/Privyet/Assets.xcassets/panelback.imageset/Contents.json
@@ -0,0 +1,22 @@
+{
+ "images" : [
+ {
+ "filename" : "panelback.png",
+ "idiom" : "universal",
+ "scale" : "1x"
+ },
+ {
+ "filename" : "panelback@2x.png",
+ "idiom" : "universal",
+ "scale" : "2x"
+ },
+ {
+ "idiom" : "universal",
+ "scale" : "3x"
+ }
+ ],
+ "info" : {
+ "author" : "xcode",
+ "version" : 1
+ }
+}
diff --git a/Privyet/Assets.xcassets/panelback.imageset/panelback.png b/Privyet/Assets.xcassets/panelback.imageset/panelback.png
new file mode 100644
index 0000000..420f85c
Binary files /dev/null and b/Privyet/Assets.xcassets/panelback.imageset/panelback.png differ
diff --git a/Privyet/Assets.xcassets/panelback.imageset/panelback@2x.png b/Privyet/Assets.xcassets/panelback.imageset/panelback@2x.png
new file mode 100644
index 0000000..67bc4a4
Binary files /dev/null and b/Privyet/Assets.xcassets/panelback.imageset/panelback@2x.png differ
diff --git a/Privyet/Base.lproj/Main.storyboard b/Privyet/Base.lproj/Main.storyboard
index 0924d44..966bd70 100644
--- a/Privyet/Base.lproj/Main.storyboard
+++ b/Privyet/Base.lproj/Main.storyboard
@@ -15,50 +15,47 @@
-
-
-
-
-
-
-
-
-
-
-
-
+
-
+
-
+
+
+
@@ -99,10 +96,10 @@
-
+
-
+
diff --git a/Privyet/GameScene.swift b/Privyet/GameScene.swift
index e176466..87d5ffc 100644
--- a/Privyet/GameScene.swift
+++ b/Privyet/GameScene.swift
@@ -22,6 +22,8 @@ class GameScene: SKScene {
var tickLengthMillis = TickLengthLevelOne
var lastTick: NSDate?
+ var scaleFactor: CGFloat!
+
var textureCache = Dictionary()
var textureAtlas: SKTextureAtlas?
@@ -41,7 +43,7 @@ class GameScene: SKScene {
//print("Background is sized \(background.size)")
// Scale computations
- let scaleFactor = min(size.width / background.size.width, size.height / background.size.height)
+ scaleFactor = CGFloat(min(size.width / background.size.width, size.height / background.size.height))
background.position = CGPoint(x: 0, y: 0)
background.anchorPoint = CGPoint(x: 0, y: 1.0)
@@ -98,6 +100,12 @@ class GameScene: SKScene {
return CGPoint(x: x, y: y)
}
+ func rectForBucket() -> CGRect {
+ let width = CGFloat(NumColumns) * BlockSize
+ let height = CGFloat(NumRows) * BlockSize
+ return CGRect(x: (LayerPosition.x + (BlockSize / 2)) * scaleFactor, y: (LayerPosition.y + (BlockSize / 2)) * scaleFactor, width: width * scaleFactor, height: height * scaleFactor)
+ }
+
// Add the "preview" shape to the current scene. This also "rezzes in" a shape's block sprites.
func addPreviewShapeToScene(shape: Shape, completion: @escaping () -> ()) {
for block in shape.blocks {
diff --git a/Privyet/GameViewController.swift b/Privyet/GameViewController.swift
index c7f81c4..8c9a0d8 100644
--- a/Privyet/GameViewController.swift
+++ b/Privyet/GameViewController.swift
@@ -13,6 +13,7 @@ import GameplayKit
class GameViewController: UIViewController, PrivyetDelegate, UIGestureRecognizerDelegate {
var scene: GameScene!
var privyet: Privyet!
+ var bucketRect: CGRect!
var panPointReference: CGPoint?
@IBOutlet weak var scoreLabel: UILabel!
@@ -29,6 +30,9 @@ class GameViewController: UIViewController, PrivyetDelegate, UIGestureRecognizer
scene = GameScene(size: skView.bounds.size)
scene.scaleMode = .aspectFill
+ bucketRect = scene.rectForBucket()
+ print("Computed bucket rectangle = \(bucketRect!)")
+
scene.tick = didTick
privyet = Privyet()
@@ -45,7 +49,10 @@ class GameViewController: UIViewController, PrivyetDelegate, UIGestureRecognizer
// Called when the user taps the screen
@IBAction func didTap(_ sender: UITapGestureRecognizer) {
- privyet.rotateShape()
+ let tapLoc = sender.location(in: view)
+ if bucketRect.contains(tapLoc) {
+ privyet.rotateShape()
+ }
}
// Called when the user slides their finger across the screen
diff --git a/Privyet/Privyet.swift b/Privyet/Privyet.swift
index b077920..216835a 100644
--- a/Privyet/Privyet.swift
+++ b/Privyet/Privyet.swift
@@ -15,7 +15,7 @@ let StartingColumn = 4
let StartingRow = 0
let PreviewColumn = 12
-let PreviewRow = 1
+let PreviewRow = 3
let PointsPerLine = 10
let LevelThreshold = 500