ElProxador Posted November 1, 2015 Share Posted November 1, 2015 I'm trying to create a little game using easelJs library. I started to write the function for create the map, and this is my little code:<!DOCTYPE html> <html> <head> <title>My Game</title> <script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script> <script src="http://code.createjs.com/easeljs-0.7.0.min.js" type="text/javascript"></script> <script> var canvas; var map; function Map(canvas, obstacleImage){ var spriteSheet = new createjs.SpriteSheet({ images: [obstacleImage] }); var obstacles = []; this.width = canvas.width; this.height = canvas.height; this.stage = new createjs.Stage(canvas); for(var i = 0; i < map1.length; i++){ for(var j = 0; j < map1[i].length; j++){ if(map1[i][j] == 1){ var obstacle = new createjs.BitmapAnimation(spriteSheet); obstacle.x = j * spriteW; obstacle.y = i * spriteH; this.stage.addChild(obstacle); obstacles.push(obstacle); } } } } function gameStart(){ canvas = document.querySelectorAll("canvas")[0]; map = new Map(canvas, "Sprites/rock.png"); createjs.Ticker.addEventListener("tick", drawHandler); } function drawHandler(){ map.stage.update(); } </script> </head> <body onload="gameStart()"> <canvas height="624px" width="1024px" id="game_canvas"> </canvas> </body> </html>So i execute my html code on my browser and the result is "Uncaught RangeError: Maximum call stack size exceeded" when the Stage.update() function is called. Could the problem be i add too many children to the Stage? If so, how can i add all the obstacles to my map without receive any error?? Quote Link to comment Share on other sites More sharing options...
sandudhate Posted November 2, 2015 Share Posted November 2, 2015 Hi ElProxador, Please move the thread into special Easeljs/createjs topics. We can continue discussion there. And remember to delete this thread. Regards,Sankarshan Quote Link to comment Share on other sites More sharing options...
sandudhate Posted November 3, 2015 Share Posted November 3, 2015 Sorry... There's no special group of topics for createjs. I'm getting error : map1 is not defined in my DroidScript IDE. I haven't had time to go further but I'll try to troubleshoot when I get time. Regards,Sankarshan Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.