Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
fucking_flirt
Project
Overview
Details
Activity
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
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
william
fucking_flirt
Commits
b8715fce
Commit
b8715fce
authored
May 05, 2018
by
Eddy Guo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: add another bigHead and yell
parent
61c69f2b
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
64 additions
and
25 deletions
+64
-25
failImage.png
assets/images/failImage.png
+0
-0
stupidHead.png
assets/images/stupidHead.png
+0
-0
Game.js
assets/scripts/Game.js
+13
-5
Teacher.js
assets/scripts/Teacher.js
+51
-20
No files found.
assets/images/failImage.png
0 → 100644
View file @
b8715fce
164 KB
assets/images/stupidHead.png
0 → 100644
View file @
b8715fce
48.2 KB
assets/scripts/Game.js
View file @
b8715fce
...
@@ -154,8 +154,11 @@ cc.Class({
...
@@ -154,8 +154,11 @@ cc.Class({
// 更改时间进度条
// 更改时间进度条
updateLevelProgress
:
function
()
{
updateLevelProgress
:
function
()
{
var
isYelling
=
this
.
teacher
.
getComponent
(
'Teacher'
).
isYelling
if
(
this
.
level
.
progress
>
0
)
{
if
(
this
.
level
.
progress
>
0
)
{
this
.
level
.
progress
-=
((
1
/
this
.
timer
)
/
60
)
if
(
!
isYelling
)
{
this
.
level
.
progress
-=
((
1
/
this
.
timer
)
/
60
)
}
}
else
{
}
else
{
this
.
gameOver
()
this
.
gameOver
()
}
}
...
@@ -179,8 +182,11 @@ cc.Class({
...
@@ -179,8 +182,11 @@ cc.Class({
// 添加分数
// 添加分数
gainScore
:
function
()
{
gainScore
:
function
()
{
this
.
score
+=
1
;
var
isYelling
=
this
.
teacher
.
getComponent
(
'Teacher'
).
isYelling
this
.
score_number
.
string
=
this
.
score
.
toString
();
if
(
!
isYelling
)
{
this
.
score
+=
1
;
this
.
score_number
.
string
=
this
.
score
.
toString
();
}
},
},
// 被抓检测
// 被抓检测
...
@@ -203,7 +209,9 @@ cc.Class({
...
@@ -203,7 +209,9 @@ cc.Class({
if
(
this
.
gameState
===
'action'
)
{
if
(
this
.
gameState
===
'action'
)
{
this
.
updateLevelProgress
()
this
.
updateLevelProgress
()
if
(
this
.
getCaught
())
{
if
(
this
.
getCaught
())
{
this
.
gameFail
()
// this.gameFail()
this
.
teacher
.
getComponent
(
'Teacher'
).
showFailImage
()
}
}
}
}
},
},
...
@@ -221,7 +229,7 @@ cc.Class({
...
@@ -221,7 +229,7 @@ cc.Class({
this
.
hand
.
active
=
false
this
.
hand
.
active
=
false
this
.
board
.
active
=
false
this
.
board
.
active
=
false
this
.
teacher
.
active
=
false
this
.
teacher
.
active
=
false
this
.
gameState
=
'stop'
this
.
gameState
=
'stop'
},
},
// 游戏结束
// 游戏结束
...
...
assets/scripts/Teacher.js
View file @
b8715fce
...
@@ -12,16 +12,23 @@ cc.Class({
...
@@ -12,16 +12,23 @@ cc.Class({
coming
:
{
coming
:
{
default
:
null
,
default
:
null
,
type
:
cc
.
Node
,
type
:
cc
.
Node
,
},
stupidHead
:
{
// [600, 0]
default
:
null
,
type
:
cc
.
Node
,
},
failImage
:
{
// [750, -30]
default
:
null
,
type
:
cc
.
Node
,
}
}
},
},
onLoad
:
function
()
{
onLoad
:
function
()
{
// this.startSwivel()
this
.
isYelling
=
false
// 被抓住显示失败图片的时间
this
.
isSwiveling
=
false
// 是否回头
this
.
isSwiveling
=
false
// 是否回头
this
.
totalTime
=
60
*
1000
// 总时间, bed
this
.
totalTime
=
60
*
1000
// 总时间, bed
this
.
animationTime
=
1
*
1000
// 转头过程单位时间, bed
this
.
animationTime
=
1
*
1000
// 转头过程单位时间, bed
this
.
needSwivelCount
=
20
// 需要回头的次数
this
.
needSwivelCount
=
20
// 需要回头的次数
},
},
swivelAnimation
:
function
()
{
swivelAnimation
:
function
()
{
...
@@ -35,32 +42,32 @@ cc.Class({
...
@@ -35,32 +42,32 @@ cc.Class({
this
.
isSwiveling
=
false
this
.
isSwiveling
=
false
},
this
)
},
this
)
// var coming = cc.find("coming", this.node)
var
bigHead
=
cc
.
find
(
"big_head"
,
this
.
node
)
var
bigHead
=
cc
.
find
(
"big_head"
,
this
.
node
)
var
stupidHead
=
cc
.
find
(
"stupid_head"
,
this
.
node
)
// var comingAction = cc.sequence(
// cc.moveTo(time, cc.p(100, 0)),
// cc.delayTime(time),
// cc.moveTo(time, cc.p(-50, 0)),
// cc.delayTime(time)
// )
var
action
=
cc
.
sequence
(
var
action
=
cc
.
sequence
(
// cc.delayTime(time * 5), // for coming time
cc
.
moveTo
(
5
*
time
,
cc
.
p
(
100
,
0
)),
cc
.
moveTo
(
5
*
time
,
cc
.
p
(
100
,
0
)),
enableSwivel
,
enableSwivel
,
cc
.
delayTime
(
4
*
time
),
cc
.
delayTime
(
4
*
time
),
cc
.
moveTo
(
time
,
cc
.
p
(
0
,
0
)),
cc
.
moveTo
(
time
,
cc
.
p
(
0
,
0
)),
disableSwivel
,
disableSwivel
,
)
)
// coming.runAction(comingAction)
bigHead
.
runAction
(
action
)
},
update
:
function
(
dt
)
{
var
actionRight
=
cc
.
sequence
(
// console.log('🐞-checking', this.isSwiveling)
cc
.
moveTo
(
5
*
time
,
cc
.
p
(
430
,
20
)),
},
enableSwivel
,
cc
.
delayTime
(
4
*
time
),
cc
.
moveTo
(
time
,
cc
.
p
(
600
,
0
)),
disableSwivel
,
)
if
(
!
this
.
isYelling
)
{
if
(
Math
.
random
()
>
0.5
)
{
bigHead
.
runAction
(
action
)
}
else
{
stupidHead
.
runAction
(
actionRight
)
}
}
},
// 获取转头时间的数组, [0.6, 1.2, 2.3, 3.4, 4.8, 5.2, 6.3]
// 获取转头时间的数组, [0.6, 1.2, 2.3, 3.4, 4.8, 5.2, 6.3]
getSwivelTimeArray
:
function
(
totalTime
,
count
,
animationTime
)
{
getSwivelTimeArray
:
function
(
totalTime
,
count
,
animationTime
)
{
...
@@ -79,7 +86,6 @@ cc.Class({
...
@@ -79,7 +86,6 @@ cc.Class({
var
swivelTimeArray
=
this
.
getSwivelTimeArray
(
this
.
totalTime
,
this
.
needSwivelCount
,
this
.
animationTime
)
var
swivelTimeArray
=
this
.
getSwivelTimeArray
(
this
.
totalTime
,
this
.
needSwivelCount
,
this
.
animationTime
)
var
lastTime
var
lastTime
var
swivelFunc
=
(
timeArray
)
=>
{
var
swivelFunc
=
(
timeArray
)
=>
{
const
nextTime
=
timeArray
.
shift
()
const
nextTime
=
timeArray
.
shift
()
if
(
nextTime
)
{
if
(
nextTime
)
{
...
@@ -88,7 +94,9 @@ cc.Class({
...
@@ -88,7 +94,9 @@ cc.Class({
setTimeout
(()
=>
{
setTimeout
(()
=>
{
this
.
swivelAnimation
()
this
.
swivelAnimation
()
swivelFunc
(
timeArray
)
if
(
!
this
.
isYelling
)
{
swivelFunc
(
timeArray
)
}
},
intervel
)
},
intervel
)
}
}
}
}
...
@@ -96,4 +104,26 @@ cc.Class({
...
@@ -96,4 +104,26 @@ cc.Class({
swivelFunc
(
swivelTimeArray
)
swivelFunc
(
swivelTimeArray
)
},
},
showFailImage
:
function
()
{
this
.
isSwiveling
=
false
this
.
isYelling
=
true
var
gameFail
=
cc
.
callFunc
(
function
()
{
this
.
game
.
gameFail
()
},
this
)
var
action
=
cc
.
sequence
(
cc
.
moveTo
(
0.2
,
cc
.
p
(
260
,
-
30
)),
cc
.
delayTime
(
40
),
gameFail
,
)
var
bigHead
=
cc
.
find
(
"big_head"
,
this
.
node
)
bigHead
.
stopAllActions
()
var
stupidHead
=
cc
.
find
(
"stupid_head"
,
this
.
node
)
stupidHead
.
stopAllActions
()
var
failImage
=
cc
.
find
(
"failImage"
,
this
.
node
)
failImage
.
runAction
(
action
)
},
})
})
\ No newline at end of file
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