Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Better Together
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
ios-dev-group-i
Better Together
Commits
9f9e79f1
Commit
9f9e79f1
authored
4 years ago
by
Chan Yong Lee
Browse files
Options
Downloads
Patches
Plain Diff
fix bug in swing practice
parent
2ec58114
Branches
Branches containing commit
No related tags found
2 merge requests
!60
Code cleanup lukas fix
,
!54
fix bug in swing practice
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
Better Together/Better Together/GameViews/TutorialScene.swift
+45
-8
45 additions, 8 deletions
...er Together/Better Together/GameViews/TutorialScene.swift
with
45 additions
and
8 deletions
Better Together/Better Together/GameViews/TutorialScene.swift
+
45
−
8
View file @
9f9e79f1
...
...
@@ -103,6 +103,7 @@ class TutorialScene: SKScene, SKPhysicsContactDelegate {
var
showRedLine
=
false
var
leftHandCanSwing
=
false
var
rightHandCanSwing
=
false
var
bodyOnSwingPracticeGround
=
false
// MARK: - Tutorial Scene
override
func
didMove
(
to
view
:
SKView
)
{
...
...
@@ -161,7 +162,7 @@ class TutorialScene: SKScene, SKPhysicsContactDelegate {
self
.
ground
=
obstacleCreator
.
createRectObstacle
(
rectSize
:
CGSize
(
width
:
groundWidth
,
height
:
groundHeight
),
type
:
.
StartPoint
,
texture
:
nil
)
//MARK: why is the position not changed?
self
.
ground
?
.
position
=
CGPoint
(
x
:
0
,
y
:
-
self
.
frame
.
width
/
6
)
ground
?
.
name
=
"ground"
ground
!
.
name
=
"ground"
obstacles
[
"ground"
]
=
ground
!
addChild
(
self
.
ground
!
)
...
...
@@ -331,6 +332,8 @@ class TutorialScene: SKScene, SKPhysicsContactDelegate {
if
resetGrabStatus
{
character
.
makeHandReleaseFromObstacle
(
hand
:
.
LeftHand
)
character
.
makeHandReleaseFromObstacle
(
hand
:
.
RightHand
)
leftGrabButtonPressed
=
false
rightGrabButtonPressed
=
false
resetGrabStatus
=
false
}
...
...
@@ -623,7 +626,7 @@ class TutorialScene: SKScene, SKPhysicsContactDelegate {
if
startSwingPractice
&&
convert
(
character
.
bodyParts
[
.
LeftUpperArm
]
!.
position
,
from
:
character
)
.
y
<
ground
!.
position
.
y
&&
convert
(
character
.
bodyParts
[
.
RightUpperArm
]
!.
position
,
from
:
character
)
.
y
<
ground
!.
position
.
y
{
if
leftHandCanSwing
&&
rightHandCanSwing
{
if
leftHandCanSwing
&&
rightHandCanSwing
&&
!
bodyOnSwingPracticeGround
{
hangingSuccesful
=
true
...
...
@@ -691,8 +694,11 @@ class TutorialScene: SKScene, SKPhysicsContactDelegate {
character
.
makeHandGrabbingObstacle
(
hand
:
.
LeftHand
)
character
.
leftHandGrabbingAt
=
contactNodeB
as?
SKShapeNode
HapticResponseController
.
grabSucceedFeedback
()
if
contactNodeB
.
name
==
"ground"
{
leftHandCanSwing
=
true
}
}
if
contactNodeB
.
name
==
"handsUpLine"
&&
canReachTiltUp
{
character
.
leftHandFirstLineContact
=
true
...
...
@@ -719,11 +725,15 @@ class TutorialScene: SKScene, SKPhysicsContactDelegate {
character
.
makeHandGrabbingObstacle
(
hand
:
.
LeftHand
)
HapticResponseController
.
grabSucceedFeedback
()
character
.
leftHandGrabbingAt
=
contactNodeB
as?
SKShapeNode
if
contactNodeA
.
name
==
"ground"
{
leftHandCanSwing
=
true
}
}
if
contactNodeA
.
name
==
"handsUpLine"
&&
canReachTiltUp
{
character
.
leftHandFirstLineContact
=
true
}
if
contactNodeA
.
name
==
"firstFlag"
{
...
...
@@ -748,8 +758,11 @@ class TutorialScene: SKScene, SKPhysicsContactDelegate {
character
.
makeHandGrabbingObstacle
(
hand
:
.
RightHand
)
character
.
rightHandGrabbingAt
=
contactNodeB
as?
SKShapeNode
HapticResponseController
.
grabSucceedFeedback
()
if
contactNodeB
.
name
==
"ground"
{
rightHandCanSwing
=
true
}
}
if
contactNodeB
.
name
==
"handsUpLine"
&&
canReachTiltUp
{
character
.
rightHandFirstLineContact
=
true
...
...
@@ -776,8 +789,11 @@ class TutorialScene: SKScene, SKPhysicsContactDelegate {
character
.
makeHandGrabbingObstacle
(
hand
:
.
RightHand
)
character
.
rightHandGrabbingAt
=
contactNodeB
as?
SKShapeNode
HapticResponseController
.
grabSucceedFeedback
()
if
contactNodeA
.
name
==
"ground"
{
rightHandCanSwing
=
true
}
}
if
contactNodeA
.
name
==
"handsUpLine"
&&
canReachTiltUp
{
character
.
rightHandFirstLineContact
=
true
...
...
@@ -803,10 +819,13 @@ class TutorialScene: SKScene, SKPhysicsContactDelegate {
secondFlagReached
=
true
}
if
contact
.
bodyB
.
node
!.
name
==
"swingPractice"
{
bodyOnSwingPracticeGround
=
true
}
if
contact
.
bodyB
.
node
!.
name
==
"swingPractice"
&&
startMovingPracticeGround
&&
hangingSuccesful
{
landed
=
true
}
}
}
else
if
contact
.
bodyB
.
node
!
==
character
.
bodyParts
[
.
Body
]
!
{
if
obstacles
.
values
.
contains
(
contact
.
bodyA
.
node
!
)
{
...
...
@@ -819,6 +838,10 @@ class TutorialScene: SKScene, SKPhysicsContactDelegate {
secondFlagReached
=
true
}
if
contact
.
bodyB
.
node
!.
name
==
"swingPractice"
{
bodyOnSwingPracticeGround
=
true
}
if
contact
.
bodyA
.
node
!.
name
==
"swingPractice"
&&
startMovingPracticeGround
&&
hangingSuccesful
{
landed
=
true
}
...
...
@@ -868,6 +891,20 @@ class TutorialScene: SKScene, SKPhysicsContactDelegate {
rightHandCanSwing
=
false
}
}
if
contact
.
bodyA
.
node
!
==
character
.
bodyParts
[
.
Body
]
!
{
if
obstacles
.
values
.
contains
(
contact
.
bodyB
.
node
!
)
{
if
contact
.
bodyB
.
node
!.
name
==
"swingPractice"
{
bodyOnSwingPracticeGround
=
false
}
}
}
else
if
contact
.
bodyB
.
node
!
==
character
.
bodyParts
[
.
Body
]
!
{
if
obstacles
.
values
.
contains
(
contact
.
bodyA
.
node
!
)
{
if
contact
.
bodyB
.
node
!.
name
==
"swingPractice"
{
bodyOnSwingPracticeGround
=
false
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment