欢迎来到程序小院
玩法:点击左右拳头攻击两侧敌人,宠物出现时能为你吸收少量伤害,
敌方英雄出现时需要多次攻击才能消灭,在60秒内挑战最高分吧^^。
开始游戏https://www.ormcc.com/play/gameStart/234
#loadicon{margin-top: 250px; }
#orient{margin-top:50px;}
p{color:#FFFFFF; font-size: 24}
var Enemy = cc.Sprite.extend({
eID: 0,
active: !0,
isLive: !0,
aimX: 0,
direct: 1,
zOrder: 10,
dieAction: null,
liveAction: null,
speed: 5,
speedV: 15,
rightsidex: 0,
leftsidex: 0,
showLevel: 0,
showSpace: 0,
hasFired: !1,
speedY: 0,
livenum: 1,
kind: 1,
power: 1,
oric: null,
ctor: function(a) {
this._super("#npc" + a + "0001.png");
this.kind = a;
this.power = 1.5 * a;
this.oric = this.color;
this.anchorY = this.anchorX = 0.5;
this.rightsidex = winSize.width
},
update: function(a) {
if (this.active) {
a = this.x;
var b = this.y; - 50 < a && -1 == this.direct || a < winSize.width + 50 &&
1 == this.direct ?
(a += this.speed, this.y = b += this.speedY, this.x = a) : this.destroy()
}
},
toRun: function() {
this.liveAction = cc.RepeatForever.create(cc.Animate.create(
cc.animationCache.getAnimation("emy" + this.kind)));
this.stopAllActions();
this.runAction(this.liveAction)
},
toBeHurt: function(a) {
this.livenum -= a;
0 >= this.livenum ? this.kill() : (this.hasFired = !1, this.x -=
0.2 * winSize.width * this.direct)
},
kill: function() {
this.isLive = !1;
this.stopAllActions();
this.dieAction = cc.Animate.create(cc.animationCache.getAnimation("emy" +
this.kind + "die"));
this.ratoteAction = cc.RepeatForever.create(cc.RotateBy.create(0.2, 360));
this.runAction(this.dieAction);
this.runAction(this.ratoteAction);
this.speedY = 10 * Math.random() + 5;
this.x > winSize.width / 2 ? (this.direct = 1, this.speed = this.speedV) :
(this.direct = -1, this.speed = -this.speedV)
},
destroy: function() {
this.speedY = 0;
this.active = this.visible = !1;
this.liveAction = this.dieAction = null;
GD.ACTIVE_ENEMIES--;
this.stopAllActions()
},
attactRect: function() {
return cc.rect(this.x, -1, 60, -1)
},
collideRect: function(a, b) {
return cc.rect(this.x, -1, 50, -1)
},
toActive: function(a, b) {
trace("----Enemy.toActive-" + a + "--");
this.active = this.visible = !0;
this.direct = 0 == a ? -1 : 1;
this.y = [45, 60, 50][this.kind - 1];
this.speedY = 0;
this.livenum = this.kind;
var e = 65 * b;
1 == this.direct ? (this.speed = 1.5 * this.kind + 4, this.x =
this.leftsidex - e, this.scaleX = 1) : (this.scaleX = -1,
this.speed = -(2 * this.kind + 3), this.x = this.rightsidex + e);
this.hasFired = !1;
this.isLive = !0;
this.rotation = 0;
this.toRun()
}
});
Enemy.addNewEnemy = function(a, b) {
if (0 < this.showSpace) this.showSpace--;
else if (!(10 <= GD.ACTIVE_ENEMIES)) {
GD.SHOWLEVEL += 1;
var e = 0.5 < Math.random() ? 1 : 0;
if (3 > b) Enemy.getOrCreateEnemy(a).toActive(e, 0);
else {
this.showSpace = 1;
for (var d = 0; d < b; d++) Enemy.getOrCreateEnemy(a).toActive(e, d)
}
}
};
Enemy.getOrCreateEnemy = function(a) {
for (var b = null, e = 0; e < GD.CONTAINER.ENEMIES.length; e++)
if (b = GD.CONTAINER.ENEMIES[e], !1 == b.active && b.kind == a)
return GD.ACTIVE_ENEMIES++, b;
b = Enemy.create(a);
GD.ACTIVE_ENEMIES++;
return b
};
Enemy.shared = function() {
for (var a = [], b = [], e = [], d = "", c = 1; 19 > c; c++) d = "npc100" +
(10 > c ? "0" + c : c) + ".png", d = cc.spriteFrameCache.getSpriteFrame(d),
a.push(d), d = "npc200" + (10 > c ? "0" + c : c) + ".png", d =
cc.spriteFrameCache.getSpriteFrame(d), b.push(d), d = "npc300" +
(10 > c ? "0" + c : c) + ".png", d = cc.spriteFrameCache.getSpriteFrame(d), e.push(d);
cc.animationCache.addAnimation(cc.Animation.create(a, 0.04), "emy1");
cc.animationCache.addAnimation(cc.Animation.create(b, 0.04), "emy2");
cc.animationCache.addAnimation(cc.Animation.create(e,
0.04), "emy3");
cc.animationCache.addAnimation(cc.Animation.create([cc.spriteFrameCache.
getSpriteFrame("npc12.png")], 0.04), "emy1die");
cc.animationCache.addAnimation(cc.Animation.create([cc.spriteFrameCache.
getSpriteFrame("npc22.png")], 0.04), "emy2die");
cc.animationCache.addAnimation(cc.Animation.create([cc.spriteFrameCache.
getSpriteFrame("npc32.png")], 0.04), "emy3die")
};
Enemy.create = function(a) {
a = new Enemy(a);
g_sharedGameLayer.addEnemy(a, GD.UNIT_TAG.ENEMY, a.zOrder);
GD.CONTAINER.ENEMIES.push(a);
return a
};
Enemy.preSet = function() {
for (var a = null, b = 0; 2 > b; b++) a = Enemy.create(b + 1), a.visible =
!1, a.active = !1, a.stopAllActions(), a.unscheduleAllCallbacks()
};
var Helo = cc.Sprite.extend({
eID: 0,
active: !0,
direct: 1,
zOrder: 30,
hurtAction: null,
standAction: null,
attactActionList: [],
hasFired: !1,
attactKind: 0,
lock: !1,
potList: [
[-20, 19],
[-80, 32],
[-20, 40],
[0, 0],
[12, -6]
],
ctor: function() {
this._super("#role0001.png");
this.install();
this.toStand();
this.anchorY = this.anchorX = 0.5;
this.y = 50
},
install: function() {
this.attactActionList = [];
for (var a = [], b = [], e = [], d = "", c = 10; 18 > c; c++) {
var f = 14 < c ? 14 : c,
d = "role00" + f + ".png",
d = cc.spriteFrameCache.getSpriteFrame(d);
a.push(d);
d = "role00" + (f +
5) + ".png";
d = cc.spriteFrameCache.getSpriteFrame(d);
b.push(d);
d = "role00" + (f + 10) + ".png";
d = cc.spriteFrameCache.getSpriteFrame(d);
e.push(d)
}
c = cc.Sequence.create(cc.Animate.create(cc.Animation.create(a, 0.04)),
cc.CallFunc.create(this.toStand, this));
c.retain();
this.attactActionList.push(c);
c = cc.Sequence.create(cc.Animate.create(cc.Animation.create(b, 0.04)),
cc.CallFunc.create(this.toStand, this));
c.retain();
this.attactActionList.push(c);
c = cc.Sequence.create(cc.Animate.create(cc.Animation.create(e, 0.04)),
cc.CallFunc.create(this.toStand,
this));
c.retain();
this.attactActionList.push(c);
b = [];
for (c = 1; 9 > c; c++) d = "role000" + c + ".png", d =
cc.spriteFrameCache.getSpriteFrame(d), b.push(d);
this.standAction = cc.RepeatForever.create(cc.Animate.create(
cc.Animation.create(b, 0.08)));
this.standAction.retain();
b = [];
for (c = 25; 36 > c; c++) f = 34 < c ? 34 : c, d = "role00" + (
10 > f ? "0" + f : f) + ".png", d = cc.spriteFrameCache.getSpriteFrame(d),
b.push(d);
c = cc.Animation.create(b, 0.04);
this.hurtAction = cc.Sequence.create(cc.Animate.create(c),
cc.CallFunc.create(this.toStand, this));
this.hurtAction.retain()
},
setDirect: function(a) {
this.scaleX = this.direct = a
},
setNewPot: function(a) {
this.x = -20 * this.direct + winSize.width / 2
},
update: function(a) {},
toStand: function() {
this.lock = !1;
this.stopAllActions();
this.runAction(this.standAction);
this.setNewPot(3)
},
beHurt: function(a) {
this.lock = !1;
1 == a ? this.setDirect(1) : this.setDirect(-1);
this.stopAllActions();
this.setNewPot(4);
this.runAction(this.hurtAction)
},
toAttact: function() {
this.lock = !0;
this.stopAllActions();
var a = Math.floor(3 * Math.random());
this.attactKind = a;
this.setNewPot(a);
this.runAction(this.attactActionList[a])
},
destroy: function() {
this.active = this.visible = !1;
this.attactActionList = [];
this.stopAllActions()
},
attactRect: function() {
return cc.rect(this.x, -1, 130, -1)
},
collideRect: function(a, b) {
return cc.rect(this.x, -1, 20, -1)
}
});
源码
需要源码请关注添加好友哦^ ^
转载:欢迎来到本站,转载请注明文章出处
https://ormcc.com/