Commit 23f7def1 by Tulip Li

feat hand

parent 343efb3b
......@@ -74,23 +74,23 @@
"__id__": 19
},
{
"__id__": 23
"__id__": 24
},
{
"__id__": 25
"__id__": 27
},
{
"__id__": 26
"__id__": 28
}
],
"_tag": -1,
"_active": true,
"_components": [
{
"__id__": 27
"__id__": 29
},
{
"__id__": 28
"__id__": 30
}
],
"_prefab": null,
......@@ -227,7 +227,7 @@
}
],
"_tag": -1,
"_active": true,
"_active": false,
"_components": [],
"_prefab": null,
"_id": "11Whf+9qZFC6iWPyh0zx07",
......@@ -525,8 +525,8 @@
"_cascadeOpacityEnabled": true,
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
"x": 0.47762530211413157,
"y": -2.3276772817033287
},
"_contentSize": {
"__type__": "cc.Size",
......@@ -539,8 +539,8 @@
"_scaleY": 0.6,
"_position": {
"__type__": "cc.Vec2",
"x": 2,
"y": 182
"x": 0,
"y": 0
},
"_skewX": 0,
"_skewY": 0,
......@@ -584,7 +584,7 @@
},
"_children": [],
"_tag": -1,
"_active": false,
"_active": true,
"_components": [
{
"__id__": 16
......@@ -857,7 +857,7 @@
},
{
"__type__": "cc.Node",
"_name": "score",
"_name": "life",
"_objFlags": 0,
"_parent": {
"__id__": 19
......@@ -867,7 +867,7 @@
"_active": true,
"_components": [],
"_prefab": null,
"_id": "91m1cv1EdIX4yug893AJz7",
"_id": "bdSU9wyDZNh7HtK8tnUXyL",
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
......@@ -905,7 +905,7 @@
},
{
"__type__": "cc.Node",
"_name": "life",
"_name": "score",
"_objFlags": 0,
"_parent": {
"__id__": 19
......@@ -913,9 +913,13 @@
"_children": [],
"_tag": -1,
"_active": true,
"_components": [],
"_components": [
{
"__id__": 23
}
],
"_prefab": null,
"_id": "bdSU9wyDZNh7HtK8tnUXyL",
"_id": "b1uW/e8tpKs59VVZbffaZS",
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
......@@ -952,6 +956,30 @@
"groupIndex": 0
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 22
},
"_enabled": true,
"_spriteFrame": null,
"_type": 0,
"_sizeMode": 1,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_atlas": null
},
{
"__type__": "cc.Node",
"_name": "hand",
"_objFlags": 0,
......@@ -963,7 +991,10 @@
"_active": true,
"_components": [
{
"__id__": 24
"__id__": 25
},
{
"__id__": 26
}
],
"_prefab": null,
......@@ -979,8 +1010,8 @@
"_cascadeOpacityEnabled": true,
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
"x": -0.35271691256388976,
"y": 2.5309593790505445
},
"_contentSize": {
"__type__": "cc.Size",
......@@ -993,8 +1024,8 @@
"_scaleY": 0.4,
"_position": {
"__type__": "cc.Vec2",
"x": 104,
"y": -340
"x": 0,
"y": 0
},
"_skewX": 0,
"_skewY": 0,
......@@ -1008,7 +1039,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 23
"__id__": 24
},
"_enabled": true,
"_spriteFrame": {
......@@ -1030,6 +1061,15 @@
"_atlas": null
},
{
"__type__": "e6d845SY8hNwLgiBI/kYtQY",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 24
},
"_enabled": true
},
{
"__type__": "cc.Node",
"_name": "failure",
"_objFlags": 0,
......@@ -1162,7 +1202,7 @@
"__id__": 15
},
"hand": {
"__id__": 23
"__id__": 24
}
}
]
\ No newline at end of file
// Learn cc.Class:
// - [Chinese] http://docs.cocos.com/creator/manual/zh/scripting/class.html
// - [English] http://www.cocos2d-x.org/docs/creator/en/scripting/class.html
// Learn Attribute:
// - [Chinese] http://docs.cocos.com/creator/manual/zh/scripting/reference/attributes.html
// - [English] http://www.cocos2d-x.org/docs/creator/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
// - [Chinese] http://docs.cocos.com/creator/manual/zh/scripting/life-cycle-callbacks.html
// - [English] http://www.cocos2d-x.org/docs/creator/en/scripting/life-cycle-callbacks.html
cc.Class({
extends: cc.Component,
properties: {
// isFlirting: false,
// timer: 0,
},
flirtingAction: function() {
// 1.把手放上去 3.过不定时时间,女生showMessage ‘老师,这里有人骚扰’
return cc.moveTo(0.1, cc.p(-30, 70))
// 2.加分
// let intervalId = setInterval(()=> {
// // 加上跟老师的判断
// if(isFlirting && !teachers.isSwivel) {
// this.config.score = this.config.score + this.timer++
// } else {
// clearInterval(intervalId)
// }
// }, 1000)
// 3
// femaleStudent.showMessage(messageList[0,1,2])
},
endFlirtingAction: function() {
return cc.moveTo(0.1, cc.p(0, 0))
},
setTouchScreenControl: function() {
var self = this
// 添加屏幕点击事件监听
// 当触碰到屏幕时,设置抚摸开关打开,并执行抚摸方法
self.node.on(cc.Node.EventType.TOUCH_START, (event) => {
// self.node.on(cc.Node.EventType.MOUSE_DOWN, (event) => {
self.isFlirting = true
self.node.runAction(self.flirtingAction)
})
// 停止触摸屏幕时,设置抚摸开关关闭,停止抚摸
self.node.on(cc.Node.EventType.TOUCH_END, (event) => {
// self.node.on(cc.Node.EventType.MOUSE_UP, (event) => {
self.isFlirting = false
self.node.runAction(self.endFlirtingAction)
})
},
// LIFE-CYCLE CALLBACKS:
onLoad () {
// 初始化抚摸的动作
this.flirtingAction = this.flirtingAction()
// 初始化停止抚摸的动作
this.endFlirtingAction = this.endFlirtingAction()
// this.node.runAction(this.flirtingAction)
// 抚摸的开关
this.isFlirting = false
// 抚摸停留时常
this.timer = 0
// 初始化屏幕点击监听
this.setTouchScreenControl()
},
start () {
},
update (dt) {
if (this.isFlirting) {
this.game.gainScore()
}
},
});
{
"ver": "1.0.5",
"uuid": "e6d84e52-63c8-4dc0-b822-048fe462d418",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment