Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
oetzit
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
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
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
commul
oetzit
Commits
3a1ac56e
Commit
3a1ac56e
authored
3 years ago
by
Paolo.Brasolin
Browse files
Options
Downloads
Patches
Plain Diff
feat: slightly cleanup #fe forest drawing
parent
24c8873b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
frontend/src/js/main.js
+24
-37
24 additions, 37 deletions
frontend/src/js/main.js
with
24 additions
and
37 deletions
frontend/src/js/main.js
+
24
−
37
View file @
3a1ac56e
...
...
@@ -44,7 +44,6 @@ function preload() {
this
.
load
.
image
(
"
b11
"
,
"
assets/background_layers/Layer_0000_9.png
"
);
this
.
load
.
image
(
"
logo
"
,
"
assets/background_layers/Logo.png
"
);
this
.
load
.
image
(
"
ground
"
,
"
assets/background_layers/ground.png
"
);
this
.
load
.
image
(
"
fadeBG
"
,
"
assets/background_layers/fadeBG.png
"
);
this
.
load
.
spritesheet
(
"
oezi
"
,
"
assets/sprites/player/oezi.png
"
,
{
frameWidth
:
27
,
...
...
@@ -87,8 +86,6 @@ function preload() {
let
gameRunning
=
false
;
let
player
;
let
scene
;
let
foreBG
;
let
fadeBG
;
let
imageInUse
=
[];
let
enemyNumber
=
0
;
let
ground
;
...
...
@@ -103,19 +100,28 @@ let enemiesSpeed = 50000;
function
create
()
{
scene
=
this
;
for
(
let
i
=
0
;
i
<=
10
;
i
++
)
{
this
.
add
.
tileSprite
(
0
,
0
,
this
.
cameras
.
main
.
width
,
this
.
cameras
.
main
.
height
,
"
b
"
+
i
,
)
.
setOrigin
(
0
)
.
setScrollFactor
(
0
);
}
this
.
add
.
image
(
this
.
cameras
.
main
.
width
/
2
,
100
,
"
logo
"
).
setScale
(
0.3
);
// Draw background forest
[
"
b0
"
,
"
b1
"
,
"
b2
"
,
"
b3
"
,
"
b4
"
,
"
b5
"
,
"
b6
"
,
"
b7
"
,
"
b8
"
,
"
b9
"
,
"
b10
"
].
forEach
(
(
textureKey
)
=>
{
this
.
add
.
tileSprite
(
0
,
0
,
this
.
cameras
.
main
.
width
,
this
.
cameras
.
main
.
height
,
textureKey
,
)
.
setOrigin
(
0
,
0.2
)
.
setScale
(
1.3
);
},
);
// Draw foreground grass
this
.
add
.
tileSprite
(
0
,
0
,
this
.
cameras
.
main
.
width
,
this
.
cameras
.
main
.
height
,
"
b11
"
)
.
setAlpha
(
0.6
)
.
setOrigin
(
0
,
-
0.03
);
createAnim
(
"
player_idle
"
,
"
oezi
"
,
1
,
5
);
createAnim
(
"
player_run
"
,
"
oezi
"
,
6
,
13
);
...
...
@@ -152,22 +158,6 @@ function create() {
.
setScale
(
3
)
.
setInteractive
();
foreBG
=
this
.
add
.
tileSprite
(
0
,
0
,
this
.
cameras
.
main
.
width
,
this
.
cameras
.
main
.
height
,
"
b11
"
)
.
setOrigin
(
0
,
0
);
fadeBG
=
this
.
add
.
tileSprite
(
0
,
0
,
this
.
cameras
.
main
.
width
,
this
.
cameras
.
main
.
height
,
"
fadeBG
"
,
)
.
setOrigin
(
0
)
.
setScrollFactor
(
0
)
.
setInteractive
();
fadeBG
.
setVisible
(
false
);
player
.
flipX
=
true
;
player
.
play
({
key
:
"
player_run
"
});
...
...
@@ -272,8 +262,7 @@ class enemy {
enemy
.
flipX
=
true
;
setAnimation
(
enemy
,
enemy
.
typeName
+
"
_walk
"
);
scene
.
children
.
bringToTop
(
foreBG
);
scene
.
children
.
bringToTop
(
fadeBG
);
// TODO: bring animal below grass
enemy
.
movement
=
scene
.
tweens
.
add
({
targets
:
enemy
,
...
...
@@ -380,7 +369,7 @@ function shootSpear(enemy, hit) {
let
graphics
=
scene
.
add
.
graphics
();
graphics
.
lineStyle
(
1
,
0xff00ff
,
1
);
curve
.
draw
(
graphics
);
// decomment to see the trajectory
//
curve.draw(graphics); // decomment to see the trajectory
let
spear
=
scene
.
add
.
follower
(
curve
);
...
...
@@ -449,12 +438,10 @@ function submitTranscription(transcription) {
// here invoke image
enemy
.
movement
.
pause
();
setAnimation
(
enemy
,
enemy
.
typeName
+
"
_idle
"
);
fadeBG
.
setVisible
(
true
);
// let beginTime = new Date().getTime();
// let endTime = new Date().getTime();
// let deltaTime = endTime - beginTime;
fadeBG
.
setVisible
(
false
);
hit
=
transcription
==
"
fuffa
"
;
...
...
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