Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
CS375_Project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ah3472
CS375_Project
Commits
8214d8dd
Commit
8214d8dd
authored
4 years ago
by
ah3472
Browse files
Options
Downloads
Patches
Plain Diff
score code update
parent
377ae54e
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
homepage_html/game.js
+17
-9
17 additions, 9 deletions
homepage_html/game.js
with
17 additions
and
9 deletions
homepage_html/game.js
+
17
−
9
View file @
8214d8dd
...
...
@@ -51,12 +51,7 @@ let bounds;
let
playerCollided
;
let
score
=
0
;
let
something
=
"
Score:
"
+
score
;
let
txt
=
new
PIXI
.
Text
(
something
,{
fontFamily
:
"
Arial
"
,
fontSize
:
15
,
fill
:
"
#FFFFFF
"
});
txt
.
x
=
app
.
view
.
width
/
10
;
txt
.
y
=
app
.
view
.
height
/
4
;
txt
.
anchor
.
set
=
0.5
;
app
.
stage
.
addChild
(
txt
);
let
scoreTxt
;
let
nextX
;
let
nextY
;
...
...
@@ -84,15 +79,27 @@ function startUpGame() {
g1
=
new
gun
(
p1
.
x
-
40
,
p1
.
y
-
5
,
p1
.
weapon
,
10
,
50
,
10
);
g1
.
create_gun
(
app
,
animatedObjects
);
healthBar
();
bounds
=
map
.
currentRoom
.
getColliders
(
app
);
randomlySpawnMobs
(
map
.
currentRoom
.
numOfEnemies
);
loadSprites
();
healthBar
();
createScoreBoard
();
app
.
ticker
.
add
(
map_loop
);
}
function
createScoreBoard
()
{
let
something
=
"
Score:
"
+
score
;
scoreTxt
=
new
PIXI
.
Text
(
something
,{
fontFamily
:
"
Arial
"
,
fontSize
:
25
,
fill
:
"
#FFFFFF
"
});
scoreTxt
.
anchor
.
set
(
0.5
);
scoreTxt
.
x
=
app
.
view
.
width
/
2
;
scoreTxt
.
y
=
30
;
//app.view.height / 4;
scoreTxt
.
anchor
.
set
=
0.5
;
app
.
stage
.
addChild
(
scoreTxt
);
}
function
checkDoorCollision
()
{
if
(
nextX
-
23
<
roomDoors
.
minX
)
{
p1
.
x
=
app
.
view
.
width
/
2
+
64
*
9.5
...
...
@@ -125,6 +132,7 @@ function ChangeRooms(nextRoom) {
app
.
ticker
.
stop
()
map
.
currentRoom
=
nextRoom
map
.
currentRoom
.
drawRoom
(
app
)
createScoreBoard
()
bounds
=
map
.
currentRoom
.
getColliders
(
app
)
if
(
map
.
currentRoom
.
firstTimeInRoom
)
{
randomlySpawnMobs
(
map
.
currentRoom
.
numOfEnemies
)
...
...
@@ -439,7 +447,7 @@ function bulletCollider(delta){
map
.
currentRoom
.
numOfEnemies
--
;
map
.
currentRoom
.
enemies
.
splice
(
j
,
1
);
score
+=
100
;
t
xt
.
text
=
"
Score:
"
+
score
;
scoreT
xt
.
text
=
"
Score:
"
+
score
;
}
}
}
...
...
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