Although the idea of this Unity Clone is good.
The editor itself is too buggy. I just tried the newest 1.0.2 version.
I am just modifying the HelloWorld project with a little more image and label and added one very small function.
Every time a try to save the script, there is a chance the compiling (as indicated on bottom-left corner icon) will not end and I have to restart.
I can’t continue to work on it without restarting the editor every 5 minutes.
Here is the code i use:
My code is very simple and don’t have error.
It just that the compilation will sometimes hang.
cc.Class({
extends: cc.Component,
properties: {
label: { default: null, type: cc.Label },
txtHp: { default: null, type: cc.Label },
txtAp: { default: null, type: cc.Label },
imgHpFill: { default: null, type: cc.Sprite },
imgApFill: { default: null, type: cc.Sprite },
nickName: 'fantasyz'
},
// use this for initialization
onLoad: function () {
this.label.string = this.nickName;
localStorage.setItem("hpCurr", 5);
localStorage.setItem("hpMax", 10);
localStorage.setItem("apCurr", 4);
localStorage.setItem("apMax", 5);
this.updateValues();
},
// called every frame
update: function (dt) {
},
updateValues: function(){
var hpCurr = localStorage.getItem("hpCurr");
var hpMax = localStorage.getItem("hpMax");
this.txtHp.string = hpCurr + " / " + hpMax;
this.imgHpFill.fillRange = hpCurr / hpMax;
var apCurr = localStorage.getItem("apCurr");
var apMax = localStorage.getItem("apMax");
this.txtAp.string = apCurr + " / " + apMax;
this.imgApFill.fillRange = apCurr / apMax;
}
});