Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Eye-Tracking Classroom
/
StarGazer
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
1538efc8
authored
Aug 29, 2019
by
Alexander Bazo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Show health status for planet
parent
72f499b6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
1 deletions
+13
-1
resources/js/game/objects/Planet.js
+13
-1
No files found.
resources/js/game/objects/Planet.js
View file @
1538efc8
...
@@ -6,7 +6,10 @@ const DEFAULT_HEALTH = 100,
...
@@ -6,7 +6,10 @@ const DEFAULT_HEALTH = 100,
DEFAULT_HIT_BOX_RADIUS
=
270
,
DEFAULT_HIT_BOX_RADIUS
=
270
,
DEFAULT_PLANET_COLOR
=
"#900c47"
,
DEFAULT_PLANET_COLOR
=
"#900c47"
,
DEFAULT_PLANET_BORDER_COLOR
=
"#dafffe"
,
DEFAULT_PLANET_BORDER_COLOR
=
"#dafffe"
,
DEFAULT_PLANET_BORDER_WIDTH
=
"20"
;
DEFAULT_PLANET_BORDER_WIDTH
=
"20"
,
DEFAULT_PLANET_TEXT_OFFSET
=
20
,
DEFAULT_PLANET_TEXT_FONT
=
"32px ShareTech"
,
DEFAULT_PLANET_TEXT_COLOR
=
"#FFF"
;
class
Planet
extends
GameObject
{
class
Planet
extends
GameObject
{
...
@@ -20,6 +23,7 @@ class Planet extends GameObject {
...
@@ -20,6 +23,7 @@ class Planet extends GameObject {
draw
(
context
)
{
draw
(
context
)
{
context
.
save
();
context
.
save
();
// Draw planet
context
.
fillStyle
=
this
.
color
;
context
.
fillStyle
=
this
.
color
;
context
.
strokeStyle
=
this
.
borderColor
;
context
.
strokeStyle
=
this
.
borderColor
;
context
.
lineWidth
=
this
.
borderWidth
;
context
.
lineWidth
=
this
.
borderWidth
;
...
@@ -29,6 +33,14 @@ class Planet extends GameObject {
...
@@ -29,6 +33,14 @@ class Planet extends GameObject {
context
.
closePath
();
context
.
closePath
();
context
.
fill
();
context
.
fill
();
context
.
stroke
();
context
.
stroke
();
// Draw current shield/health status
context
.
beginPath
();
context
.
font
=
DEFAULT_PLANET_TEXT_FONT
;
context
.
fillStyle
=
DEFAULT_PLANET_TEXT_COLOR
;
context
.
textAlign
=
"center"
;
context
.
fillText
(
`Shields at
${
this
.
health
}
%`
,
this
.
x
,
this
.
y
-
DEFAULT_PLANET_TEXT_OFFSET
);
context
.
closePath
();
context
.
restore
();
context
.
restore
();
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment