Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
J
jrag_nodeWorkshop
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
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
Jonas Leder
jrag_nodeWorkshop
Commits
fe095df9
Commit
fe095df9
authored
4 years ago
by
Jonas Leder
Browse files
Options
Downloads
Patches
Plain Diff
draw partner snake with some opacity
parent
99db584e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
_src/assets/scss/snake.scss
+8
-11
8 additions, 11 deletions
_src/assets/scss/snake.scss
_src/assets/ts/snakeMultiplayer.ts
+2
-2
2 additions, 2 deletions
_src/assets/ts/snakeMultiplayer.ts
with
10 additions
and
13 deletions
_src/assets/scss/snake.scss
+
8
−
11
View file @
fe095df9
...
...
@@ -12,17 +12,11 @@ $fieldSize: 20;
width
:
40px
;
height
:
40px
;
}
@for
$i
from
1
through
$fieldSize
{
@for
$x
from
1
through
$fieldSize
{
#field-
#{
$i
}
-
#{
$x
}
{
@if
(
$i
+
$x
)
%
2
==
0
{
background-color
:
$bc-discord-3
;
}
@else
{
background-color
:
color
.
adjust
(
$bc-discord-3
,
$lightness
:
10%
);
}
}
}
.grid
:nth-child
(
even
)
{
background-color
:
$bc-discord-3
;
}
.grid
:nth-child
(
odd
)
{
background-color
:
color
.
adjust
(
$bc-discord-3
,
$lightness
:
10%
);
}
.target
{
background-color
:
red
!
important
;
...
...
@@ -33,10 +27,13 @@ $fieldSize: 20;
.snake-body
{
background-color
:
color
.
adjust
(
$color-primary
,
$lightness
:-
5%
)
!
important
;
}
.snake-partner-head
{
opacity
:
80%
;
background-color
:
color
.
adjust
(
#32a852
,
$lightness
:-
10%
)
!
important
;
}
.snake-partner-body
{
opacity
:
80%
;
background-color
:
color
.
adjust
(
#32a852
,
$lightness
:-
5%
)
!
important
;
}
}
...
...
This diff is collapsed.
Click to expand it.
_src/assets/ts/snakeMultiplayer.ts
+
2
−
2
View file @
fe095df9
...
...
@@ -27,7 +27,7 @@ function drawField(){
let
fieldHTML
:
string
=
""
;
for
(
let
i
:
number
=
1
;
i
<=
fieldSize
;
i
++
){
for
(
let
x
:
number
=
1
;
x
<=
fieldSize
;
x
++
){
let
elementClass
:
string
=
""
;
let
elementClass
:
string
=
"
drawGrid
"
;
for
(
let
y
:
number
=
0
;
y
<
snake
.
length
;
y
++
){
let
currentSnake
:
number
[]
=
snake
[
y
];
if
(
currentSnake
[
0
]
==
i
&&
currentSnake
[
1
]
==
x
){
...
...
@@ -50,7 +50,7 @@ function drawField(){
if
(
target
[
0
]
==
i
&&
target
[
1
]
==
x
)
elementClass
+=
"
target
"
;
fieldHTML
+=
`<span id="field-
${
i
}
-
${
x
}
" class="
${
elementClass
}
"></span>`
;
fieldHTML
+=
`<span
class="grid"><span
id="field-
${
i
}
-
${
x
}
" class="
${
elementClass
}
"></span>
</span>
`
;
}
if
(
i
<
fieldSize
)
{
fieldHTML
+=
"
<br>
"
...
...
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