質問編集履歴

1

ソースコードを一部書き換えました

2017/04/02 18:28

投稿

Kenelaoy
Kenelaoy

スコア50

test CHANGED
File without changes
test CHANGED
@@ -12,7 +12,11 @@
12
12
 
13
13
  class set: SKScene {
14
14
 
15
+ //var Progress = 0
16
+
15
- var button: SKNode? = nil
17
+ //var button: SKNode? = nil
18
+
19
+
16
20
 
17
21
  func start() {
18
22
 
@@ -46,51 +50,63 @@
46
50
 
47
51
 
48
52
 
49
- button = SKSpriteNode(imageNamed: "Button.png")
53
+ let button = SKSpriteNode(imageNamed: "Button.png")
50
54
 
51
- button?.xScale = 0.1;
55
+ button.xScale = 0.1;
52
56
 
53
- button?.yScale = 0.1;
57
+ button.yScale = 0.1;
54
58
 
55
- button?.position = CGPoint(x: 400.0, y:100.0)
59
+ button.position = CGPoint(x: 400.0, y:100.0)
56
60
 
57
- button?.zPosition = 1
61
+ button.zPosition = 1
58
62
 
59
- button?.name = "button"
63
+ button.name = "button"
60
64
 
61
- back.addChild(button!)
65
+ back.addChild(button)
62
66
 
63
67
 
64
68
 
65
- button?.isUserInteractionEnabled = true
69
+ button.isUserInteractionEnabled = true
66
70
 
67
71
  }
68
72
 
73
+ func doit() {
74
+
75
+ print("実行")
76
+
77
+ print("されています")
78
+
79
+ }
80
+
69
81
 
70
82
 
71
- override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
83
+ /* override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
72
84
 
73
- for touch in touches {
85
+ if let touch = touches.first as UITouch? {
74
86
 
75
- let location = touch.location(in: self)
87
+ let location = touch.location(in: self)
76
88
 
77
-
89
+ if self.atPoint(location).name == "button" {
78
90
 
79
- if (button?.contains(location))! {
91
+ print("button tapped")
80
92
 
81
- print("button touched")
93
+ }
82
-
83
-
84
94
 
85
95
  }
86
96
 
87
- else {
97
+ }*/
88
98
 
89
- //start the game here
99
+ override func touchesBegan(_ touches: Set<UITouch>,with event: UIEvent?) { //super.touchesBegan(touches, with: event)
90
100
 
91
- }
101
+ print("touched")
92
102
 
93
103
  }
104
+
105
+ override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?) {
106
+
107
+ super.touchesEnded(touches, with: event)
108
+
109
+ print("touchend")
94
110
 
95
111
  }
96
112
 
@@ -101,6 +117,18 @@
101
117
  let first = set()
102
118
 
103
119
  let second = first.start()
120
+
121
+ var Progress = 0
122
+
123
+
124
+
125
+ /*while Progress <= 100 {
126
+
127
+ first
128
+
129
+ }*/
130
+
131
+
104
132
 
105
133
  ```
106
134