Permalink
Browse files

Fix Event.nbSequenceX, Event.nbSequenceY, Rpg.changeScreenColorTone()…

… and Scene
  • Loading branch information...
Samarium
Samarium committed Sep 15, 2011
1 parent d4e5d47 commit 66f1ffb82464fbe2678c59d4bfc08f06e12d284e
Showing with 26 additions and 15 deletions.
  1. +9 −7 core/event.js
  2. +11 −3 core/rpg.js
  3. +2 −2 core/scene.js
  4. +4 −3 rpg-beta.min.js
View
@@ -403,9 +403,9 @@ var p = {
if (self.regX === undefined) {
self.regX = self.width - self.rpg.tile_w;
}
- var up = self.nbSequenceY * 3 + self.graphic_pattern;
- var right = self.nbSequenceX * 2 + self.graphic_pattern;
- var left = self.nbSequenceX + self.graphic_pattern;
+ var up = self.nbSequenceX * (self.nbSequenceY-1) + self.graphic_pattern; // last line
+ var right = self.nbSequenceX * (self.nbSequenceY-2 < 0 ? 0 : self.nbSequenceY-2) + self.graphic_pattern;
+ var left = self.nbSequenceX * (self.nbSequenceY-3 < 0 ? 0 : self.nbSequenceY-3) + self.graphic_pattern;
var bottom = 0 + self.graphic_pattern;
var nb = self.nbSequenceX-1;
@@ -425,8 +425,6 @@ var p = {
bmpSeq.gotoAndStop(self.direction);
bmpSeq.waitFrame = Math.round(self.rpg.fps / self.speedAnimation);
-
-
self.sprite.regY = self.regY;
self.sprite.regX = self.regX;
@@ -675,8 +673,10 @@ var p = {
if (this.tickPlayer) {
this.tickPlayer();
+
}
+
if (this.actionBattle) {
var detect = this.detectionPlayer(this.actionBattle.area);
if (detect && !this.detection) {
@@ -811,10 +811,12 @@ var p = {
}
function testContact(x, y, obj, equal) {
- if (equal && x == obj.real_x && y == obj.real_y) {
+ var ex = obj.real_x;
+ var ey = obj.real_y;
+ if (equal && x == ex && y == ey) {
return true;
}
- return x > obj.real_x && x < obj.real_x + self.rpg.tile_w && y > obj.real_y && y < obj.real_y + self.rpg.tile_h;
+ return x > ex && x < ex + w && y > ey && y < ey + h;
}
View
@@ -1124,6 +1124,9 @@ Rpg.prototype = {
if (this.player) {
this.player.refreshBitmap();
}
+ if (this.tone) {
+ this.tone = undefined;
+ }
this.stage.removeChild(this.containerMap);
}
},
@@ -2642,9 +2645,14 @@ Rpg.prototype = {
this.containerMap.addChild(this.tone);
if (!exist_tone) {
this.tone.alpha = 0;
- new Effect(this.tone).fadeStartTo(speed, 0, opacity, function() {
- if (callback) callback();
- });
+ if (speed > 0) {
+ new Effect(this.tone).fadeStartTo(speed, 0, opacity, function() {
+ if (callback) callback();
+ });
+ }
+ else {
+ this.tone.alpha = opacity;
+ }
}
this.call('changeScreenColorTone', {color: color, speed: speed, composite: composite, opacity: opacity});
},
View
@@ -153,7 +153,7 @@ Scene.prototype = {
this.rpg.mapFreeze(false);
switch(type) {
case 'movement':
- this.rpg.player.movementPause(true);
+ if (this.rpg.player) this.rpg.player.movementPause(true);
break;
case 'all':
this.rpg.mapFreeze(true);
@@ -226,7 +226,7 @@ Scene.prototype = {
* @return {Window} The object Window created
*/
addWindow: function(_window) {
- var win = new _window(rpg, this.content);
+ var win = new _window(this.rpg, this.content);
win.scene = this;
this.windows.push(win);
return win;
View

Large diffs are not rendered by default.

Oops, something went wrong.

0 comments on commit 66f1ffb

Please sign in to comment.