Commit 4bfd7253 authored by spc's avatar spc

modified: project/src/canvas/game/src/com/MatchingPanel.ts

parent eab321e5
......@@ -70,9 +70,9 @@ export class MatchingPanel extends Panel {
leftAvatar.y = -25
lContainer.addChild(leftAvatar)
//遮罩
let lcircle = Tools.getCircle(48, 0xffff00)
lcircle.x = 233
lcircle.y = 27
let lcircle = Tools.getCircle(50, 0xffff00)
lcircle.x = 232
lcircle.y = 26
lContainer.addChild(lcircle)
leftAvatar.mask = lcircle
......@@ -103,9 +103,9 @@ export class MatchingPanel extends Panel {
rightAvatar.y = -25
rContainer.addChild(rightAvatar)
//遮罩
let rcircle = Tools.getCircle(48, 0xffff00)
rcircle.x = right.width - 233
rcircle.y = 27
let rcircle = Tools.getCircle(50, 0xffff00)
rcircle.x = right.width - 232
rcircle.y = 26
rContainer.addChild(rcircle)
rightAvatar.mask = rcircle
......
......@@ -16,7 +16,7 @@ export default class CircleItem extends FYGE.Container {
//类型
type: number
circleRes = ['2a747211-0210-4215-86a2-a6955b37c45b', '7d1ec658-9371-4d52-b4d7-e75d04037daf', '6a1345f6-969c-4969-8bfb-f4de637df34d', '2e12a9ec-46be-487f-a9cd-550dd0af3746', 'b022fbdd-8607-435a-a205-19fc3b5123eb']
circleRes = config.circleRes
point: point
index: number
......
export class Robot {
private _needWin: boolean = true
private _score: number = 0
private _time: number = 120 + Math.random() * 30
constructor(needWin) {
this._needWin = needWin
}
getScore(userScore: number, gameLeftTime: number): number {
if (this._time < 0) {
if (this._needWin) {
//机器人赢
if (userScore > 2600) {
this._score = 3000 + (Math.floor(Math.random() * 8) + 2) * 10
} else {
if (gameLeftTime > 60) {
if (this._score > userScore) {
this._score += (Math.floor(Math.random() * 6) + 2) * 10
} else {
this._score = userScore + (Math.floor(Math.random() * 3) + 2) * 10
}
} else {
if (this._score > userScore) {
this._score += (Math.floor(Math.random() * 8) + 3) * 10
} else {
this._score = userScore + (Math.floor(Math.random() * 8) + 6) * 10
}
}
}
} else {
//机器人输
if (this._score >= userScore) {
return this._score
} else {
//应该的分数
let gapScore = userScore - this._score
let randomScore = (Math.floor(Math.random() * 3) + 2) * 10
if (randomScore < gapScore) {
this._score += randomScore
return this._score
}
}
}
this._time = 120 + Math.random() * 60
}
this._time--
return this._score
}
}
\ No newline at end of file
......@@ -6,5 +6,9 @@ export const config = {
second: 2000,
third: 3000,
//5种每个球的分数
score: [10, 10, 10, 10, 10]
score: [10, 10, 10, 10, 10],
//游戏难度3,4,5
difficulty: 3,
//球的资源
circleRes: ['2a747211-0210-4215-86a2-a6955b37c45b', '7d1ec658-9371-4d52-b4d7-e75d04037daf', '6a1345f6-969c-4969-8bfb-f4de637df34d', '2e12a9ec-46be-487f-a9cd-550dd0af3746', 'b022fbdd-8607-435a-a205-19fc3b5123eb']
}
\ 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