| 1069 |
if(this.moveInfo.t < this.moveInfo.f) { |
if(this.moveInfo.t < this.moveInfo.f) { |
| 1070 |
this.moveTo(this.moveInfo.x + Math.round((this.moveInfo.dx - this.moveInfo.x) / this.moveInfo.f * this.moveInfo.t), this.moveInfo.y + Math.round((this.moveInfo.dy - this.moveInfo.y) / this.moveInfo.f * this.moveInfo.t)); |
this.moveTo(this.moveInfo.x + Math.round((this.moveInfo.dx - this.moveInfo.x) / this.moveInfo.f * this.moveInfo.t), this.moveInfo.y + Math.round((this.moveInfo.dy - this.moveInfo.y) / this.moveInfo.f * this.moveInfo.t)); |
| 1071 |
} else { |
} else { |
| 1072 |
if(this.moveInfo.t >= this.moveInfo.f) { |
this.moveTo(this.moveInfo.dx, this.moveInfo.dy); |
| 1073 |
this.moveTo(this.moveInfo.dx, this.moveInfo.dy); |
this.endMove(); |
|
this.endMove(); |
|
|
} |
|
| 1074 |
} |
} |
| 1075 |
} |
} |
| 1076 |
}; |
}; |
| 1091 |
} |
} |
| 1092 |
}; |
}; |
| 1093 |
Character.prototype.angle = function (angle) { |
Character.prototype.angle = function (angle) { |
| 1094 |
|
this.currentAngle = angle; |
| 1095 |
var rowP = Math.floor(this.charaSeq / this.charaCol) * 4; |
var rowP = Math.floor(this.charaSeq / this.charaCol) * 4; |
|
console.log(rowP); |
|
| 1096 |
switch(angle) { |
switch(angle) { |
| 1097 |
case Angle.up: { |
case Angle.up: { |
| 1098 |
rowP += (this.angleSeq ? this.angleSeq[Angle.up] : 3); |
rowP += (this.angleSeq ? this.angleSeq[Angle.up] : 3); |
| 1146 |
this.wait = 200; |
this.wait = 200; |
| 1147 |
this.charaCol = 1; |
this.charaCol = 1; |
| 1148 |
this.animeCnt = 2; |
this.animeCnt = 2; |
| 1149 |
this.moveTime = 20; |
this.moveTime = 300; |
| 1150 |
this.movePixel = 64; |
this.movePixel = 64; |
| 1151 |
this.angle = Angle.down; |
this.angle = Angle.down; |
| 1152 |
this.createClass = Character; |
this.createClass = Character; |
| 1153 |
} |
} |
| 1154 |
CharacterFactory.prototype.create = function (charaSeq, offset, angle) { |
CharacterFactory.prototype.create = function (charaSeq, offset, angle) { |
| 1155 |
var c = new this.createClass(this.width, this.height, this.image, this.wait); |
var c = new this.createClass(this.width, this.height, this.image, this.wait); |
| 1156 |
c.charaSeq = charaSeq; |
var black = [ |
| 1157 |
c.charaCol = this.charaCol; |
"width", |
| 1158 |
c.animeCnt = this.animeCnt; |
"height", |
| 1159 |
c.moveTime = this.moveTime; |
"image", |
| 1160 |
c.movePixel = this.movePixel; |
"wait", |
| 1161 |
c.angle((angle == undefined) ? this.angle : angle); |
"angle" |
| 1162 |
if(this.angleSeq) { |
]; |
| 1163 |
c.angleSeq = this.angleSeq; |
for(var i in this) { |
| 1164 |
|
if(typeof this[i] == "function") { |
| 1165 |
|
continue; |
| 1166 |
|
} |
| 1167 |
|
if(black.indexOf(i) >= 0) { |
| 1168 |
|
continue; |
| 1169 |
|
} |
| 1170 |
|
c[i] = this[i]; |
| 1171 |
} |
} |
| 1172 |
|
c.charaSeq = charaSeq; |
| 1173 |
|
c.angle(angle == undefined ? this.angle : angle); |
| 1174 |
if(offset) { |
if(offset) { |
| 1175 |
c.moveTo(offset.x, offset.y); |
c.moveTo(offset.x, offset.y); |
| 1176 |
} |
} |
| 1515 |
if(!area) { |
if(!area) { |
| 1516 |
area = new Area(Math.round(parent.x), Math.round(parent.y), parent.width, parent.height); |
area = new Area(Math.round(parent.x), Math.round(parent.y), parent.width, parent.height); |
| 1517 |
} |
} |
| 1518 |
|
if(parent.orderDraw) { |
| 1519 |
|
parent.orderDraw(); |
| 1520 |
|
} |
| 1521 |
c.save(); |
c.save(); |
| 1522 |
if(parent.options) { |
if(parent.options) { |
| 1523 |
this.useDrawOption(parent, c); |
this.useDrawOption(parent, c); |
| 1952 |
}; |
}; |
| 1953 |
var onkeydown = function (e) { |
var onkeydown = function (e) { |
| 1954 |
_this.inputDown.fire(new InputKeyboardEvent(_this.keymap[e.keyCode], e)); |
_this.inputDown.fire(new InputKeyboardEvent(_this.keymap[e.keyCode], e)); |
| 1955 |
|
if(_this.keymap[e.keyCode] != undefined) { |
| 1956 |
|
e.preventDefault(); |
| 1957 |
|
} |
| 1958 |
}; |
}; |
| 1959 |
var onkeyup = function (e) { |
var onkeyup = function (e) { |
| 1960 |
_this.inputUp.fire(new InputKeyboardEvent(_this.keymap[e.keyCode], e)); |
_this.inputUp.fire(new InputKeyboardEvent(_this.keymap[e.keyCode], e)); |
| 1961 |
|
if(_this.keymap[e.keyCode] != undefined) { |
| 1962 |
|
e.preventDefault(); |
| 1963 |
|
} |
| 1964 |
}; |
}; |
| 1965 |
if(document.addEventListener) { |
if(document.addEventListener) { |
| 1966 |
document.addEventListener("keydown", onkeydown, false); |
document.addEventListener("keydown", onkeydown, false); |
| 2085 |
for(var i = 0; i < _this.timers.length; i++) { |
for(var i = 0; i < _this.timers.length; i++) { |
| 2086 |
_this.timers[i].tryFire(t); |
_this.timers[i].tryFire(t); |
| 2087 |
} |
} |
| 2088 |
if(_this.targetFps == 0 || (_this.renderTick + _this.targetFps) <= t) { |
if(_this.targetFps == 0 || _this.renderTick <= t) { |
| 2089 |
if(_this.render) { |
if(_this.render) { |
| 2090 |
_this.render.fire(); |
_this.render.fire(); |
| 2091 |
} |
} |
| 2092 |
_this.renderer.render(); |
_this.renderer.render(); |
| 2093 |
_this.renderTick = (_this.targetFps == 0) ? t : _this.renderTick + _this.targetFps; |
if(_this.targetFps) { |
| 2094 |
|
_this.renderTick = t + _this.targetFps; |
| 2095 |
|
} |
| 2096 |
if(_this.fps) { |
if(_this.fps) { |
| 2097 |
fps_stack.shift(); |
if(fps_stack.length == 19) { |
| 2098 |
fps_stack.push(t); |
_this.fps.innerHTML = Math.round(20000 / (t - fps_stack[0])).toString(); |
| 2099 |
_this.fps.innerHTML = Math.round(20000 / (t - fps_stack[0])).toString(); |
fps_stack = []; |
| 2100 |
|
} else { |
| 2101 |
|
fps_stack.push(t); |
| 2102 |
|
} |
| 2103 |
} |
} |
| 2104 |
} |
} |
| 2105 |
if(!_this._exit) { |
if(!_this._exit) { |
| 2108 |
}; |
}; |
| 2109 |
this.tick = window.getTime(); |
this.tick = window.getTime(); |
| 2110 |
this.renderTick = this.tick - this.targetFps; |
this.renderTick = this.tick - this.targetFps; |
|
if(this.fps) { |
|
|
for(var i = 0; i < 20; i++) { |
|
|
fps_stack.push(0); |
|
|
} |
|
|
} |
|
| 2111 |
window.requestAnimationFrame(_main); |
window.requestAnimationFrame(_main); |
| 2112 |
}; |
}; |
| 2113 |
return Game; |
return Game; |
| 2136 |
} |
} |
| 2137 |
if((_this.renderTick + _this.targetFps) <= t) { |
if((_this.renderTick + _this.targetFps) <= t) { |
| 2138 |
if(_this.fps) { |
if(_this.fps) { |
|
fps_stack.shift(); |
|
| 2139 |
fps_stack.push(t); |
fps_stack.push(t); |
| 2140 |
_this.fps.innerHTML = Math.round(60000 / (t - fps_stack[0])).toString(); |
if(fps_stack.length == 20) { |
| 2141 |
|
_this.fps.innerHTML = Math.round(20000 / (t - fps_stack[0])).toString(); |
| 2142 |
|
fps_stack = []; |
| 2143 |
|
} |
| 2144 |
} |
} |
| 2145 |
if(_this.enterFrame) { |
if(_this.enterFrame) { |
| 2146 |
_this.enterFrame.fire(); |
_this.enterFrame.fire(); |
| 2159 |
}; |
}; |
| 2160 |
this.tick = window.getTime(); |
this.tick = window.getTime(); |
| 2161 |
this.renderTick = this.tick - this.targetFps; |
this.renderTick = this.tick - this.targetFps; |
|
if(this.fps) { |
|
|
for(var i = 0; i < 60; i++) { |
|
|
fps_stack.push(0); |
|
|
} |
|
|
} |
|
| 2162 |
window.requestAnimationFrame(_main); |
window.requestAnimationFrame(_main); |
| 2163 |
}; |
}; |
| 2164 |
return FrameGame; |
return FrameGame; |
| 2558 |
Timeline.prototype.exec = function (func) { |
Timeline.prototype.exec = function (func) { |
| 2559 |
this.then(func); |
this.then(func); |
| 2560 |
}; |
}; |
| 2561 |
|
Timeline.prototype.frame = function (wait, frame) { |
| 2562 |
|
var s = this.entity; |
| 2563 |
|
if(frame == undefined) { |
| 2564 |
|
this.then(function () { |
| 2565 |
|
s.frame = wait; |
| 2566 |
|
}); |
| 2567 |
|
} else { |
| 2568 |
|
this.delay(wait).then(function () { |
| 2569 |
|
s.frame = frame; |
| 2570 |
|
}); |
| 2571 |
|
} |
| 2572 |
|
return this; |
| 2573 |
|
}; |
| 2574 |
|
Timeline.prototype.fno = function (wait, fno) { |
| 2575 |
|
var s = this.entity; |
| 2576 |
|
if(fno == undefined) { |
| 2577 |
|
this.then(function () { |
| 2578 |
|
s.fno = wait; |
| 2579 |
|
}); |
| 2580 |
|
} else { |
| 2581 |
|
this.delay(wait).then(function () { |
| 2582 |
|
s.fno = fno; |
| 2583 |
|
}); |
| 2584 |
|
} |
| 2585 |
|
return this; |
| 2586 |
|
}; |
| 2587 |
Timeline.prototype.cue = function (cue) { |
Timeline.prototype.cue = function (cue) { |
| 2588 |
var ptr = 0; |
var ptr = 0; |
| 2589 |
for(var frame in cue) { |
for(var frame in cue) { |
| 2971 |
} |
} |
| 2972 |
return xng || yng ? false : true; |
return xng || yng ? false : true; |
| 2973 |
} |
} |
| 2974 |
|
JGUtil.orderDrawY = function orderDrawY() { |
| 2975 |
|
var e = this.entities, len = e.length; |
| 2976 |
|
for(var i = 1; i < len; i++) { |
| 2977 |
|
for(var j = i; j > 0; j--) { |
| 2978 |
|
if(e[j].y >= e[j - 1].y) { |
| 2979 |
|
break; |
| 2980 |
|
} |
| 2981 |
|
var tmp = e[j]; |
| 2982 |
|
e[j] = e[j - 1]; |
| 2983 |
|
e[j - 1] = tmp; |
| 2984 |
|
} |
| 2985 |
|
} |
| 2986 |
|
} |
| 2987 |
return JGUtil; |
return JGUtil; |
| 2988 |
})(); |
})(); |