TTweet = enchant.Class.create(enchant.Sprite, {
- initialize : function(w, h) {
+ initialize : function(yukkuri, w, h) {
+ this.x = 0;
+ this.y = 0;
+ this.yukkuri = yukkuri;
this.lifetime = 0;
enchant.Sprite.call(this, w, h + TTweet.TAIL);
this.image = new Surface(w, h + TTweet.TAIL);
ld : {x: 0+s, y:h+t-s}
};
this.image.context.font = "12px 'Times New Roman'";
+ var self = this;
this.addEventListener('enterframe', function(){
if((this.age % 15) == 0){
this.lifetime--;
this.lifetime = 0;
this.opacity = 0;
}
+ this.x = self.yukkuri.getX() - self.width/4 - self.yukkuri.getWidth() / 2;
+ this.y = self.yukkuri.getY() - self.height - self.yukkuri.getHeight() / 2;
+ // this._tweet.text(text, this.getX() - this._tweet.width/4, this.getY() - this._tweet.height);
});
},
reDraw : function() {
scene.addChild(this);
}
});
+App.YUtil = enchant.Class.create(enchant.Sprite,{
+ randomLooks : function(){
+ return rand(_.size(ELooks));
+ }
+});
//how to use
this.unun = 0;
this.sleep = 0;
this.stress = 0;
+ this.looks = 0;
this.inte = 10;
this.str = 10;
this.items_max = 5;
+App = {};
+
function include(astrFile)
{
var script = document.createElement('script');
--- /dev/null
+var Animation = enchant.Class.create({
+ initialize: function (sprite){
+ this.cnt = 0;
+ this.maxY = -4;
+ this.minY = 0;
+ this.y = 0;
+ this.speed = 0.5;
+ this.sprite = sprite;
+ this.status = EAnimStatus.UP;
+ },
+ animrun: function(){
+ if(this.cnt <= this.maxY){
+ this.status = EAnimStatus.DOWN;
+ }
+ else if(this.cnt >= this.minY){
+ this.status = EAnimStatus.UP;
+
+ }
+ if(this.status == EAnimStatus.UP){
+ this.sprite.y -= this.speed;
+ this.cnt -= this.speed;
+ }
+ else if(this.status == EAnimStatus.DOWN){
+ this.sprite.y += this.speed;
+ this.cnt += this.speed;
+ }
+ }
+});
\ No newline at end of file
--- /dev/null
+var FormSprite = enchant.Class.create({
+ initialize: function (){
+ this.spriteArray = [];
+ this.id = guid();
+ this.mainIndex = 0;
+ },
+ addChildAll:function(){
+ for(var i=0;i<this.spriteArray.length;i++){
+ this.spriteArray[i].baseX = this.spriteArray[i].x;
+ this.spriteArray[i].baseY = this.spriteArray[i].y;
+ this.spriteArray[i].anim = new Animation(this.spriteArray[i]);
+ this.spriteArray[i].id = guid();
+ App.backgroundMap.addChild(this.spriteArray[i]);
+ }
+ },
+ /**
+ attr:
+ mainIndex:true/false
+ type:body/tweet
+ */
+ add : function(sprite, index, attr){
+ if(attr === undefined)attr = {};
+ this.spriteArray[index] = sprite;
+ this.spriteArray[index].type = attr.type;
+ this.spriteArray[index].scaleValue = attr.scaleValue;
+ if(attr.mainIndexFlg){
+ this.mainIndex = index;
+ }
+ // this.spriteArray.push(sprite);
+ },
+ remove: function (sprite){
+ this.spriteArray.remove(sprite);
+ },
+ addX: function(x){
+ for(var i=0;i<this.spriteArray.length;i++){
+ var spr = this.spriteArray[i];
+ spr.x += x;
+ }
+ },
+ addY: function(y){
+ for(var i=0;i<this.spriteArray.length;i++){
+ var spr = this.spriteArray[i];
+ spr.y += y;
+ }
+ },
+ getX: function(){
+ return Math.round(this.spriteArray[this.mainIndex].x,2) - this.spriteArray[this.mainIndex].baseX;
+ },
+ getY: function(){
+ return Math.round(this.spriteArray[this.mainIndex].y,2) - this.spriteArray[this.mainIndex].baseY;
+ },
+ setX: function(x){
+ for(var i=0;i<this.spriteArray.length;i++){
+ var spr = this.spriteArray[i];
+ spr.x = x + spr.baseX;
+ }
+ },
+ setY: function(y){
+ for(var i=0;i<this.spriteArray.length;i++){
+ var spr = this.spriteArray[i];
+ spr.y = y + spr.baseY;
+ }
+ },
+ formScaleX: function(x){
+ for(var i=0;i<this.spriteArray.length;i++){
+ var spr = this.spriteArray[i];
+ if(spr.type == "tweet")continue;
+ spr.scaleX = x;
+ }
+ },
+ formScaleY: function(y){
+ for(var i=0;i<this.spriteArray.length;i++){
+ var spr = this.spriteArray[i];
+ if(spr.type == "tweet")continue;
+ spr.scaleY = y;
+ }
+ },
+ // tlTween:function(params){
+ // console.log("tlTween");
+ // for(var i=0;i<this.spriteArray.length;i++){
+ // var spr = this.spriteArray[i];
+ // spr.tl.tween(params);
+ // }
+ // },
+ tlMoveBy:function(x, y, time, eventFunctions){
+ var self = this;
+ for(var i=0;i<this.spriteArray.length;i++){
+ var spr = this.spriteArray[i];
+ if(spr.type == "tweet")continue;
+
+ // var addX = x + spr.baseX;
+ // var addY = y + spr.baseX;
+ var addX = x;
+ var addY = y;
+ // console.log(i+":spry:" + spr.y);
+ var params = {
+ x: this.paramX(spr.x, addX),
+ y: this.paramY(spr.y, addY),
+ time: time,
+ easing: enchant.Easing.SIN_EASEINOUT
+ };
+ if(eventFunctions !== undefined && i == this.mainIndex){
+ for(var key in eventFunctions){
+ params[key] = eventFunctions[key];
+ }
+ }
+ spr.tl.tween(params);
+ }
+ },
+ paramX : function(x, addX){
+ return x + addX;
+ // return function(){
+ // return x + addX;
+ // }
+ },
+ paramY : function(y, addY){
+ return y + addY;
+ },
+ tlMoveTo:function(x, y, time, easing ){
+ for(var i=0;i<this.spriteArray.length;i++){
+ var spr = this.spriteArray[i];
+ spr.tl.moveTo(x, y, time, easing);
+ }
+ },
+ tlQueueLength:function(){
+ return this.spriteArray[this.mainIndex].tl.queue.length;
+ },
+ animation: function(){
+ for(var i=0;i<this.spriteArray.length;i++){
+ var spr = this.spriteArray[i];
+ if(spr.type == "body"){
+ spr.anim.animrun();
+ }
+ }
+ },
+ scale: function(_scaleX,_scaleY){
+ for(var i=0;i<this.spriteArray.length;i++){
+ var spr = this.spriteArray[i];
+ if(spr.type == "tweet")continue;
+ spr.scale(_scaleX, _scaleY);
+ }
+ },
+});
\ No newline at end of file
var CHARA_HEIGHT = 64;
var GAME_WIDTH = 800;
var GAME_HEIGHT = 600;
-var FPS = 20;
+var FPS = 40;
var BASE_FPS = 20;
var HUNGRY_MAX = 100;
var TIME_SPEED = 4;
PLACE_TREE : './data/system/place_tree.png',
GRASS : './data/system/grass.png',
PLAYER_BADGE : './data/system/player_badge.png',
+ KUKI : './data/system/kuki.png',
// PLACE_TREE : './data/system/rapture.png',
};
var EResPathReimu = {
SUBADULT : 1,
CHILD : 2,
BABY : 3,
+ FRUIT_BABY : 4,
};
var EDate = {
MORNING : 0,
var EDamage = {
PICOHAN : 1
};
+var ELooks = {
+ GOOD_YUKKURI : 0,
+ NORMAL_YUKKURI : 1,
+ BAD_YUKKURI : 2,
+};
+var EAnimStatus = {
+ UP : 0,
+ DOWN : 1,
+};
+include("./lib/Animation.js");
+include("./lib/FormSprite.js");
+
+
var ObjSprite = enchant.Class.create(enchant.Sprite,{
initialize: function (w, h){
enchant.Sprite.call(this, w, h);
if(b instanceof Box){
return -1;
}
+ if(a.type == "shadow"){
+ ay += -28 * a.scaleValue;
+ }
+ if(b.type == "shadow"){
+ by += -28 * b.scaleValue;
+ }
+ if(a.classname == "Okazari"){
+ ay += 11 * a.scaleValue;
+ }
+ if(b.classname == "Okazari"){
+ by += 11 * b.scaleValue;
+ }
+ if(a.type == "body"){
+ ay += 32 * a.scaleValue;
+ }
+ else if(a.type == "tweet"){
+ ay += 148 * a.scaleValue;
+ }
+ if(b.type == "body"){
+ by += 32 * b.scaleValue;
+ }
+ else if(b.type == "tweet"){
+ by += 148 * b.scaleValue;
+ }
+
if(a instanceof SpriteGroup){
ay = a.y;
ay += a.height/2;
if(b instanceof Place){
by += Math.round(b.height * 0.7);
}
+ if(a.flgMiYukkuri){
+ ay += CHARA_HEIGHT;
+ }
+ if(b.flgMiYukkuri){
+ by += CHARA_HEIGHT;
+ }
if(ay < by)return -1;
else if(ay > by)return 1;
var def = new Object();
var foodGroup = new Group();
var SpriteGroup = enchant.Class.mixClasses(Sprite, Group,true);
+ SpriteGroup.prototype.classname = "";
var menuBg = new SpriteGroup(EMenuPos.WIDTH, EMenuPos.HEIGHT);
var fieldBg = new enchant.Sprite(EFieldPos.WIDTH, EFieldPos.HEIGHT);
var windowFront = new enchant.Sprite(EFieldPos.WIDTH, EFieldPos.HEIGHT);
game.preload(_loadArr);
var MapGroup = enchant.Class.mixClasses(Map, Group,true);
var backgroundMap = new MapGroup(16, 16);
+ App.backgroundMap = backgroundMap;
include("./class.js");
include("./ctrl.js");
ctl = new Ctrl();
console.log("retryCount over");
return;
}
- if(this.yukkuri.imgGroup.tl.queue.length === 0){
+ if(this.yukkuri.formSprite.tlQueueLength() === 0){
+ // if(this.yukkuri.imgGroup.tl.queue.length === 0){
var frame = 200;
frame += plusFrameScale(frame, this.yukkuri.getMyScale());
if(this.isMoving){
}else{
var xpos = 150 + rand(40) - (retryCounter * 10);
var ypos = 150 + rand(40) - (retryCounter * 10);
- if(rand(8) === 0){
+ if(false){
+ this.yukkuri.vx = xpos;
+ this.yukkuri.vy = ypos;
+ this.yukkuri.direction = EDirection.RIGHT;
+ }
+ else if(rand(8) === 0){
this.yukkuri.vx = 0;
this.yukkuri.vy = -ypos;
}
var map = ctl.backgroundMap;
// var x = this.yukkuri.x + (this.yukkuri.moveX ? this.yukkuri.moveX / Math.abs(this.yukkuri.moveX) * 16 : 0) + 16;
// var y = this.yukkuri.y + (this.yukkuri.moveY ? this.yukkuri.moveY / Math.abs(this.yukkuri.moveY) * 16 : 0) + 16;
- var x = this.yukkuri.imgGroup.x + this.yukkuri.vx;
- var y = this.yukkuri.imgGroup.y + this.yukkuri.vy + this.yukkuri.height / 2;
+ var x = this.yukkuri.getX() + this.yukkuri.vx;
+ var y = this.yukkuri.getY() + this.yukkuri.vy + this.yukkuri.getHeight() / 2;
if (0 <= x && x < map.width && 0 <= y && y < map.height && !map.hitTest(x, y)) {
- // console.log("あたってないよ:"+ this.yukkuri.imgGroup.x + ":" + this.yukkuri.imgGroup.y);
+ // console.log("あたってないよ:"+ this.yukkuri.getX() + ":" + this.yukkuri.getY());
// console.log("X:" + this.yukkuri.moveX);
// console.log("Y:" + this.yukkuri.moveY);
this.isMoving = true;
//うんうんくさい対策
this.targetNode = null;
}else{
- // console.log("HIT:"+ this.yukkuri.imgGroup.x + ":" + this.yukkuri.imgGroup.y);
+ // console.log("HIT:"+ this.yukkuri.getX() + ":" + this.yukkuri.getY() + "," + this.yukkuri.vx + ":" + this.yukkuri.vy);
this.walk(retryCounter+1);
}
}
}
//ゆっくりを検索
else if(node instanceof Yukkuri){
- if(this.yukkuri.within(node, this.yukkuri.getRange())){
+ if(node.grow != EGrow.FRUIT_BABY && this.yukkuri.within(node, this.yukkuri.getRange())){
this.yukkuri.addSearchObject(ESearch.YUKKURI, node);
}
}
this.action = _data.action;
this.action.setStatus(EAction.EAT_WAIT);
-
var sec = BASE_FPS * 3;
if(this.yukkuri.eat(this.food)){
mangMsg.output(this.yukkuri, EMsg.EAT);
//food distance
if(this.data.type == "food"){
this.action.setStatus(EAction.WAIT);
- yukkuri.vx = nodeX - yukkuri.getX() + nodeWidth / 2;
+ yukkuri.vx = nodeX - yukkuri.getX();
yukkuri.vy = nodeY - yukkuri.getY() - yukkuri.getHeight() / 2 + nodeHeight / 2;
var distance = (Math.abs(yukkuri.vx) + Math.abs(yukkuri.vy)) / 2;
var frame = distance + distance/5 + 1;
yukkuri.direction = yukkuri.vx > 0 ? EDirection.RIGHT : EDirection.LEFT;
yukkuri.reverse();
-
yukkuri.moveBy(yukkuri.vx, yukkuri.vy, frame, {
"onactionend": this.onactionend(this)
});
// return this.height * this.yukkuri.myScaleY;
}
});
+ var Kuki = enchant.Class.create(ObjSprite,{
+ initialize: function(yukkuri, x, y){
+ this.classname = "Kuki";
+ enchant.Sprite.call(this, 56, 40);
+ this.image = game.assets[EResPath.KUKI];
+ this.x = 0 + x;
+ this.y = -CHARA_HEIGHT / 2 -CHARA_HEIGHT / 4 + y;
+ this.owner = yukkuri;
+ this.miYukkuris = [];
+ },
+ addMiYukkuri: function(miYukkuri){
+ miYukkuri.setX(miYukkuri.getX() + 30);
+ miYukkuri.setY(miYukkuri.getY() - 30);
+ this.miYukkuris.push(miYukkuri);
+ },
+ getX : function(){
+ return this.x;
+ },
+ getY : function(){
+ return this.y;
+ },
+ getWidth: function(){
+ return this.width;
+ // return this.width * this.yukkuri.myScaleX;
+ },
+ getHeight: function(){
+ return this.height;
+ // return this.height * this.yukkuri.myScaleY;
+ }
+ });
var Address = enchant.Class.create({
initialize: function(yukkuri){
this.friendlyLv = 1;
this.myScaleY = 0.3;
this.mySize = "SS";
}
+ else if(grow == EGrow.FRUIT_BABY){
+ this.myScaleX = 0.2;
+ this.myScaleY = 0.2;
+ this.mySize = "SSS";
+ }
// ctl.game.rootScene.addEventListener('touchstart', this.touchstart);
this.classname = "Yukkuri";
this.addressBook = {};
- this.imgGroup = new SpriteGroup();
- this.imgBody = new SpriteGroup();
- this.imgGroup.id = guid();
- this.imgBody.id = guid();
+ // this.imgGroup = new SpriteGroup();
+ // this.imgBody = new SpriteGroup();
+ // this.imgGroup.id = guid();
+ // this.imgBody.id = guid();
this.x = -CHARA_WIDTH / 2;
this.y = -CHARA_HEIGHT / 2;
this.vx = 0;
this.exLvHash[key] = 0;
this.exValueHash[key] = 0;
}
-
+ this.kukis = [];
+ this.formSprite = new FormSprite();
},
runEnterframe:function(){
+ // console.log("runEnterframe");
+ // this.formSprite.run();
+ // this.formSprite.addX(1);
+
// try{
- this.act();
- if(this.isDead())return;
- this.runYukkuri();
- this.runHungry();
- this.runUnun();
- this.runSleep();
- this.runAddress();
+ if(this.grow == EGrow.FRUIT_BABY){
+ }else{
+ if(this.kukis){
+ // this.kukis[0].miYukkuris[0].setX(this.getX());
+ // this.kukis[0].miYukkuris[0].setY(this.getY());
+ // var _x = this.imgBody.tl.node.x;
+ // var _y = this.imgBody.tl.node.y;
+ // var _gety = this.kukis[0].miYukkuris[0].getY();
+ // this.kukis[0].miYukkuris[0].setOldY();
+ // this.kukis[0].miYukkuris[0].animY(-_y);
+ }
+ // console.log(this.getX() + ":" + this.getY());
+ this.act();
+ if(this.isDead())return;
+ this.runYukkuri();
+ this.runHungry();
+ this.runUnun();
+ this.runSleep();
+ this.runAddress();
+ this.formSprite.animation();
+
+ }
// }catch(e){
// console.log(e);
// }
},
reverse:function(){
if(this.direction == EDirection.RIGHT){
- this.imgBody.scaleX = 1;
+ this.formSprite.formScaleX(this.myScaleX);
+ // this.formSprite.formScaleY(this.myScale);
+
+ // this.imgBody.scaleX = 1;
}
else if(this.direction == EDirection.LEFT){
- this.imgBody.scaleX = -1;
+ this.formSprite.formScaleX(-this.myScaleX);
+ // this.formSprite.formScaleY(this.myScale);
+ // this.imgBody.scaleX = -1;
}
},
tweet:function(text){
text = text.replace(/%name%/g, this.myName);
- this._tweet.text(text, this.x - this._tweet.width/4, this.y - this._tweet.height);
+ // this._tweet.text(text, this.x - this._tweet.width/4, this.y - this._tweet.height);
+ this._tweet.text(text, this.getX() - this._tweet.width/4, this.getY() - this._tweet.height);
},
moveTo:function(x, y, time){
- this.imgGroup.tl.moveTo(x, y, time, enchant.Easing.SIN_EASEINOUT);
+ this.formSprite.tlMoveTo(x, y, time, enchant.Easing.SIN_EASEINOUT);
+ // this.imgGroup.tl.moveTo(x, y, time, enchant.Easing.SIN_EASEINOUT);
},
moveBy:function(x, y, time, eventFunctions){
- var self = this;
- var params = {
- x: function() {
- return self.imgGroup.x + x;
- },
- y: function() {
- return self.imgGroup.y + y;
- },
- time: time,
- easing: enchant.Easing.SIN_EASEINOUT
- };
- //-Event register [onactionstart,onactiontick,onactionend]
- if(eventFunctions !== undefined){
- for(var key in eventFunctions){
- params[key] = eventFunctions[key];
- }
- }
- return this.imgGroup.tl.tween(params);
+ this.formSprite.tlMoveBy(x, y, time, eventFunctions);
+ // var self = this;
+ // var params = {
+ // x: function() {
+ // return self.getX() + x;
+ // // return self.imgGroup.x + x;
+ // },
+ // y: function() {
+ // return self.getY() + y;
+ // // return self.imgGroup.y + y;
+ // },
+ // time: time,
+ // easing: enchant.Easing.SIN_EASEINOUT
+ // };
+ // //-Event register [onactionstart,onactiontick,onactionend]
+ // if(eventFunctions !== undefined){
+ // for(var key in eventFunctions){
+ // params[key] = eventFunctions[key];
+ // }
+ // }
+ // console.log("moveBy");
+ // console.log("self.x:" + self.getX());
+ // return this.formSprite.tlTween(params);
+ // // return this.imgGroup.tl.tween(params);
},
wait:function(frame, eventFunctions){
- this.moveBy(0,1,frame,eventFunctions);
+ this.moveBy(0,0,frame,eventFunctions);
},
act: function(){
this.action.act();
},
- animation: function(){
- var frame = 10;
- frame -= plusFrameScale(frame, this.getMyScale()) / 2;
- var move = 5;
- move -= plusFrameScale(move, this.getMyScale());
- if(this.walkAnimationStatus == EWalkAnimation.END){
- this.imgBody.y = 0;
- this.imgBody.tl.moveByEx(0, -move, frame, enchant.Easing.SWING, {
- "onactionstart": function(e){
- this.walkAnimationStatus = EWalkAnimation.START;
- }
- })
- .moveByEx(0, move, frame, enchant.Easing.SWING,
- {
- "onactionend": function(e){
- this.walkAnimationStatus = EWalkAnimation.END;
- }
- }).loop();
-
- }else{
- this.imgBody.tl.loop();
- }
+ animation: function(){
+ this.formSprite.animation();
+ // var frame = 10;
+ // frame -= plusFrameScale(frame, this.getMyScale()) / 2;
+ // var move = 5;
+ // move -= plusFrameScale(move, this.getMyScale());
+ // if(this.walkAnimationStatus == EWalkAnimation.END){
+ // this.imgBody.y = 0;
+ // this.imgBody.tl.moveByEx(0, -move, frame, enchant.Easing.SWING, {
+ // "onactionstart": function(e){
+ // this.walkAnimationStatus = EWalkAnimation.START;
+ // }
+ // })
+ // .moveByEx(0, move, frame, enchant.Easing.SWING,
+ // {
+ // "onactionend": function(e){
+ // this.walkAnimationStatus = EWalkAnimation.END;
+ // }
+ // }).loop();
+ // }else{
+ // this.imgBody.tl.loop();
+ // }
},
getMyScale: function(){
return (this.myScaleX + this.myScaleY) / 2;
getHeight: function(){
return this.height * this.myScaleY;
},
+ setX: function(x){
+ this.formSprite.setX(x);
+ // this.imgGroup.x = x;
+ },
+ setY: function(y){
+ this.formSprite.setY(y);
+ // this.imgGroup.y = y;
+ },
getX: function(){
- return this.imgGroup.x;
+ return this.formSprite.getX();
+ // return this.imgGroup.x;
},
getY: function(){
- return this.imgGroup.y;
+ return this.formSprite.getY();
+ // return this.imgGroup.y;
},
moveX: function(x){
- this.imgGroup.x += x;
- // this.x += x;
- // this.shadow.x += x;
- // this._tweet.x += x;
+ this.formSprite.addX(x);
+ // this.imgGroup.x += x;
},
moveY: function(y){
- this.imgGroup.y += y;
- // this.y += y;
- // this.shadow.y += y;
- // this._tweet.y += y;
+ this.formSprite.addY(y);
+ // this.imgGroup.y += y;
},
// changeFace: function(erespath){
// this.face.image = game.assets[erespath];
if(this.param.hungry >= 100)this.param.hungry = 100;
},
runUnun: function(){
- if(this.age%50 === 0 && this.age !== 0)this.param.unun++;
+ if(this.age%50 === 0 && this.age !== 0)this.param.unun += 1;
if(this.param.unun >= 100)this.param.unun = 100;
},
runSleep: function(){
unun:function(){
if(this.direction == EDirection.RIGHT){
- new Unun(this.getX(), this.getY() + this.getHeight()/5 );
+ new Unun(this.getX() - this.getWidth()/5, this.getY() + this.getHeight()/5 );
}else{
new Unun(this.getX() - this.getWidth()/5, this.getY() + this.getHeight()/5 );
}
+ // if(this.direction == EDirection.RIGHT){
+ // new Unun(this.getX() + this.getWidth()/2 - this.getWidth()/5, this.getY() + this.getHeight() / 2 + this.getHeight() / 5 );
+ // }else{
+ // new Unun(this.getX() + this.getWidth()/2 - this.getWidth()/5, this.getY() + this.getHeight() / 2 + this.getHeight() / 5 );
+ // }
this.setUnun(0);
},
setBodyImage: function(ebody){
this.image = game.assets[path];
},
tlPause:function(){
- // this.imgBody.tl.pause();
- // this.imgGroup.tl.pause();
- this.imgBody.tl.clear();
- this.imgGroup.tl.clear();
- this.imgBody.tl.unloop();
- this.imgGroup.tl.unloop();
- this.imgBody.y = 0;
+ // this.imgBody.tl.clear();
+ // this.imgGroup.tl.clear();
+ // this.imgBody.tl.unloop();
+ // this.imgGroup.tl.unloop();
+ // this.imgBody.y = 0;
},
tlResume: function(){
this.face.image = game.assets[path];
},
myScale: function(_scaleX, _scaleY){
- this.face.scale(_scaleX,_scaleY);
- if(this.myCode === "REIMU"){
- this.okazari.x = -this.okazari.width / 2;
- this.okazari.y = -CHARA_HEIGHT / 2 + (this.okazari.height * (1 - _scaleY)) / 2;
- }else{
- this.okazari.x = -CHARA_WIDTH /2;
- this.okazari.y = -CHARA_HEIGHT / 2 - (CHARA_HEIGHT * _scaleY)/6;
- }
- if(this.sub1 != null){
- this.sub1.scale(_scaleX,_scaleY);
- }
+ this.formSprite.scale(_scaleX, _scaleY);
+ // this.face.scale(_scaleX,_scaleY);
+ // if(this.myCode === "REIMU"){
+ // // this.okazari.x = -this.okazari.width / 2;
+ // // this.okazari.y = -CHARA_HEIGHT / 2 + (this.okazari.height * (1 - _scaleY)) / 2;
+ // }else{
+ // // this.okazari.x = -CHARA_WIDTH /2;
+ // // this.okazari.y = -CHARA_HEIGHT / 2 - (CHARA_HEIGHT * _scaleY)/6;
+ // }
+ // if(this.sub1 != null){
+ // this.sub1.scale(_scaleX,_scaleY);
+ // }
- this.okazari.scale(_scaleX,_scaleY);
- this.hear.scale(_scaleX,_scaleY);
- this.scale(_scaleX,_scaleY);
- this.shadow.scale(_scaleX, _scaleY);
+ // this.okazari.scale(_scaleX,_scaleY);
+ // this.hear.scale(_scaleX,_scaleY);
+ // this.scale(_scaleX,_scaleY);
+ // if(this.shadow)this.shadow.scale(_scaleX, _scaleY);
},
send: function(targetYukkuri, object, callback){
this.communicateYukkuri = targetYukkuri;
//現在の行動パターンから躾対象かセレクトする
}
},
+ addKuki: function(){
+ for(var i=0;i<this.kukis.length;i++){
+ if(this.kukis[i].opacity == 0){
+ this.kukis[i].opacity = 1.0;
+ var miMarisa = new MiMarisa(this.getX(), this.getY());
+
+ // console.log(this.imgBody);
+ // this.imgBody.addChild(miMarisa);
+ this.kukis[i].addMiYukkuri(miMarisa);
+ break;
+ }
+ }
+ },
destruct: function(){
}
});
+ // var MiYukkuri = enchant.Class.create(Yukkuri,{
+ // initialize: function(x, y, grow){
+ // Yukkuri.call(this,x,y, EGrow.FRUIT_BABY);
+ // this.oldX = x;
+ // this.oldY = y;
+ // },
+ // setOldY: function(){
+ // this.imgGroup.y = this.oldY;
+
+ // },
+ // animX: function(x){
+ // this.oldX = this.imgGroup.x;
+ // this.imgGroup.x -= x;
+ // },
+ // animY: function(y){
+ // this.imgGroup.y = this.oldY;
+ // // this.oldY = this.imgGroup.y;
+ // this.imgGroup.y -= y;
+ // }
+ // });
+ // var MiMarisa = enchant.Class.create(MiYukkuri,{
+ // initialize: function(x, y, grow){
+ // MiYukkuri.call(this,x,y, EGrow.FRUIT_BABY);
+ // this.classname = "MiMarisa";
+ // this.myCode = "MIMARISA";
+ // this.myName = "実まりさ";
+
+ // this.param = new MarisaParam();
+ // this.param.range = 0;
+ // this.param.looks = ELooks.GOOD_YUKKURI;
+
+
+ // this.face = new enchant.Sprite(64, 64);
+ // this.face.image = game.assets[EResPath.MARISA_FACE_NORMAL];
+ // this.face.x = -CHARA_WIDTH / 2;
+ // this.face.y = -CHARA_HEIGHT / 2;
+
+ // this.faceStatus ={};
+ // this.faceStatus[EFace.NORMAL] = EResPath.MARISA_FACE_NORMAL;
+ // this.faceStatus[EFace.CRY1] = EResPath.MARISA_FACE_CRY1;
+ // this.faceStatus[EFace.CRY2] = EResPath.MARISA_FACE_CRY2;
+ // this.faceStatus[EFace.ANGRY] = EResPath.MARISA_FACE_ANGRY;
+ // this.faceStatus[EFace.HAPPY1] = EResPath.MARISA_FACE_HAPPY1;
+ // this.faceStatus[EFace.HAPPY2] = EResPath.MARISA_FACE_HAPPY2;
+ // this.faceStatus[EFace.EAT1] = EResPath.MARISA_FACE_EAT1;
+ // this.faceStatus[EFace.EAT2] = EResPath.MARISA_FACE_EAT2;
+ // this.faceStatus[EFace.TIRED] = EResPath.MARISA_FACE_TIRED;
+ // this.faceStatus[EFace.SLEEP] = EResPath.MARISA_FACE_SLEEP;
+
+ // this.hear = new enchant.Sprite(64, 64);
+ // this.hear.image = game.assets[EResPath.MARISA_HEAR];
+ // this.hear.x = -CHARA_WIDTH / 2;
+ // this.hear.y = -CHARA_HEIGHT / 2;
+
+ // this.okazari = new Okazari(this);
+
+
+ // // this.imgBody.addChild(this);
+ // // this.imgBody.addChild(this.face);
+ // // this.imgBody.addChild(this.hear);
+ // // this.imgBody.addChild(this.okazari);
+ // this.myScale(this.myScaleX, this.myScaleY)
+ // // this.imgGroup.width = this.getWidth();
+ // // this.imgGroup.height = this.getHeight();
+ // // this.imgGroup.addChild(this.imgBody);
+ // // this.imgGroup.flgMiYukkuri = true;
+ // // backgroundMap.addChild(this.imgGroup);
+ // this._tweet = new TTweet(148, 64);
+
+ // this.imgGroup.addChild(this._tweet);
+ // this.imgGroup.x = x;
+ // this.imgGroup.y = y;
+
+ // this.action = new Action(this);
+ // ctl.addObj(this);
+ // }
+
+ // });
var Marisa = enchant.Class.create(Yukkuri,{
initialize: function(x, y, grow){
Yukkuri.call(this,x,y, grow);
// var json = net.load("./data/marisa/params.json");
// this.param = json.root.param;
this.param = new MarisaParam();
+ this.param.looks = ELooks.GOOD_YUKKURI;
if(this.grow == EGrow.BABY){
this.myName = "まりちゃ";
this.param.range /= 4;
this.shadow = new enchant.Sprite(64, 64);
this.shadow.image = game.assets[EResPath.YUKKURI_SHADOW];
this.shadow.x = 0 + this.x;
- this.shadow.y = this.getWidth() / 16 + this.x;
+ this.shadow.y = this.getHeight() / 16 + this.y;
this._style.zIndex = 5;
this.okazari = new Okazari(this);
-
-
- this.imgGroup.addChild(this.shadow);
- this.imgBody.addChild(this);
- this.imgBody.addChild(this.face);
- this.imgBody.addChild(this.hear);
- this.imgBody.addChild(this.okazari);
+ this.kukis = [];
+ this.kukis[0] = new Kuki(this, 0, 0);
+ this.kukis[1] = new Kuki(this, 10, 0);
+ this.kukis[2] = new Kuki(this, 5, 5);
+ this.kukis[3] = new Kuki(this, -5, 5);
+ this._tweet = new TTweet(this, 148, 64);
+
+ this.formSprite.add(this.shadow,0,{type:"shadow",scaleValue:this.myScaleY});
+ this.formSprite.add(this, 1, {
+ mainIndexFlg:true,
+ type : "body",
+ scaleValue:this.myScaleY
+ });
+ this.formSprite.add(this.face,2,{type:"body",scaleValue:this.myScaleY});
+ this.formSprite.add(this.hear,3,{type:"body",scaleValue:this.myScaleY});
+ this.formSprite.add(this.okazari,4,{type:"body",scaleValue:this.myScaleY});
+ this.formSprite.add(this._tweet,5,{type:"tweet",scaleValue:this.myScaleY});
+ this.formSprite.addChildAll();
+ this.formSprite.setX(x);
+ this.formSprite.setY(y);
+ // App.backgroundMap.addChild(this._tweet);
+ // this.imgGroup.addChild(this.shadow);
+ // this.imgBody.addChild(this);
+ // this.imgBody.addChild(this.face);
+ // this.imgBody.addChild(this.hear);
+ // this.imgBody.addChild(this.okazari);
+ // for(var i=0;i<this.kukis.length;i++){
+ // this.imgBody.addChild(this.kukis[i]);
+ // this.kukis[i].opacity = 0;
+ // }
+ // this.kuki = ;
+ // this.imgBody.addChild(new Kuki(this));
this.myScale(this.myScaleX, this.myScaleY)
if(this instanceof Player){
// this.myScaleX = 0.5;
this.budge = new enchant.Sprite(16, 16);
this.budge.image = game.assets[EResPath.PLAYER_BADGE];
- this.imgBody.addChild(this.budge);
+ // this.imgBody.addChild(this.budge);
this.budge.x -= this.getWidth()/2;
this.budge.y -= this.getHeight()/2;
this.budge.scale(this.myScaleX, this.myScaleX);
}
- this.imgGroup.width = this.getWidth();
- this.imgGroup.height = this.getHeight();
- this.imgGroup.addChild(this.imgBody);
- backgroundMap.addChild(this.imgGroup);
- this._tweet = new TTweet(148, 64);
+ // this.imgGroup.width = this.getWidth();
+ // this.imgGroup.height = this.getHeight();
+ // this.imgGroup.addChild(this.imgBody);
+
+ // backgroundMap.addChild(this.imgGroup);
+ // this._tweet = new TTweet(148, 64);
- this.imgGroup.addChild(this._tweet);
- this.imgGroup.x = x;
- this.imgGroup.y = y;
+ // this.imgGroup.addChild(this._tweet);
+ // this.imgGroup.x = x;
+ // this.imgGroup.y = y;
this.animation();
this.action = new Action(this);
}
});
var Player = enchant.Class.create(Marisa,{
- initialize: function(x, y){
+ initialize: function(x, y, grow){
// this.runEnterframe = function(){
// },
- Marisa.call(this, x, y, EGrow.ADULT);
+ if(grow === undefined)grow = EGrow.ADULT;
+ Marisa.call(this, x, y, grow);
this.classname = "Player";
ctl.setPlayer(this);
// this.removeEventListener('enterframe',this.runEnterframe);
this.addEventListener('enterframe', function(){
-
if(this.age%10 === 0 && this.age !== 0){
// console.log("palyer:" + this.age);
}
this.direction = EDirection.LEFT;
}
if(game.input.right){
+ for(var i=0;i<this.formSprite.spriteArray.length;i++){
+ var spr = this.formSprite.spriteArray[i];
+ console.log(i+":spry:" + spr.y);
+ }
this.moveX(10);
this.direction = EDirection.RIGHT;
}
this.okazari = new Okazari(this);
- // this.imgGroup._style.zIndex = 1;
-
- this.imgGroup.addChild(this.shadow);
- this.imgBody.addChild(this.okazari);
- this.imgBody.addChild(this);
- this.imgBody.addChild(this.face);
- this.imgBody.addChild(this.hear);
- this.imgBody.addChild(this.sub1);
+ // this.imgGroup.addChild(this.shadow);
+ // this.imgBody.addChild(this.okazari);
+ // this.imgBody.addChild(this);
+ // this.imgBody.addChild(this.face);
+ // this.imgBody.addChild(this.hear);
+ // this.imgBody.addChild(this.sub1);
this.myScale(this.myScaleX, this.myScaleY)
if(this instanceof Player){
- // this.myScaleX = 0.5;
- // this.myScaleY = 0.5;
-
this.budge = new enchant.Sprite(16, 16);
this.budge.image = game.assets[EResPath.PLAYER_BADGE];
this.imgBody.addChild(this.budge);
this.budge.y -= this.getHeight()/2;
this.budge.scale(this.myScaleX, this.myScaleX);
}
- this.imgGroup.width = this.getWidth();
- this.imgGroup.height = this.getHeight();
- this.imgGroup.addChild(this.imgBody);
- backgroundMap.addChild(this.imgGroup);
- this._tweet = new TTweet(148, 64);
+ // this.imgGroup.width = this.getWidth();
+ // this.imgGroup.height = this.getHeight();
+ // this.imgGroup.addChild(this.imgBody);
+ // backgroundMap.addChild(this.imgGroup);
+ this._tweet = new TTweet(this, 148, 64);
+ backgroundMap.addChild(this._tweet);
+
- this.imgGroup.addChild(this._tweet);
- this.imgGroup.x = x;
- this.imgGroup.y = y;
+ // this.imgGroup.addChild(this._tweet);
+ // this.imgGroup.x = x;
+ // this.imgGroup.y = y;
this.animation();
this.action = new Action(this);
// var food = new def.Food("apple", 200, 250);
backgroundMap.addChild(foodGroup);
// backgroundMap.addChild(placeGroup);
- var player = new Player(PALYER_INIT_X, PALYER_INIT_Y);
+ var player = new Player(PALYER_INIT_X + 200, PALYER_INIT_Y + 200, EGrow.BABY);
+ // var player = new Player(0, 0);
+ // console.log(player.getX());
+ // player.addKuki();
+ // player.createKuki();
new Marisa(PALYER_INIT_X + 50, PALYER_INIT_Y + 200, EGrow.ADULT);
new Marisa(PALYER_INIT_X + 100, PALYER_INIT_Y + 200, EGrow.SUBADULT);
new Marisa(PALYER_INIT_X + 150, PALYER_INIT_Y + 200, EGrow.CHILD);
new Marisa(PALYER_INIT_X + 200, PALYER_INIT_Y + 200, EGrow.BABY);
- // new Reimu(PALYER_INIT_X + 400, PALYER_INIT_Y + 400, EGrow.ADULT);
- new Reimu(PALYER_INIT_X + 350, PALYER_INIT_Y + 400, EGrow.SUBADULT);
+ // // new Reimu(PALYER_INIT_X + 400, PALYER_INIT_Y + 400, EGrow.ADULT);
+ // new Reimu(PALYER_INIT_X + 350, PALYER_INIT_Y + 400, EGrow.SUBADULT);
// new Reimu(PALYER_INIT_X + 300, PALYER_INIT_Y + 400, EGrow.CHILD);
// new Reimu(PALYER_INIT_X + 250, PALYER_INIT_Y + 400, EGrow.BABY);
// new Unun(100, 100);
var ex = e.layerX - EMenuPos.X;
var ey = e.layerY;
var hitFlg = false;
- // console.log("ex:" + ex);
for(var i=0;i<mangIcon.cmdIcons.length;i++){
var icon = mangIcon.cmdIcons[i];
if(icon.x <= ex && ex <= (icon.x + ICON_WIDTH)
};
game.start();
};
+
+
--- /dev/null
+<?php
+ // This script has been placed in the public domain.
+ // Use it and modify it however you wish.
+
+ // Disable zlib compression, if present, for duration of this script.
+ // So we don't double gzip
+ ini_set("zlib.output_compression", "Off");
+
+ //Set the content type header
+ header("Content-Type: text/javascript; charset=UTF-8");
+
+ // Set the cache control header
+ // http 1.1 browsers MUST revalidate -- always
+ header("Cache-Control: must-revalidate");
+function getallheaders() {
+ global $HTTP_SERVER_VARS;
+ if (!empty($HTTP_SERVER_VARS) && is_array($HTTP_SERVER_VARS)) {
+ reset( $HTTP_SERVER_VARS );
+ while( $each_HTTP_SERVER_VARS = each($HTTP_SERVER_VARS) ) {
+ $name = $each_HTTP_SERVER_VARS['key'];
+ $value = $each_HTTP_SERVER_VARS['value'];
+ if(substr($name, 0, 5) == 'HTTP_')
+ $headers[str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($name, 5)))))] = $value;
+ }
+ }
+ return $headers;
+}
+
+
+ // Here we're going to extract the filename list.
+ // We just split the original URL with "/" as the pivot
+ $expl = explode("/",$HTTP_SERVER_VARS["REQUEST_URI"]);
+ // Do a little trimming and url decoding to change %20 into spaces.
+ $fileList = trim(urldecode($expl[count($expl)-1]));
+ $fileList = $_GET['filelist'];
+ // And explode the remainder out with "," as the pivot to get our list.
+ $orgFileNames = explode(",",$fileList);
+ // $fileNames now is an array of the requested file names.
+
+ // Go through each of the files and get its last modified time so we
+ // can send a last-modified header so caching works properly
+ $newestFile = 0;
+ $ii=0;
+ $longFilename = ''; // This is generated for the Hash
+ $fileNames = Array();
+ for ($i=0; ($i < count($orgFileNames)); $i++) {
+ $orgFileNames[$i] = trim($orgFileNames[$i]); // Get rid of whitespace
+ if (preg_match('/\.js$/i',$orgFileNames[$i])) { // Allow only files ending in .js in the list.
+ $fileNames[$ii++]= 'lib/' . $orgFileNames[$i]; // Valid file name, so go ahead and use it.
+ $longFilename .= 'lib/' . $orgFileNames[$i]; // Build our LONG file name for the hash.
+ $lastMod = @filemtime('lib/' . $orgFileNames[$i]); // Get file last modified time
+ if ($lastMod > $newestFile) { // Is this the newest file?
+ $newestFile = $lastMod; // Yup, so mark it.
+ }
+ }
+ }
+/////////////////////////////////////////////////////////////////////////////
+// Begin *BROWSER* Cache Control
+
+ // Here we check to see if the browser is doing a cache check
+ // First we'll do an etag check which is to see if we've already stored
+ // the hash of the filename . '-' . $newestFile. If we find it
+ // nothing has changed so let the browser know and then die. If we
+ // don't find it (or it's a mismatch) something has changed so force
+ // the browser to ignore the cache.
+ $fileHash = md5($longFilename); // This generates a key from the collective file names
+ $hash = $fileHash . '-'.$newestFile; // This appends the newest file date to the key.
+ $headers = getallheaders(); // Get all the headers the browser sent us.
+ if (ereg($hash, $headers['If-None-Match'])) { // Look for a hash match
+ // Our hash+filetime was matched with the browser etag value so nothing
+ // has changed. Just send the last modified date and a 304 (nothing changed)
+ // header and exit.
+ header('Last-Modified: '.gmdate('D, d M Y H:i:s', $newestFile).' GMT', true, 304);
+ die();
+ }
+
+ // We're still alive so save the hash+latest modified time in the e-tag.
+ header("ETag: \"{$hash}\"");
+
+ // For an additional layer of protection we'll see if the browser
+ // sent us a last-modified date and compare that with $newestFile
+ // If there's no change we'll send a cache control header and die.
+
+ if (isset($headers['If-Modified-Since'])) {
+ if ($newestFile <= strtotime($headers['If-Modified-Since'])) {
+ // No change so send a 304 header and terminate
+ header('Last-Modified: '.gmdate('D, d M Y H:i:s', $newestFile).' GMT', true, 304);
+ die();
+ }
+ }
+
+ // Set the last modified date as the date of the NEWEST file in the list.
+ header('Last-Modified: '.gmdate('D, d M Y H:i:s', $newestFile).' GMT');
+
+// End *BROWSER* Cache Control
+/////////////////////////////////////////////////////////////////////////////
+
+
+/////////////////////////////////////////////////////////////////////////////
+// Begin File System Cache Control
+
+ // Attempt to open a cache file for this set. (This is the server file-system
+ // cache, not the browser cache. From here on out we're done with the browser
+ // cache.
+ $fp = @fopen("cache/$fileHash.txt","r");
+ if ($fp) {
+ // A cache file exists but if contents have changed delete the file pointer
+ // so we re-process the files like there was no cache
+ if ($newestFile>@filemtime("cache/$fileHash.txt")) { fclose($fp); $fp=false;}
+ }
+ if (!$fp) {
+ // No file pointer exists so we create the cache files for this set.
+ // for each filename in $fileNames, put the contents into $buffer
+ // with two blank lines between each file.
+ $buffer='';
+ for ($i=0; ($i < count($fileNames)); $i++) {
+ $buffer .= @file_get_contents($fileNames[$i]) . "\n\n";
+ }
+ // We've created our concatenated file so first we'll save it as
+ // plain text for non gzip enabled browsers.
+ $fp = @fopen("cache/$fileHash.txt","w");
+ @fwrite($fp,$buffer);
+ @fclose($fp);
+ // Now we'll compress the file (maximum compression) and save
+ // the compressed version.
+ $fp = @fopen("cache/$fileHash.gz","w");
+ $buffer = gzencode($buffer, 9, FORCE_GZIP);
+ @fwrite($fp,$buffer);
+ @fclose($fp);
+ }
+
+// End File System Cache Control
+/////////////////////////////////////////////////////////////////////////////
+
+
+/////////////////////////////////////////////////////////////////////////////
+// Begin Output
+
+ if (strstr($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip')) {
+ // Browser can handle gzip data so send it the gzip version.
+ header ("Content-Encoding: gzip");
+ header ("Content-Length: " . filesize("cache/$fileHash.gz"));
+ readfile("cache/$fileHash.gz");
+ } else {
+ // Browser can't handle gzip so send it plain text version.
+ header ("Content-Length: " . filesize("cache/$fileHash.txt"));
+ readfile("cache/$fileHash.txt");
+ }
+
+// End Output -- End Program
+/////////////////////////////////////////////////////////////////////////////
+?>
--- /dev/null
+var Animation = enchant.Class.create({
+ initialize: function (sprite){
+ this.cnt = 0;
+ this.maxY = -4;
+ this.minY = 0;
+ this.y = 0;
+ this.speed = 0.5;
+ this.sprite = sprite;
+ this.status = EAnimStatus.UP;
+ },
+ animrun: function(){
+ if(this.cnt <= this.maxY){
+ this.status = EAnimStatus.DOWN;
+ }
+ else if(this.cnt >= this.minY){
+ this.status = EAnimStatus.UP;
+
+ }
+ if(this.status == EAnimStatus.UP){
+ this.sprite.y -= this.speed;
+ this.cnt -= this.speed;
+ }
+ else if(this.status == EAnimStatus.DOWN){
+ this.sprite.y += this.speed;
+ this.cnt += this.speed;
+ }
+ }
+});
\ No newline at end of file
--- /dev/null
+var FormSprite = enchant.Class.create({
+ initialize: function (){
+ this.spriteArray = [];
+ this.id = guid();
+ this.mainIndex = 0;
+ },
+ addChildAll:function(){
+ for(var i=0;i<this.spriteArray.length;i++){
+ this.spriteArray[i].baseX = this.spriteArray[i].x;
+ this.spriteArray[i].baseY = this.spriteArray[i].y;
+ this.spriteArray[i].anim = new Animation(this.spriteArray[i]);
+ this.spriteArray[i].id = guid();
+ App.backgroundMap.addChild(this.spriteArray[i]);
+ }
+ },
+ /**
+ attr:
+ mainIndex:true/false
+ type:body/tweet
+ */
+ add : function(sprite, index, attr){
+ if(attr === undefined)attr = {};
+ this.spriteArray[index] = sprite;
+ this.spriteArray[index].type = attr.type;
+ this.spriteArray[index].scaleValue = attr.scaleValue;
+ if(attr.mainIndexFlg){
+ this.mainIndex = index;
+ }
+ // this.spriteArray.push(sprite);
+ },
+ remove: function (sprite){
+ this.spriteArray.remove(sprite);
+ },
+ addX: function(x){
+ for(var i=0;i<this.spriteArray.length;i++){
+ var spr = this.spriteArray[i];
+ spr.x += x;
+ }
+ },
+ addY: function(y){
+ for(var i=0;i<this.spriteArray.length;i++){
+ var spr = this.spriteArray[i];
+ spr.y += y;
+ }
+ },
+ getX: function(){
+ return Math.round(this.spriteArray[this.mainIndex].x,2) - this.spriteArray[this.mainIndex].baseX;
+ },
+ getY: function(){
+ return Math.round(this.spriteArray[this.mainIndex].y,2) - this.spriteArray[this.mainIndex].baseY;
+ },
+ setX: function(x){
+ for(var i=0;i<this.spriteArray.length;i++){
+ var spr = this.spriteArray[i];
+ spr.x = x + spr.baseX;
+ }
+ },
+ setY: function(y){
+ for(var i=0;i<this.spriteArray.length;i++){
+ var spr = this.spriteArray[i];
+ spr.y = y + spr.baseY;
+ }
+ },
+ formScaleX: function(x){
+ for(var i=0;i<this.spriteArray.length;i++){
+ var spr = this.spriteArray[i];
+ if(spr.type == "tweet")continue;
+ spr.scaleX = x;
+ }
+ },
+ formScaleY: function(y){
+ for(var i=0;i<this.spriteArray.length;i++){
+ var spr = this.spriteArray[i];
+ if(spr.type == "tweet")continue;
+ spr.scaleY = y;
+ }
+ },
+ // tlTween:function(params){
+ // console.log("tlTween");
+ // for(var i=0;i<this.spriteArray.length;i++){
+ // var spr = this.spriteArray[i];
+ // spr.tl.tween(params);
+ // }
+ // },
+ tlMoveBy:function(x, y, time, eventFunctions){
+ var self = this;
+ for(var i=0;i<this.spriteArray.length;i++){
+ var spr = this.spriteArray[i];
+ if(spr.type == "tweet")continue;
+
+ // var addX = x + spr.baseX;
+ // var addY = y + spr.baseX;
+ var addX = x;
+ var addY = y;
+ // console.log(i+":spry:" + spr.y);
+ var params = {
+ x: this.paramX(spr.x, addX),
+ y: this.paramY(spr.y, addY),
+ time: time,
+ easing: enchant.Easing.SIN_EASEINOUT
+ };
+ if(eventFunctions !== undefined && i == this.mainIndex){
+ for(var key in eventFunctions){
+ params[key] = eventFunctions[key];
+ }
+ }
+ spr.tl.tween(params);
+ }
+ },
+ paramX : function(x, addX){
+ return x + addX;
+ // return function(){
+ // return x + addX;
+ // }
+ },
+ paramY : function(y, addY){
+ return y + addY;
+ },
+ tlMoveTo:function(x, y, time, easing ){
+ for(var i=0;i<this.spriteArray.length;i++){
+ var spr = this.spriteArray[i];
+ spr.tl.moveTo(x, y, time, easing);
+ }
+ },
+ tlQueueLength:function(){
+ return this.spriteArray[this.mainIndex].tl.queue.length;
+ },
+ animation: function(){
+ for(var i=0;i<this.spriteArray.length;i++){
+ var spr = this.spriteArray[i];
+ if(spr.type == "body"){
+ spr.anim.animrun();
+ }
+ }
+ },
+ scale: function(_scaleX,_scaleY){
+ for(var i=0;i<this.spriteArray.length;i++){
+ var spr = this.spriteArray[i];
+ if(spr.type == "tweet")continue;
+ spr.scale(_scaleX, _scaleY);
+ }
+ },
+});
\ No newline at end of file
--- /dev/null
+// Underscore.js 1.5.2
+// http://underscorejs.org
+// (c) 2009-2013 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
+// Underscore may be freely distributed under the MIT license.
+(function(){var n=this,t=n._,r={},e=Array.prototype,u=Object.prototype,i=Function.prototype,a=e.push,o=e.slice,c=e.concat,l=u.toString,f=u.hasOwnProperty,s=e.forEach,p=e.map,h=e.reduce,v=e.reduceRight,g=e.filter,d=e.every,m=e.some,y=e.indexOf,b=e.lastIndexOf,x=Array.isArray,w=Object.keys,_=i.bind,j=function(n){return n instanceof j?n:this instanceof j?(this._wrapped=n,void 0):new j(n)};"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=j),exports._=j):n._=j,j.VERSION="1.5.2";var A=j.each=j.forEach=function(n,t,e){if(null!=n)if(s&&n.forEach===s)n.forEach(t,e);else if(n.length===+n.length){for(var u=0,i=n.length;i>u;u++)if(t.call(e,n[u],u,n)===r)return}else for(var a=j.keys(n),u=0,i=a.length;i>u;u++)if(t.call(e,n[a[u]],a[u],n)===r)return};j.map=j.collect=function(n,t,r){var e=[];return null==n?e:p&&n.map===p?n.map(t,r):(A(n,function(n,u,i){e.push(t.call(r,n,u,i))}),e)};var E="Reduce of empty array with no initial value";j.reduce=j.foldl=j.inject=function(n,t,r,e){var u=arguments.length>2;if(null==n&&(n=[]),h&&n.reduce===h)return e&&(t=j.bind(t,e)),u?n.reduce(t,r):n.reduce(t);if(A(n,function(n,i,a){u?r=t.call(e,r,n,i,a):(r=n,u=!0)}),!u)throw new TypeError(E);return r},j.reduceRight=j.foldr=function(n,t,r,e){var u=arguments.length>2;if(null==n&&(n=[]),v&&n.reduceRight===v)return e&&(t=j.bind(t,e)),u?n.reduceRight(t,r):n.reduceRight(t);var i=n.length;if(i!==+i){var a=j.keys(n);i=a.length}if(A(n,function(o,c,l){c=a?a[--i]:--i,u?r=t.call(e,r,n[c],c,l):(r=n[c],u=!0)}),!u)throw new TypeError(E);return r},j.find=j.detect=function(n,t,r){var e;return O(n,function(n,u,i){return t.call(r,n,u,i)?(e=n,!0):void 0}),e},j.filter=j.select=function(n,t,r){var e=[];return null==n?e:g&&n.filter===g?n.filter(t,r):(A(n,function(n,u,i){t.call(r,n,u,i)&&e.push(n)}),e)},j.reject=function(n,t,r){return j.filter(n,function(n,e,u){return!t.call(r,n,e,u)},r)},j.every=j.all=function(n,t,e){t||(t=j.identity);var u=!0;return null==n?u:d&&n.every===d?n.every(t,e):(A(n,function(n,i,a){return(u=u&&t.call(e,n,i,a))?void 0:r}),!!u)};var O=j.some=j.any=function(n,t,e){t||(t=j.identity);var u=!1;return null==n?u:m&&n.some===m?n.some(t,e):(A(n,function(n,i,a){return u||(u=t.call(e,n,i,a))?r:void 0}),!!u)};j.contains=j.include=function(n,t){return null==n?!1:y&&n.indexOf===y?n.indexOf(t)!=-1:O(n,function(n){return n===t})},j.invoke=function(n,t){var r=o.call(arguments,2),e=j.isFunction(t);return j.map(n,function(n){return(e?t:n[t]).apply(n,r)})},j.pluck=function(n,t){return j.map(n,function(n){return n[t]})},j.where=function(n,t,r){return j.isEmpty(t)?r?void 0:[]:j[r?"find":"filter"](n,function(n){for(var r in t)if(t[r]!==n[r])return!1;return!0})},j.findWhere=function(n,t){return j.where(n,t,!0)},j.max=function(n,t,r){if(!t&&j.isArray(n)&&n[0]===+n[0]&&n.length<65535)return Math.max.apply(Math,n);if(!t&&j.isEmpty(n))return-1/0;var e={computed:-1/0,value:-1/0};return A(n,function(n,u,i){var a=t?t.call(r,n,u,i):n;a>e.computed&&(e={value:n,computed:a})}),e.value},j.min=function(n,t,r){if(!t&&j.isArray(n)&&n[0]===+n[0]&&n.length<65535)return Math.min.apply(Math,n);if(!t&&j.isEmpty(n))return 1/0;var e={computed:1/0,value:1/0};return A(n,function(n,u,i){var a=t?t.call(r,n,u,i):n;a<e.computed&&(e={value:n,computed:a})}),e.value},j.shuffle=function(n){var t,r=0,e=[];return A(n,function(n){t=j.random(r++),e[r-1]=e[t],e[t]=n}),e},j.sample=function(n,t,r){return arguments.length<2||r?n[j.random(n.length-1)]:j.shuffle(n).slice(0,Math.max(0,t))};var k=function(n){return j.isFunction(n)?n:function(t){return t[n]}};j.sortBy=function(n,t,r){var e=k(t);return j.pluck(j.map(n,function(n,t,u){return{value:n,index:t,criteria:e.call(r,n,t,u)}}).sort(function(n,t){var r=n.criteria,e=t.criteria;if(r!==e){if(r>e||r===void 0)return 1;if(e>r||e===void 0)return-1}return n.index-t.index}),"value")};var F=function(n){return function(t,r,e){var u={},i=null==r?j.identity:k(r);return A(t,function(r,a){var o=i.call(e,r,a,t);n(u,o,r)}),u}};j.groupBy=F(function(n,t,r){(j.has(n,t)?n[t]:n[t]=[]).push(r)}),j.indexBy=F(function(n,t,r){n[t]=r}),j.countBy=F(function(n,t){j.has(n,t)?n[t]++:n[t]=1}),j.sortedIndex=function(n,t,r,e){r=null==r?j.identity:k(r);for(var u=r.call(e,t),i=0,a=n.length;a>i;){var o=i+a>>>1;r.call(e,n[o])<u?i=o+1:a=o}return i},j.toArray=function(n){return n?j.isArray(n)?o.call(n):n.length===+n.length?j.map(n,j.identity):j.values(n):[]},j.size=function(n){return null==n?0:n.length===+n.length?n.length:j.keys(n).length},j.first=j.head=j.take=function(n,t,r){return null==n?void 0:null==t||r?n[0]:o.call(n,0,t)},j.initial=function(n,t,r){return o.call(n,0,n.length-(null==t||r?1:t))},j.last=function(n,t,r){return null==n?void 0:null==t||r?n[n.length-1]:o.call(n,Math.max(n.length-t,0))},j.rest=j.tail=j.drop=function(n,t,r){return o.call(n,null==t||r?1:t)},j.compact=function(n){return j.filter(n,j.identity)};var M=function(n,t,r){return t&&j.every(n,j.isArray)?c.apply(r,n):(A(n,function(n){j.isArray(n)||j.isArguments(n)?t?a.apply(r,n):M(n,t,r):r.push(n)}),r)};j.flatten=function(n,t){return M(n,t,[])},j.without=function(n){return j.difference(n,o.call(arguments,1))},j.uniq=j.unique=function(n,t,r,e){j.isFunction(t)&&(e=r,r=t,t=!1);var u=r?j.map(n,r,e):n,i=[],a=[];return A(u,function(r,e){(t?e&&a[a.length-1]===r:j.contains(a,r))||(a.push(r),i.push(n[e]))}),i},j.union=function(){return j.uniq(j.flatten(arguments,!0))},j.intersection=function(n){var t=o.call(arguments,1);return j.filter(j.uniq(n),function(n){return j.every(t,function(t){return j.indexOf(t,n)>=0})})},j.difference=function(n){var t=c.apply(e,o.call(arguments,1));return j.filter(n,function(n){return!j.contains(t,n)})},j.zip=function(){for(var n=j.max(j.pluck(arguments,"length").concat(0)),t=new Array(n),r=0;n>r;r++)t[r]=j.pluck(arguments,""+r);return t},j.object=function(n,t){if(null==n)return{};for(var r={},e=0,u=n.length;u>e;e++)t?r[n[e]]=t[e]:r[n[e][0]]=n[e][1];return r},j.indexOf=function(n,t,r){if(null==n)return-1;var e=0,u=n.length;if(r){if("number"!=typeof r)return e=j.sortedIndex(n,t),n[e]===t?e:-1;e=0>r?Math.max(0,u+r):r}if(y&&n.indexOf===y)return n.indexOf(t,r);for(;u>e;e++)if(n[e]===t)return e;return-1},j.lastIndexOf=function(n,t,r){if(null==n)return-1;var e=null!=r;if(b&&n.lastIndexOf===b)return e?n.lastIndexOf(t,r):n.lastIndexOf(t);for(var u=e?r:n.length;u--;)if(n[u]===t)return u;return-1},j.range=function(n,t,r){arguments.length<=1&&(t=n||0,n=0),r=arguments[2]||1;for(var e=Math.max(Math.ceil((t-n)/r),0),u=0,i=new Array(e);e>u;)i[u++]=n,n+=r;return i};var R=function(){};j.bind=function(n,t){var r,e;if(_&&n.bind===_)return _.apply(n,o.call(arguments,1));if(!j.isFunction(n))throw new TypeError;return r=o.call(arguments,2),e=function(){if(!(this instanceof e))return n.apply(t,r.concat(o.call(arguments)));R.prototype=n.prototype;var u=new R;R.prototype=null;var i=n.apply(u,r.concat(o.call(arguments)));return Object(i)===i?i:u}},j.partial=function(n){var t=o.call(arguments,1);return function(){return n.apply(this,t.concat(o.call(arguments)))}},j.bindAll=function(n){var t=o.call(arguments,1);if(0===t.length)throw new Error("bindAll must be passed function names");return A(t,function(t){n[t]=j.bind(n[t],n)}),n},j.memoize=function(n,t){var r={};return t||(t=j.identity),function(){var e=t.apply(this,arguments);return j.has(r,e)?r[e]:r[e]=n.apply(this,arguments)}},j.delay=function(n,t){var r=o.call(arguments,2);return setTimeout(function(){return n.apply(null,r)},t)},j.defer=function(n){return j.delay.apply(j,[n,1].concat(o.call(arguments,1)))},j.throttle=function(n,t,r){var e,u,i,a=null,o=0;r||(r={});var c=function(){o=r.leading===!1?0:new Date,a=null,i=n.apply(e,u)};return function(){var l=new Date;o||r.leading!==!1||(o=l);var f=t-(l-o);return e=this,u=arguments,0>=f?(clearTimeout(a),a=null,o=l,i=n.apply(e,u)):a||r.trailing===!1||(a=setTimeout(c,f)),i}},j.debounce=function(n,t,r){var e,u,i,a,o;return function(){i=this,u=arguments,a=new Date;var c=function(){var l=new Date-a;t>l?e=setTimeout(c,t-l):(e=null,r||(o=n.apply(i,u)))},l=r&&!e;return e||(e=setTimeout(c,t)),l&&(o=n.apply(i,u)),o}},j.once=function(n){var t,r=!1;return function(){return r?t:(r=!0,t=n.apply(this,arguments),n=null,t)}},j.wrap=function(n,t){return function(){var r=[n];return a.apply(r,arguments),t.apply(this,r)}},j.compose=function(){var n=arguments;return function(){for(var t=arguments,r=n.length-1;r>=0;r--)t=[n[r].apply(this,t)];return t[0]}},j.after=function(n,t){return function(){return--n<1?t.apply(this,arguments):void 0}},j.keys=w||function(n){if(n!==Object(n))throw new TypeError("Invalid object");var t=[];for(var r in n)j.has(n,r)&&t.push(r);return t},j.values=function(n){for(var t=j.keys(n),r=t.length,e=new Array(r),u=0;r>u;u++)e[u]=n[t[u]];return e},j.pairs=function(n){for(var t=j.keys(n),r=t.length,e=new Array(r),u=0;r>u;u++)e[u]=[t[u],n[t[u]]];return e},j.invert=function(n){for(var t={},r=j.keys(n),e=0,u=r.length;u>e;e++)t[n[r[e]]]=r[e];return t},j.functions=j.methods=function(n){var t=[];for(var r in n)j.isFunction(n[r])&&t.push(r);return t.sort()},j.extend=function(n){return A(o.call(arguments,1),function(t){if(t)for(var r in t)n[r]=t[r]}),n},j.pick=function(n){var t={},r=c.apply(e,o.call(arguments,1));return A(r,function(r){r in n&&(t[r]=n[r])}),t},j.omit=function(n){var t={},r=c.apply(e,o.call(arguments,1));for(var u in n)j.contains(r,u)||(t[u]=n[u]);return t},j.defaults=function(n){return A(o.call(arguments,1),function(t){if(t)for(var r in t)n[r]===void 0&&(n[r]=t[r])}),n},j.clone=function(n){return j.isObject(n)?j.isArray(n)?n.slice():j.extend({},n):n},j.tap=function(n,t){return t(n),n};var S=function(n,t,r,e){if(n===t)return 0!==n||1/n==1/t;if(null==n||null==t)return n===t;n instanceof j&&(n=n._wrapped),t instanceof j&&(t=t._wrapped);var u=l.call(n);if(u!=l.call(t))return!1;switch(u){case"[object String]":return n==String(t);case"[object Number]":return n!=+n?t!=+t:0==n?1/n==1/t:n==+t;case"[object Date]":case"[object Boolean]":return+n==+t;case"[object RegExp]":return n.source==t.source&&n.global==t.global&&n.multiline==t.multiline&&n.ignoreCase==t.ignoreCase}if("object"!=typeof n||"object"!=typeof t)return!1;for(var i=r.length;i--;)if(r[i]==n)return e[i]==t;var a=n.constructor,o=t.constructor;if(a!==o&&!(j.isFunction(a)&&a instanceof a&&j.isFunction(o)&&o instanceof o))return!1;r.push(n),e.push(t);var c=0,f=!0;if("[object Array]"==u){if(c=n.length,f=c==t.length)for(;c--&&(f=S(n[c],t[c],r,e)););}else{for(var s in n)if(j.has(n,s)&&(c++,!(f=j.has(t,s)&&S(n[s],t[s],r,e))))break;if(f){for(s in t)if(j.has(t,s)&&!c--)break;f=!c}}return r.pop(),e.pop(),f};j.isEqual=function(n,t){return S(n,t,[],[])},j.isEmpty=function(n){if(null==n)return!0;if(j.isArray(n)||j.isString(n))return 0===n.length;for(var t in n)if(j.has(n,t))return!1;return!0},j.isElement=function(n){return!(!n||1!==n.nodeType)},j.isArray=x||function(n){return"[object Array]"==l.call(n)},j.isObject=function(n){return n===Object(n)},A(["Arguments","Function","String","Number","Date","RegExp"],function(n){j["is"+n]=function(t){return l.call(t)=="[object "+n+"]"}}),j.isArguments(arguments)||(j.isArguments=function(n){return!(!n||!j.has(n,"callee"))}),"function"!=typeof/./&&(j.isFunction=function(n){return"function"==typeof n}),j.isFinite=function(n){return isFinite(n)&&!isNaN(parseFloat(n))},j.isNaN=function(n){return j.isNumber(n)&&n!=+n},j.isBoolean=function(n){return n===!0||n===!1||"[object Boolean]"==l.call(n)},j.isNull=function(n){return null===n},j.isUndefined=function(n){return n===void 0},j.has=function(n,t){return f.call(n,t)},j.noConflict=function(){return n._=t,this},j.identity=function(n){return n},j.times=function(n,t,r){for(var e=Array(Math.max(0,n)),u=0;n>u;u++)e[u]=t.call(r,u);return e},j.random=function(n,t){return null==t&&(t=n,n=0),n+Math.floor(Math.random()*(t-n+1))};var I={escape:{"&":"&","<":"<",">":">",'"':""","'":"'"}};I.unescape=j.invert(I.escape);var T={escape:new RegExp("["+j.keys(I.escape).join("")+"]","g"),unescape:new RegExp("("+j.keys(I.unescape).join("|")+")","g")};j.each(["escape","unescape"],function(n){j[n]=function(t){return null==t?"":(""+t).replace(T[n],function(t){return I[n][t]})}}),j.result=function(n,t){if(null==n)return void 0;var r=n[t];return j.isFunction(r)?r.call(n):r},j.mixin=function(n){A(j.functions(n),function(t){var r=j[t]=n[t];j.prototype[t]=function(){var n=[this._wrapped];return a.apply(n,arguments),z.call(this,r.apply(j,n))}})};var N=0;j.uniqueId=function(n){var t=++N+"";return n?n+t:t},j.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var q=/(.)^/,B={"'":"'","\\":"\\","\r":"r","\n":"n"," ":"t","\u2028":"u2028","\u2029":"u2029"},D=/\\|'|\r|\n|\t|\u2028|\u2029/g;j.template=function(n,t,r){var e;r=j.defaults({},r,j.templateSettings);var u=new RegExp([(r.escape||q).source,(r.interpolate||q).source,(r.evaluate||q).source].join("|")+"|$","g"),i=0,a="__p+='";n.replace(u,function(t,r,e,u,o){return a+=n.slice(i,o).replace(D,function(n){return"\\"+B[n]}),r&&(a+="'+\n((__t=("+r+"))==null?'':_.escape(__t))+\n'"),e&&(a+="'+\n((__t=("+e+"))==null?'':__t)+\n'"),u&&(a+="';\n"+u+"\n__p+='"),i=o+t.length,t}),a+="';\n",r.variable||(a="with(obj||{}){\n"+a+"}\n"),a="var __t,__p='',__j=Array.prototype.join,"+"print=function(){__p+=__j.call(arguments,'');};\n"+a+"return __p;\n";try{e=new Function(r.variable||"obj","_",a)}catch(o){throw o.source=a,o}if(t)return e(t,j);var c=function(n){return e.call(this,n,j)};return c.source="function("+(r.variable||"obj")+"){\n"+a+"}",c},j.chain=function(n){return j(n).chain()};var z=function(n){return this._chain?j(n).chain():n};j.mixin(j),A(["pop","push","reverse","shift","sort","splice","unshift"],function(n){var t=e[n];j.prototype[n]=function(){var r=this._wrapped;return t.apply(r,arguments),"shift"!=n&&"splice"!=n||0!==r.length||delete r[0],z.call(this,r)}}),A(["concat","join","slice"],function(n){var t=e[n];j.prototype[n]=function(){return z.call(this,t.apply(this._wrapped,arguments))}}),j.extend(j.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}})}).call(this);
+//# sourceMappingURL=underscore-min.map
\ No newline at end of file