Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
DF-L223
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
template admin
DF-L223
Commits
a33af498
Commit
a33af498
authored
Apr 05, 2020
by
Chen Jiping
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
完善
parent
dbc4c314
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
27 deletions
+30
-27
play.component.ts
src/app/play/play.component.ts
+30
-27
No files found.
src/app/play/play.component.ts
View file @
a33af498
...
...
@@ -1519,6 +1519,9 @@ export class PlayComponent implements OnInit, OnDestroy {
let
toX
=
this
.
bigLotusLeaf
.
lotusLeaf
.
x
-
this
.
frog
.
width
/
2
;
let
toY
=
this
.
bigLotusLeaf
.
lotusLeaf
.
y
-
this
.
frog
.
height
+
50
*
this
.
mapScale
;
this
.
frog
.
bigLeafX
=
toX
;
this
.
frog
.
bigLeafY
=
toY
;
//跳到大荷叶上
this
.
frogJump
(
toX
,
toY
,
1
,
()
=>
{
...
...
@@ -1596,9 +1599,9 @@ export class PlayComponent implements OnInit, OnDestroy {
//停留0.1秒,然后跳出
setTimeout
(()
=>
{
let
tPos
=
this
.
getJumpOutMap
(
toX
,
toY
,
this
.
frog
.
width
,
this
.
frog
.
height
);
let
tPos
=
this
.
getJumpOutMap
2
(
toX
,
toY
,
this
.
frog
.
bigLeafX
,
this
.
frog
.
bigLeafY
,
this
.
frog
.
width
);
console
.
log
(
'
out pos
'
,
tPos
);
console
.
log
(
toX
,
toY
,
'
out pos
'
,
tPos
);
this
.
frogJump
(
tPos
.
x
,
tPos
.
y
,
0.5
,()
=>
{
...
...
@@ -1688,37 +1691,37 @@ export class PlayComponent implements OnInit, OnDestroy {
});
}
/**
* 获取青蛙跳
出
坐标
* 获取青蛙跳
入水中
坐标
* @param curX
* @param curY
* @param sX
* @param sY
* @param width
*/
getJumpOutMap
(
curX
,
curY
,
width
,
height
){
getJumpOutMap
2
(
curX
,
curY
,
sX
,
sY
,
width
){
if
(
curX
<
this
.
canvasWidth
/
2
){
//斜率
let
k
=
(
curY
-
sY
)
/
(
curX
-
sX
);
//第二象限
if
(
curY
<
this
.
canvasHeight
/
2
){
return
{
x
:
curX
,
y
:
-
height
};
}
else
{
//第三象限
return
{
x
:
-
width
,
y
:
curY
};
}
//取得跳出的坐标
let
outX
=
0
;
if
(
curX
<=
sX
){
outX
=
-
width
;
}
else
{
if
(
curY
<
this
.
canvasHeight
/
2
){
//第一象限
return
{
x
:
curX
,
y
:
-
height
};
}
else
{
//第四象限
return
{
x
:
curX
,
y
:
-
height
};
}
outX
=
this
.
canvasWidth
+
width
;
}
}
let
outY
=
k
*
(
outX
-
curX
)
+
curY
;
return
{
x
:
outX
,
y
:
outY
};
}
/**
* 跳到荷叶上显示小星星
...
...
@@ -1811,12 +1814,12 @@ export class PlayComponent implements OnInit, OnDestroy {
//大荷叶划出屏幕
let
toX
=
this
.
canvasWidth
+
this
.
bigLotusLeaf
.
lotusLeaf
.
getBoundingBox
().
width
/
2
;
let
toY
=
this
.
canvasHeight
+
this
.
bigLotusLeaf
.
lotusLeaf
.
getBoundingBox
().
height
/
2
;
tweenChange
(
this
.
bigLotusLeaf
.
lotusLeaf
,
{
x
:
toX
,
y
:
toY
},
1
);
tweenChange
(
this
.
bigLotusLeaf
.
lotusLeaf
,
{
x
:
toX
,
y
:
toY
},
0.5
,
()
=>
{
//显示重新开始按钮
tweenChange
(
this
.
btnRestart
.
sprite
,
{
x
:
this
.
btnRestart
.
showX
,
y
:
this
.
btnRestart
.
showY
},
0.3
);
//显示重新开始按钮
tweenChange
(
this
.
btnRestart
.
sprite
,
{
x
:
this
.
btnRestart
.
showX
,
y
:
this
.
btnRestart
.
showY
},
0.3
);
this
.
tempSmallLotusLeafs
=
[...
this
.
smallLotusLeafs
];
this
.
tempSmallLotusLeafs
=
[...
this
.
smallLotusLeafs
];
});
}
/**
...
...
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