Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
LuzhouLaojiaoSnake_250428
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
SparkProjects
LuzhouLaojiaoSnake_250428
Commits
5a7d96ae
Commit
5a7d96ae
authored
May 08, 2025
by
haiyoucuv
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
磁铁动画
parent
b1f8c571
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
4 deletions
+3
-4
Snake.ts
src/pages/GamePage/Components/Snake.ts
+3
-4
No files found.
src/pages/GamePage/Components/Snake.ts
View file @
5a7d96ae
...
@@ -75,8 +75,10 @@ export class Snake extends Container {
...
@@ -75,8 +75,10 @@ export class Snake extends Container {
// 创建身体节点
// 创建身体节点
this
.
addEnergy
(
GameConfig
.
initEnergy
);
this
.
addEnergy
(
GameConfig
.
initEnergy
);
this
.
magnetSp
=
this
.
addChild
(
new
Sprite
(
Assets
.
get
(
"磁铁范围.png"
)));
this
.
magnetSp
=
this
.
head
.
addChild
(
new
Sprite
(
Assets
.
get
(
"磁铁范围.png"
)));
this
.
magnetSp
.
anchor
.
set
(
0.5
,
0.5
);
this
.
magnetSp
.
anchor
.
set
(
0.5
,
0.5
);
const
w
=
46
*
GameConfig
.
magnetScale
+
15
;
this
.
magnetSp
.
setSize
(
w
,
w
);
Tween
.
get
(
this
.
magnetSp
,
{
loop
:
true
})
Tween
.
get
(
this
.
magnetSp
,
{
loop
:
true
})
.
to
({
angle
:
360
},
1000
);
.
to
({
angle
:
360
},
1000
);
this
.
magnetSp
.
visible
=
false
;
this
.
magnetSp
.
visible
=
false
;
...
@@ -110,9 +112,6 @@ export class Snake extends Container {
...
@@ -110,9 +112,6 @@ export class Snake extends Container {
let
scale
=
this
.
bodyScale
;
let
scale
=
this
.
bodyScale
;
if
(
this
.
magnetInfo
.
time
)
{
if
(
this
.
magnetInfo
.
time
)
{
scale
*=
GameConfig
.
magnetScale
;
scale
*=
GameConfig
.
magnetScale
;
this
.
magnetSp
.
width
=
46
*
scale
+
15
;
this
.
magnetSp
.
height
=
46
*
scale
+
15
;
this
.
magnetSp
.
position
.
set
(
this
.
head
.
x
,
this
.
head
.
y
);
}
}
this
.
collider
.
setScale
(
scale
,
scale
);
this
.
collider
.
setScale
(
scale
,
scale
);
...
...
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