Skip to content

Commit bd425c1

Browse files
committed
2.0.0
1 parent 8bb0669 commit bd425c1

9 files changed

+72
-36
lines changed

core/game/Game_Character.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1728,7 +1728,8 @@ State #3 = 50%
17281728
@return {Object}
17291729
*/
17301730
getItem: function(type, id) {
1731-
return this.items[type][id] ? this.items[type][id] : false;
1731+
var it = this.getItems(type);
1732+
return it[id] ? this.items[type][id] : false;
17321733
},
17331734

17341735
/**
@@ -1739,6 +1740,9 @@ State #3 = 50%
17391740
*/
17401741
getItems: function(type) {
17411742
if (type) {
1743+
if (!this.items[type]) {
1744+
this.items[type] = {};
1745+
}
17421746
return this.items[type];
17431747
}
17441748
return this.items;

core/game/Game_Map.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -288,10 +288,10 @@ var _class = {
288288
if (!e || (!e.exist || id == entity.id)) continue;
289289

290290
state = entity.hit(e);
291-
291+
292292
if (state.over >= 1) {
293293
if (!testLineTile(state.result.coincident)) {
294-
e._hit = true;
294+
if (entity.id == 0) e._hit = true;
295295
entity.restorePosition();
296296

297297
if (state.over == 1) {
@@ -310,11 +310,11 @@ var _class = {
310310

311311
}
312312
else {
313-
e._hit = false;
313+
if (entity.id == 0) e._hit = false;
314314
}
315315
}
316316
else {
317-
e._hit = false;
317+
if (entity.id == 0) e._hit = false;
318318
}
319319

320320
}

core/game/Interpreter.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -856,6 +856,7 @@ if (typeof exports != "undefined") {
856856
// CHANGE_GRAPHIC: {'actor': 'all','graphic': '5'}
857857
cmdChangeGraphic: function(params) {
858858
global.game_player.graphic = params.graphic;
859+
global.game_player.graphic_params = params['graphic-params']
859860
global.game_map.refreshPlayer();
860861
this.nextCommand();
861862
},
@@ -1110,8 +1111,8 @@ if (typeof exports != "undefined") {
11101111

11111112

11121113
var _var = {
1113-
'switch[%1]' : 'global.game_switches.get(%1)',
11141114
'self_switch[%1]' : 'global.game_selfswitches.get(this_event.map_id, this_event.id, "%1")',
1115+
'switch[%1]' : 'global.game_switches.get(%1)',
11151116
'variable[%1]' : 'global.game_variables.get(%1)',
11161117
'actor_in_party[%1]' : 'global.game_actors.getById(%1)',
11171118
'actor_name[%1]' : 'actor(%1, "name", "isParameter")',

core/scene/Scene_Map.js

Lines changed: 37 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ RPGJS_Canvas.Scene.New({
6161
var images = [], sounds = [], load_i = 0, self = this;
6262
if (data.graphics.tileset) images.push({tileset: RPGJS.Path.get("tilesets", data.graphics.tileset)});
6363
if ( data.player.graphic) images.push(RPGJS.Path.get("characters", data.player.graphic, true));
64-
// images.push({window: "../materials/Graphics/Windowskins/window.png"});
64+
//images.push({window: "../materials/Graphics/Windowskins/window.png"});
6565
if (global.materials.windowskins) {
6666
var win_id = 1;
6767
for (var id in global.materials.windowskins) {
@@ -111,21 +111,48 @@ RPGJS_Canvas.Scene.New({
111111

112112
sounds.concat(RPGJS.Plugin.call("Sprite", "mapLoadSounds", [sounds, this]));
113113

114-
function finish() {
114+
115+
116+
var pourcent = 0,
117+
_canvas = this.getCanvas(),
118+
bar_full = this.createElement(300, 20),
119+
bar_empty = this.createElement(300, 20),
120+
text = this.createElement(),
121+
width_init = bar_full.width;
122+
123+
text.font = '15px Arial';
124+
text.fillStyle = 'white';
125+
126+
127+
bar_empty.x = _canvas.width / 2 - bar_empty.width / 2;
128+
bar_empty.y = _canvas.height / 2 - bar_empty.height / 2;
129+
130+
bar_empty.strokeStyle = "white";
131+
// bar_empty.strokeRect();
132+
133+
bar_empty.append(bar_full, text);
134+
135+
this.stage.append(bar_empty);
136+
137+
function progress() {
138+
var total = images.length + sounds.length;
139+
pourcent += Math.round(100 / total);
140+
bar_full.width = width_init * (pourcent / 100);
141+
// bar_full.fillRect("#428bca");
142+
text.fillText("Loading " + pourcent + "%", 100, 15);
143+
}
144+
145+
function finish() {
115146
if (load_i){
147+
self.stage.empty();
116148
self.tilesetLoad(data);
117149
if (callback) callback();
118150
}
119151
load_i++;
120152
}
121153

122-
RPGJS_Canvas.Materials.load("images", images, function(img) {
123-
// -- Empty
124-
}, finish);
125-
126-
RPGJS_Canvas.Materials.load("sounds", sounds, function(snd) {
127-
// -- Empty
128-
}, finish);
154+
RPGJS_Canvas.Materials.load("images", images, progress, finish);
155+
RPGJS_Canvas.Materials.load("sounds", sounds, progress, finish);
129156

130157

131158
},
@@ -215,6 +242,7 @@ RPGJS_Canvas.Scene.New({
215242
render: function(stage) {
216243

217244
if (!this.spriteset) {
245+
stage.refresh();
218246
return;
219247
}
220248

core/scene/Scene_Window.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,16 @@ RPGJS_Canvas.Scene.New({
7272
array_el.push(el);
7373
box.getContent().append(el);
7474
}
75+
7576

7677
var cursor = this.createElement();
7778
cursor.fillStyle = "#7778AA";
7879
cursor.fillRect(-10, -10, width-30, 30);
7980
cursor.opacity = .5;
8081

81-
box.cursor.init(cursor, array_el);
82+
box.cursor.init(cursor, array_el, {
83+
enter: [Input.Enter, Input.Space]
84+
});
8285

8386
box.cursor.select(function(el) {
8487
self._onEnterPressChoice(el.attr('index'));

core/sprite/Sprite_Character.js

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ Class.create("Sprite_Character", {
9292
self.width = img.width / self.nbSequenceX;
9393
self.height = img.height / self.nbSequenceY;
9494

95-
//self.entity.el.drawImage("characters_" + self.graphic, 0, 0, self.width, self.height, -self.regX, -self.regY, self.width, self.height);
95+
self.entity.el.drawImage("characters_" + self.graphic, 0, 0, self.width, self.height, -self.regX, -self.regY, self.width, self.height);
9696
self.setAnimation();
9797
self.setSpritesheet();
9898
self.stop();
@@ -101,12 +101,7 @@ Class.create("Sprite_Character", {
101101
}
102102
}
103103

104-
if (this.id != 0) { // if not player
105-
RPGJS.Path.loadMaterial("characters", this.graphic, load);
106-
}
107-
else {
108-
load();
109-
}
104+
RPGJS.Path.loadMaterial("characters", this.graphic, load);
110105
}
111106
else {
112107
this.stop();

core/sprite/Spriteset_Map.js

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ Class.create("Spriteset_Map", {
433433
el.width = img.width;
434434
el.height = img.height;
435435
if (params.origin == "center") {
436-
el.setPositionOrigin("middle");
436+
el.setOriginPoint("middle");
437437
}
438438
el.scaleX = params.zoom_x / 100;
439439
el.scaleY = params.zoom_y / 100;
@@ -464,7 +464,7 @@ Class.create("Spriteset_Map", {
464464
var el = this.pictures[id];
465465
if (!el) return false;
466466
if (params.origin == "center") {
467-
el.setPositionOrigin("middle");
467+
el.setOriginPoint("middle");
468468
}
469469
var t = RPGJS_Canvas.Timeline.New(el);
470470

@@ -473,12 +473,8 @@ Class.create("Spriteset_Map", {
473473
params.zoom_y = params.zoom_y || 100;
474474

475475
t.to({
476-
x: params.x,
477-
y: params.y,
478-
opacity: params.opacity / 255,
479-
scaleX: params.zoom_x / 100,
480-
scaleY: params.zoom_y / 100
481-
}, time).call(finish);
476+
x: +params.x
477+
}, +time).call(finish);
482478
},
483479

484480
/**

readme.md

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# RPG JS v2 Beta #
1+
# RPG JS v2 #
22

3-
> RPG JS use [CanvasEngine](http://canvasengine.net) 1.3.1 dev. Think integrate CanvasEngine and all extensions before RPG JS
3+
> RPG JS use [CanvasEngine](http://canvasengine.net) 1.3.1. Think integrate CanvasEngine and all extensions before RPG JS
44
55
> Uses http://localhost for to test
66
@@ -22,10 +22,19 @@ The core of RPG JS is composed of three parts:
2222

2323
## Changelog ##
2424

25+
#### v2.0.0
26+
27+
* Fix change the appearance of the hero
28+
* Fix execution of an event when the hero is stopped
29+
* Spacebar usable in the selection
30+
* Fix the moving pictures and rotations
31+
* Fix test of a item possessed in the condition command if item does not exist
32+
* Fix test of self switch
33+
2534
#### Beta 1.4.3
2635

2736
* Works on IE
28-
* Fix refresh an event after choice*
37+
* Fix refresh an event after choice
2938
* Fix collision when the height of the Sprite is different from 48px
3039

3140
#### Beta 1.4.2

rpgjs-2.0.0.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)