Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
MingSnake_241120
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
MingSnake_241120
Commits
842d0321
Commit
842d0321
authored
Nov 27, 2024
by
haiyoucuv
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
init
parent
33d430f1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
7 deletions
+6
-7
Snake.ts
assets/Scripts/Scenes/MainGame/Snake.ts
+6
-7
No files found.
assets/Scripts/Scenes/MainGame/Snake.ts
View file @
842d0321
...
@@ -262,7 +262,9 @@ export class Snake extends Component {
...
@@ -262,7 +262,9 @@ export class Snake extends Component {
}
}
setAngle
(
angle
:
number
)
{
setAngle
(
angle
:
number
)
{
this
.
isLife
&&
(
this
.
head
.
angle
=
angle
);
if
(
this
.
isLife
)
{
this
.
head
.
angle
=
angle
;
}
}
}
isFast
=
false
;
isFast
=
false
;
...
@@ -293,13 +295,10 @@ export class Snake extends Component {
...
@@ -293,13 +295,10 @@ export class Snake extends Component {
}
}
// 更新头部位置
// 更新头部位置
const
newHeadPos
=
this
.
getNewPos
(
const
newHeadPos
=
this
.
getNewPos
(
this
.
head
.
angle
,
dt
,
this
.
head
.
position
);
this
.
head
.
angle
,
dt
,
this
.
head
.
getPosition
()
);
this
.
head
.
setPosition
(
newHeadPos
);
this
.
head
.
setPosition
(
newHeadPos
);
this
.
head
.
setScale
(
this
.
scale
,
this
.
scale
);
const
flipY
=
this
.
head
.
angle
>
90
&&
this
.
head
.
angle
<
270
;
this
.
head
.
setScale
(
this
.
scale
,
flipY
?
-
this
.
scale
:
this
.
scale
);
this
.
head
.
setSiblingIndex
(
this
.
bodyArr
.
length
);
this
.
head
.
setSiblingIndex
(
this
.
bodyArr
.
length
);
const
space
=
~~
(
this
.
SEGMENT_SPACING
*
this
.
scale
);
const
space
=
~~
(
this
.
SEGMENT_SPACING
*
this
.
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