Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Pacman3D-iOS
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Tobias Ullerich
Pacman3D-iOS
Commits
ddeb664a
Commit
ddeb664a
authored
7 years ago
by
Francois Bertrand
Browse files
Options
Downloads
Patches
Plain Diff
Add point and life label
parent
03ebd205
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
Pacman3D-iOS/GameViewController.swift
+19
-6
19 additions, 6 deletions
Pacman3D-iOS/GameViewController.swift
Pacman3D-iOS/Player.swift
+3
-0
3 additions, 0 deletions
Pacman3D-iOS/Player.swift
with
22 additions
and
6 deletions
Pacman3D-iOS/GameViewController.swift
+
19
−
6
View file @
ddeb664a
...
...
@@ -24,6 +24,11 @@ class GameViewController: UIViewController, SKSceneDelegate ,SCNPhysicsContactDe
var
direction
:
Player
.
Direction
=
.
north
// overlay
var
pointsLabel
:
SKLabelNode
!
var
lifeLabel
:
SKLabelNode
!
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
...
...
@@ -92,7 +97,7 @@ class GameViewController: UIViewController, SKSceneDelegate ,SCNPhysicsContactDe
scnView
.
allowsCameraControl
=
false
// show statistics such as fps and timing information
scnView
.
showsStatistics
=
tru
e
scnView
.
showsStatistics
=
fals
e
// configure the view
scnView
.
backgroundColor
=
UIColor
.
black
...
...
@@ -213,11 +218,19 @@ class GameViewController: UIViewController, SKSceneDelegate ,SCNPhysicsContactDe
}
func
createOverlay
()
->
SKScene
{
let
scene
=
SKScene
(
size
:
self
.
view
.
frame
.
size
)
let
node
=
SKSpriteNode
(
imageNamed
:
"run.png"
)
node
.
position
=
CGPoint
(
x
:
100
,
y
:
100
)
node
.
size
=
CGSize
(
width
:
50
,
height
:
100
)
//scene.addChild(node)
let
scene
=
SKScene
(
size
:
CGSize
(
width
:
self
.
view
.
frame
.
size
.
height
,
height
:
self
.
view
.
frame
.
size
.
width
))
pointsLabel
=
SKLabelNode
(
fontNamed
:
"Chalkduster"
)
pointsLabel
.
text
=
"0 Punkte"
pointsLabel
.
fontColor
=
UIColor
.
red
pointsLabel
.
position
=
CGPoint
(
x
:
100
,
y
:
self
.
view
.
frame
.
width
-
30
)
scene
.
addChild
(
pointsLabel
)
lifeLabel
=
SKLabelNode
(
fontNamed
:
"Chalkduster"
)
lifeLabel
.
text
=
"♥️♥️♥️"
lifeLabel
.
horizontalAlignmentMode
=
.
right
lifeLabel
.
fontColor
=
UIColor
.
red
lifeLabel
.
position
=
CGPoint
(
x
:
self
.
view
.
frame
.
height
-
50
,
y
:
5
)
scene
.
addChild
(
lifeLabel
)
return
scene
}
...
...
This diff is collapsed.
Click to expand it.
Pacman3D-iOS/Player.swift
+
3
−
0
View file @
ddeb664a
...
...
@@ -15,4 +15,7 @@ class Player {
case
south
case
west
}
var
points
:
Int
=
0
var
life
:
Int
=
3
}
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