phaser-framework

Can I make a multiplayer Phaser game using Lance?

人盡茶涼 提交于 2019-12-05 16:20:09
How do I take an existing Phaser game and make it multiplayer? Can I use the Lance library for this purpose? Both libraries control their own game objects so I don't know how to use the two frameworks together in the same game. Disclaimer: I am one of the co-creators of Lance Unfortunately, Phaser's 2.* architecture makes it hard to pair with Lance to make Realtime Javascript Multiplayer games. The issue is that Phaser makes a lot of assumptions that don't hold for a multiplayer setting. For example, the rendering and game loop are tied together. The server, obviously doesn't need to render

Local server not reflecting updated files

别等时光非礼了梦想. 提交于 2019-12-05 16:17:57
问题 I'm fairly new at user local servers. I'm using the http-server which is a package from Node. I'm using it to host an HTML5 game using the Phaser library. I have image assets I'm using in the game, and I sometimes update these assets. When I do, the changes to the images aren't reflected in the game. I've tried restarting the server but that doesn't help. It usually takes some time for them to update, maybe about an hour. Any ideas what's going wrong? 回答1: The browser might be caching your

How can I scale the size of a sprite in Phaser/PixiJS without changing its position?

安稳与你 提交于 2019-12-05 00:23:06
I'm making a game in Phaser using some large images that I want to scale down in the actual game: create() { //Create the sprite group and scale it down to 30% this.pieces = this.add.group(undefined, "pieces", true); this.pieces.scale.x = 0.3; this.pieces.scale.y = 0.3; //Add the players to the middle of the stage and add them to the 'pieces' group var middle = new Phaser.Point( game.stage.width/2, game.stage.height/2); var player_two = this.add.sprite(middle.x - 50, middle.y, 'image1', undefined, this.pieces); var player_one = this.add.sprite(middle.x, middle.y-50, 'image2', undefined, this

HTML moving phaser into container div

大兔子大兔子 提交于 2019-12-04 18:35:42
问题 Currently making up a browser based game in phaser and trying to add it into the container div tag I've created however phaser seems to be pushing itself to below the container div . Two screenshots for comparison: http://gyazo.com/3cc9b9333cf89d7fc879bd2cdc741609 (This is the container div with my header div currently inside of it which is what I want my phaser game to be doing) http://gyazo.com/5a7cea7514a9e295355c87933c3d14ac (This is what my phaser game is currently doing above the footer

Pick random elements from an array without repeating

我与影子孤独终老i 提交于 2019-12-04 06:34:10
问题 I'm displaying random numbers on individual sprites and want to shuffle the individual container with the same no displaying on it. how to shuffle a set of sprites randomly without repeating the same color? My array is: var color = new Array(); color[0] = 'greenBox'; color[1] = 'blueBox'; color[2] = 'purpleBox'; color[3] = 'yellowBox'; color[4] = 'redBox'; color[5] = 'whiteBox'; color[6] = 'pinkBox'; 回答1: If you don't need the array later, you could do something like this: var color = [

Local server not reflecting updated files

瘦欲@ 提交于 2019-12-04 02:29:33
I'm fairly new at user local servers. I'm using the http-server which is a package from Node. I'm using it to host an HTML5 game using the Phaser library. I have image assets I'm using in the game, and I sometimes update these assets. When I do, the changes to the images aren't reflected in the game. I've tried restarting the server but that doesn't help. It usually takes some time for them to update, maybe about an hour. Any ideas what's going wrong? The browser might be caching your code and/or assets. In Chrome, with dev tools open (Right click -> Inspect element) you can right click on the

How can I make an infinite side scrolling background in Phaserjs?

↘锁芯ラ 提交于 2019-12-03 18:57:37
问题 I'm using phaser.js to make a game and I cannot find any tutorials on how to make the background scroll infinitely. I'd like the background to tile/repeat sideways, and infinitely as the character moves right. I am currently using a camera and having the camera follow the character. Here's my idea about how to do this: Check the position of the camera constantly in update() , and then move it to the beginning of gameplay (the very left) along with the character at that time. I think that this

Developing game app using Phaser.js and Ionic (slow/shaky rendering)

对着背影说爱祢 提交于 2019-12-03 06:07:56
问题 Just to let you know (in case someone wants to develop). I developed a game app using Phaser.js. I sort of put the code into Ionic blank starter app. So basically the view is rendered using Ionic app and then Phaser picks up the div by the id and displays the game. Problem: Its a simple flappy bird clone. Its working fine but the blocks movement is a bit shaky (as though they were shivering). Since Phaser uses WebGL, could it be the reason for slow rendering or is it due to the ionic

Pick random elements from an array without repeating

放肆的年华 提交于 2019-12-02 10:24:35
I'm displaying random numbers on individual sprites and want to shuffle the individual container with the same no displaying on it. how to shuffle a set of sprites randomly without repeating the same color? My array is: var color = new Array(); color[0] = 'greenBox'; color[1] = 'blueBox'; color[2] = 'purpleBox'; color[3] = 'yellowBox'; color[4] = 'redBox'; color[5] = 'whiteBox'; color[6] = 'pinkBox'; If you don't need the array later, you could do something like this: var color = [ "greenBox", "blueBox", ... ]; while (color.length != 0) { var index = Math.floor(Math.random()*color.length); var

How to create a Phaser button in Facebook instant games for a mobile device

蓝咒 提交于 2019-12-02 07:27:29
问题 I am trying to create a button with Phaser 2 CE on a mobile device but it doesn't fires, even if it works fine on desktop, the entiere code will be on my github repository but for the moment i can just display an image like in the code bellow var game = new Phaser.Game(640, 480, Phaser.AUTO, 'game', { preload: preload, create: create, update: update }); function preload () { game.load.image('logo', 'assets/phaser2.png'); game.load.image("upArrow", "assets/up.png"); } function create () { //