• Content Count

  • Joined

  • Last visited

About VeeShort

  • Rank
  • Birthday 05/16/1993

Profile Information

  • Gender
  1. I don't get how to do that Can you explain it with PIXI code?
  2. Curently, I am making a roguelike game and have a little problem with drawing(updating) the level on the screen. The map is two-dimentional array which generates at the begining of the script ( ). If the player hits an arrow button then movePlayer() function is called. Inside that function we draw the map (1 frame per player's move). That's where the trouble begins. It is starting to drop frames very badly when all the tiles are drawn together (less tiles - more drawing speed, but not enough to play the game). Here is some code: var mapSize = { // in tiles (one is 16x16 px) width: 44, height: 62};//...generating random arrayvar stage, renderer;start();var wallTexture = PIXI.Texture.fromImage("images/level/wall.png");var container = new PIXI.DisplayObjectContainer();function start(){ renderer = PIXI.autoDetectRenderer(992, 704, document.getElementById('canvas')); stage = new PIXI.Stage(); this.document.onkeydown = movePlayer; } function movePlayer(){ //... <-- basic movement here requestAnimFrame(drawMap); renderer.render(stage);} function drawMap(){ for (var i = 0; i < mapSize.width; i++){ for (var j = 0; j < mapSize.height; j++){ if(map[i][j] == '20'){ //'20' is a wall tile var wall = new PIXI.Sprite(wallTexture); wall.position.x = i * tile; wall.position.y = j * tile; container.addChild(wall); } //... drawing other tiles here } } stage.addChild(container); }Thank you, for your help and time.