Search the Community
Showing results for tags 'bag'.
-
Hi! Could you help me? The problem: There is a class (singleton), where I load assets by loader .add("assets/slotParams.json") .load(this.setup); In this callback function “setup” I change boolean variable from false to true, but when I want to get it from other class, there are no changes. How can it be? Of course graphics show good. The example of code: (class with graphics and changed variable "lp"): class Graph { private bit:Bitte; private lp:boolean; //variable that should be change get loadedProcess():boolean { return this.lp; } set loadedProcess(res:boolean) { this.lp = res; } //stage & engine parts public Container; public autoDetectRenderer; public loader; public resources; public TextureCache; public Texture; public Sprite; public Text; public Graphics; public stage:PIXI.Container; private static instance:Graph; private static ok2Create:Boolean=false; public static getInstance():Graph { if(!this.ok2Create) { this.instance = new Graph(); this.ok2Create=true; } return this.instance; } private constructor() { this.loadedProcess=false; Container = PIXI.Container; autoDetectRenderer = PIXI.autoDetectRenderer; loader = PIXI.loader; resources = PIXI.loader.resources; TextureCache = PIXI.utils.TextureCache; Texture = PIXI.Texture; Sprite = PIXI.Sprite; Text = PIXI.Text; Graphics = PIXI.Graphics; stage = new Container(); renderer = autoDetectRenderer(1140, 768); renderer.backgroundColor = 0xFFFFFF; document.body.appendChild(renderer.view); } public loading():void { loader .add("assets/slotParams.json") .load(this.setup); } private setup():void //callback function { this.loadedProcess=true; //not worked when asked this var from another class } } Class with asking for this variable (in alert I take "false" each time); class AssetsLoader { private graph:Graph; private timme:number; constructor() { this.graph=Graph.getInstance(); this.timme=1; } public goLoad():void { if (this.timme==1) { this.timme=2; this.graph.loading(); } if (this.timme==2) { alert("assets loader this.graph.loadedProcess="+this.graph.loadedProcess); if (this.graph.loadedProcess) { alert("win"); this.timme=3; } } if (this.timme==3) { } } function goLoad() loop. Thank you in any case.
-
Hi friends, i'm new with Phaser and i did a simple game to study and learn it. The idea isn't original and the game are in development, remember, i did it only to study and learn how to use and program Phaser. You can play it here, use space to jump, its simple. Debbug mode. Normal mode. One las thing, hope you guys like it and don't hate me because my english are so bad! Any news i'll update this post, see you guys.
- 4 replies
-
- development
- new
- (and 8 more)