Search the Community

Showing results for tags 'phaser framework'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • HTML5 Game Coding
    • News
    • Game Showcase
    • Facebook Instant Games
    • Web Gaming Platform
    • Coding and Game Design
  • Frameworks
    • Phaser 3
    • Phaser 2
    • Pixi.js
    • Babylon.js
    • Panda 2
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Twitter


Skype


Location


Interests

Found 7 results

  1. Hello, I am working on a game using tilemap and phaser framework. I want select the multiple coordinates on tilemap using phaser (cursor) and then can be able to store into an array. Is this possible using phaser? suggest me some solution for this.
  2. Hello devs, I am working on one game where I have created function to save onclicked coordinates into an array. function update() { marker.x = layer.getTileX(game.input.activePointer.pageX ) * 15; marker.y = layer.getTileY(game.input.activePointer.pageY ) * 15; var arrayData = []; if (game.input.mousePointer.isDown && map.getTile(layer.getTileX(marker.x), layer.getTileY(marker.y)) != currentTile) { arrayData.push(layer.getTileX(marker.x),layer.getTileY(marker.y)); arrayData.toString(); document.getElementById('test').innerHTML = " Data: " + arrayData; console.log("Data:"+arrayData); } In this function I have declared array var arrayData = []; inside update() function and the output is, it showing only showing on set of coordinates and second click that value is updating . So, coordinate values are added into array but only single pair and on every click that pair value is updating. Secondly, If I am declaring array outside the update function ,the result is totally different. On-clicked, the value are coming in high quantity. If I am clicking on (1,3) coordinates then the array result is (1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3) and on second click on the coordinates (4,6) the array result is like (1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,4,6,4,6,4,6,4,6,4,6,4,6,4,6,4,6,4,6,4,6,4,6,4,6) Please suggest me some solution , so that I can add these coordinate pairs properly into an array. Thank you
  3. odelia

    connect the dots

    I'm trying to do a Connect the dots game. what is the best way to do this? I created points and a line sprite between them and when you click on the first point and over the line you draw on a bitmap data. it's not the best solutions.. That's the main code: var connecttheDots = connecttheDots || {}; connecttheDots.GameController = function(state, gameData){ this.state = state; this.game = this.state.game; this.gameData = gameData; this.TweenAnimation = new connecttheDots.TweenAnimation(); this.SoundMannager = new connecttheDots.SoundMannager(this.game); this.DataUtils = new connecttheDots.DataUtils(); this.activeDrag = false; this.stroke = 1; this.dotGroup = this.game.add.group(); this.lineGroup = this.game.add.group(); this.canvasGroup = this.game.add.group(); this.init(); } connecttheDots.GameController.prototype = Object.create(Phaser.Sprite.prototype); connecttheDots.GameController.prototype.constructor = connecttheDots.GameController; connecttheDots.GameController.prototype.init = function(){ this.pointArr = [ /*{x: this.game.world.centerX - (this.game.width * .15), y: this.game.world.centerY - (this.game.height * .2), angle:-90, type: "start"}, {x: this.game.world.centerX + (this.game.width * .15), y: this.game.world.centerY - (this.game.height * .2), angle:0, type: "middle"}, {x: this.game.world.centerX + (this.game.width * .15), y: this.game.world.centerY + (this.game.height * .2), type: "end"} */ {x: this.game.world.centerX - (this.game.width * .15), y: this.game.world.centerY - (this.game.height * .2), angle:-49, type: "start"}, {x: this.game.world.centerX + (this.game.width * .15), y: this.game.world.centerY + (this.game.height * .2), type: "end"}, {x: this.game.world.centerX + (this.game.width * .12), y: this.game.world.centerY - (this.game.height * .2), angle:22, type: "start"}, {x: this.game.world.centerX + (this.game.width * .05), y: this.game.world.centerY + (this.game.height * .06), type: "end"}, {x: this.game.world.centerX - (this.game.width * .07), y: this.game.world.centerY - (this.game.height * .1), angle:22, type: "start"}, {x: this.game.world.centerX - (this.game.width * .15), y: this.game.world.centerY + (this.game.height * .2), type: "end"} ] // dots var i, objData, lineData; for (i = 0; i < this.pointArr.length; i++) { // line if(this.pointArr[i].type != "end") { lineData = { id: i, x1: this.pointArr[i].x, y1: this.pointArr[i].y, x2: this.pointArr[i+1].x, y2: this.pointArr[i+1].y, width: this.DataUtils.getDistanceFrom2Points(this.pointArr[i].x, this.pointArr[i].y, this.pointArr[i+1].x, this.pointArr[i+1].y), angle: this.pointArr[i].angle } this["line"+i] = new connecttheDots.line(this.state, lineData); //this.lineGroup.add(this["line"+i]); } // dot objData = { id: i, x: this.pointArr[i].x, y: this.pointArr[i].y, active: false, type: this.pointArr[i].type } if(i < this.pointArr.length-1) { objData.nextPoint = i+1; } this["dot"+i] = new connecttheDots.dot(this.state, this.pointArr[i].x, this.pointArr[i].y, objData); //this.dotGroup.add(this["dot"+i]); } this.dot0.glow(true); this.dot0.active(true); // canvas this.canvasBTM = this.game.add.bitmapData(this.game.width, this.game.height); //this.canvasBTM.context.fillStyle ="#ffffff"; //this.canvasBTM.context.fillRect(0,0,this.game.width, this.game.height); this.canvasBTM.x = 0; this.canvasBTM.y = 0; this.canvasBTM.addToWorld(this.canvasBTM.x, this.canvasBTM.y); this.canvasBTM.smoothed = false; //this.canvasGroup.add(this.canvasBTM); this.game.input.addMoveCallback(this.draw, this); this.game.input.onUp.add(this.stopDrag, this); } connecttheDots.GameController.prototype.onUpdate = function(){ if(this.curLine){ if(this.curLine.item.input.pointerOver()){ this.activeDrag = true; } else { this.activeDrag = false; } if(this.destDot.item.input.pointerOver()){ console.log("endPath"); this.curLine = null; this.activeDrag = false; if(this.destDot.item.data.nextPoint) { this["dot"+Number(this.destDot.item.data.id+1)].glow(true); this["dot"+Number(this.destDot.item.data.id+1)].active(true); } else { console.log("finish!"); } } } } connecttheDots.GameController.prototype.draw = function(pointer, x, y){ if (pointer.isDown && this.activeDrag){ this.canvasBTM.draw("circle", x, y); } } connecttheDots.GameController.prototype.stopDrag = function(pointer){ this.curLine = null; } connecttheDots.GameController.prototype.clickDot = function(btn){ console.log("clickDot", btn.data); this["dot"+btn.data.id].glow(false); if(btn.data.nextPoint) { this.destDot = this["dot"+Number(btn.data.id+1)]; this.destDot.glow(true); this.destDot.active(true); } this.curDot = btn.parent; this.curLine = this["line"+btn.data.id]; console.log(this.curLine); } Hope you can help me. Thank you.
  4. Hi, I have a game with audio and for some reason it still playing when out of focus I used the same code from other game that don't behave like this.. why is that? this.load.audio('msx_main', ['assets/audio/main.ogg', 'assets/audio/main.mp3']); var msx_main = this.game.add.audio('msx_main'); msx_main.play("",0,0.2,true); It does stop on IOS but not on desktop or Android HELP!!! Thank you
  5. I'm uploading an Image with JS. When I send that data to the phaser code I sometimes don't see it. It does receive the data but don't show it... function(BitmapData) { var data = new Image(); data.src = BitmapData; this.game.cache.addImage("image-data", BitmapData, data); this.userPic = this.game.add.sprite(10, 10, 'image-data'); console.log("loadUploadedImg",BitmapData,this.userPic); } Even when I try to load the same image, so it's not the image it self... Does anyone know what I'm doing wrong?... Thank you
  6. I have a sprite with a sprite sheet and it works find, but when i change the texture of the sprite to a different sprite sheet it pause the whole game for a second... why is that??? this.item = this.game.add.sprite(0,0,"mainCharacter"); this.item.anchor.set(0.5); function foundItem(){ this.item.loadTexture("mainCharacterFound", 0); }
  7. I have a class that extends from sprite. I want to add it to another sprite obj = new ItemBtn(this.state, xloc, yloc, item);this.menuContainer.addChild(this.game.make.sprite(xloc, yloc, obj));Can't I create a child without the image key? Can't I add a class to the sprite? Thank you.