Search the Community

Showing results for tags 'phaser'.



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
    • 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 3,316 results

  1. Asterius

    World map interactions

    Hello! I am very new to game development, using Phaser. I try to create a Risk-like game. In that game, I have a sprite representing the world, with delimited territories. My question is how should I code interactions with the map? Among others: - how to detect in which territory the user click? I suppose I have to create the territories coordinates somewhere. How to do that? - how color such territory depending of the owner? ... Can everyone give me hints, tutorial links or examples? Thanks a lot!
  2. joe2movies

    Menu state audio issue

    I have an issue with the audio when first start the game in the menu state. The audio doesn't play. But after I start playing the game from another state and return to the menu state it works fine. When i test in android phone it doesn't work properly, but when I test emulator it seems to work fine. I use phonegap to build the app. Below is the code to my menu state var menuAudio = null; var menuState = { create: function () { this.menuAudio = game.add.audio('cheering'); this.menuAudio.loop = false; this.menuAudio.volume = 1; this.menuAudio.play(); var favButton = this.game.add.button(370,780,"favFolder",this.favMovies,this); favButton.anchor.setTo(0.5,0.5); }, favMovies: function(){ if (this.menuAudio != null) { this.menuAudio.destroy(); } game.state.start("difficulty"); } }
  3. I had another thread where I went back and forth with @samme about pauseupdate not working. After copying his/her code from CodePen into my file, I discovered that running his/her code from within Brackets also resulted in the pause update not working (not getting pointer data). I then ran the code from my file directly in Chrome and Firefox and it didn't work there either (the code runs, no errors thrown, etc. but the pointerdata isn't updated on pause). What am I missing? How can I get pointerdata on pause?
  4. I have created a sample map using tiled software. Then tried to load the same u on webpage using phaser.js. But I am not getting the proper result. Is there any mistake in my code or something wrong with library. <!DOCTYPE html> <html> <head> <title>Basic Platformer game</title> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width"> <script src="js/phaser.min.js"></script> <script src="js/phaser.js"></script> </head> <body> <div id="phaser-game"></div> <script type="text/javascript"> (function() { var game = new Phaser.Game( 800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update, render: render }); function preload() { game.load.tilemap('map', 'background.json', null, Phaser.Tilemap.TILED_JSON); game.load.image('tile2', 'floor2.png'); game.load.image('player','bot2.png'); } var map; var layer; var marker; var player; var currentTile; var cursors; var curser; function create() { game.stage.backgroundColor = '#787878'; game.physics.startSystem(Phaser.Physics.P2JS); map = game.add.tilemap('map'); map.addTilesetImage('floor2','tile2'); currentTile = map.getTile(0, 0); layer = map.createLayer('Tile Layer 1'); player = game.add.sprite(20, 20, 'player'); game.physics.p2.enable(player); player.body.fixedRotation = true; layer.resizeWorld(); marker = game.add.graphics(); marker.lineStyle(2, 0x000000, 1); marker.drawRect(0, 0, 20, 20); cursors = game.input.keyboard.createCursorKeys(); game.camera.follow(player, Phaser.Camera.FOLLOW_LOCKON, 0.1, 0.1); game.physics.arcade.enable(player); </script> </body> </html>
  5. I'm building a simulation game using Phaser 3 and I need help from a fellow programmer. You will not make a full game but help me with some parts of the game I'm coding. Preferably you have some math or game algorithm skills. Contact me on private message for more details if interested.
  6. fallenshadow

    Getting a 2D array for Easystar?

    Hi all, I have been trying to follow this tutorial here: https://developer.tizen.org/community/tip-tech/using-easystar.js-implement-pathfinding-tizen-game-projects However, it mentions about a 2D array and right away I'm lost. I have a game in Phaser Isometric but I don't use a 2D array at all. I just have a tile and a loop to add to a tile group. spawnTiles: function () { var tile; for (var xx = 0; xx < 400; xx += 38) { for (var yy = 0; yy < 400; yy += 38) { // Create a tile using the new game.add.isoSprite factory method at the specified position. // The last parameter is the group you want to add it to (just like game.add.sprite) tile = game.add.isoSprite(xx, yy, 0, 'tile', 0, tileGroup); tile.anchor.set(0.5, 0); } } } How do I get a 2D array for Easystar to use?
  7. Hi. I'm new to phaser and to this forum. I have a problem that I would like to ask for some help with. I'm trying to import a level from a JSON file exported from a 3rd party level editor that is not meant to be used with Phaser or any other 3rd party engine. It is just me trying to use the JSON coming from the editor to load the level in Phaser and I have some problem with rotation and scale of the sprites. The level editor rotate the sprites around a center point and scale the sprites from the origin point. In Phaser, I set the position of the anchor point to match the position of the origin point and set the position of the pivot point to match the position of the center point for each sprite and it works for getting the position and the rotation of the sprites but when I scale a sprite in the editor, it does not appear right in Phaser. This is how it looks like in the editor: And this is how it looks like in Phaser after import: Notice the distance between the two sprites. It does not match and I think it is because in the editor the sprite is scaled from the top left corner of the sprite (origin/anchor point) while in phaser it is scaled from the center of the sprite (pivot point). At least If I don't change the position of the pivot point, the scale and position works but then rotation is off because in the editor the sprite is rotated around the center point which is in the middle by default. In any case I can't find a solution to this. I can't get the scale match without messing up the rotation or the rotation without messing up the scale because of the two points. When I check the values, everything seems to match. Position, rotation, scale but it still does not look the same in Phaser. I hope someone did have the same problem with rotating and scaling sprites in Phaser and already figured a solution. What I would like to know specifically, is there any way to rotate a sprite around a middle point without changing the position of the anchor and pivot point or is there any way to scale a sprite from the anchor point instead of the pivot point? Because the problem seems to be in Phaser the sprites are scaled and rotated around the pivot point but in this case I need to scale it and rotate it in two separated points to get the same result as in the level editor. I would appreciate any help. Thank you.
  8. Hey, hi. I'm trying to develop a game similar to Mini Militia using eureca.io. I took help from a tanks multiplayer tutorial (http://ezelia.com/2014/tutorial-creating-basic-multiplayer-game-phaser-eureca-io) for the backend. However, I wanted to add the game room functionality in the game and hence made some changes accordingly. Also, I added a tilemap and gravity to the sprites, but the problem is, the player starts neglecting the collision between the ledges and the player and starts falling down till it collides with the world bounds in one window when no input is given. But it detects a collision in the active window. i.e. the window where the player was created. I hope I could explain the issue properly. Could someone look into the code and check what is wrong? And sorry if I am not following standard developer norms. I'm kinda new to posting threads on forums. Thanks in advance! server.js tanks.js index.html
  9. Will anyone be willing to teach me how to create Random generation of sprites? I am making a game called Egg Drop which is basically an "apple catch" type game where a basket at the bottom catches infinite spawning eggs from the top until you catch a bee instead of the egg (Bees are the enemies of the game) which causes the game to end. I need to know how to effectively create a random x for the egg spawning and then put this function in a loop but I haven't been able to do it correctly (One time I got it, but then it wouldn't be able to be set for collision, breaking the game) Also if there is any tips for phaser someone should know, feel free to teach me about them. Thank you guys so much for any help given, Nacho
  10. I've been battling this problem for the past 24h and figured it was worth asking for help. I've got a class called Character that extends Phaser.Sprite and is used in a few States (Character Select->Play) for my game. When I instantiate new Characters in the Select class or Play class, they work great as expected. However, when I load the Select state and select a character (which calls the 'Play' state), the Character class errors upon instantiating a new character in the new state with the following message: Uncaught TypeError: Cannot read property 'getFrameIndexes' of null at Phaser.AnimationManager.add (phaser-split.js?2ffb:49401) at Character.loadData (character.js?9c96:59) If I call the 'Play' state directly, the character loads properly and doesn't give any errors. So it only seems to be happening when going from one state to another, which is puzzling me. I've tried every route of debugging possible and the only solution I can find seems to be not loading the data dynamically from my server. Currently, the animation data in my Character class gets loaded via socket.io which is called in the constructor: window.socket.on(`data:load:${name}`, (data) => { // Listen to data updates for this character this.loadData(data) }) window.socket.emit('data:request', name) // Request new data from the server The loadData function then loops through the data and adds the animation frames: loadData(data) { // Grab data from server for this character from its definition file for(let anim in data.anims) { this.animations.add(anim, data.anims[anim].frames, data.anims[anim].speed) } } The error above occurs on the first animation I want to add. If I look at the this.animations object, it doesn't have a 'sprite' set and most values are null. Any help would be appreciated. I've stripped out most of my code at this point and am now just stuck. I've searched a bunch (here/google/stackoverflow) and the only solutions to people running into similar problems seem to be to make sure you're passing this.game into your sprite, which I'm doing Actual code (Github) Play (state): https://github.com/stormsword/stormsword/blob/classes/lib/client/game/play.js Character (sprite): https://github.com/stormsword/stormsword/blob/classes/lib/client/game/char/character.js
  11. Hey! This is my first thread, I'm new here, so hello everyone! I started last week with phaser, and I am trying to test some features like extend the world, adding other sprites to background, adding a camera, all of this in the "game" that you make in this tutorial. So now, I want to learn how friction works in platforms or ground. game.physics.startSystem(Phaser.Physics.ARCADE); platforms = game.add.group(); platforms.enableBody = true; var ground = platforms.create(0, game.world.height - 64, 'ground'); ground.scale.setTo(4, 2); ground.body.immovable = true; ground.body.friction.x = 0; I want to set my ground like ice and that the player can slide, but it didn't work and I don't know why. If there is no other code that involves "ground", maybe the problem is with the player sprite? :S The version of phaser i am using is 2.9.4 btw.
  12. Hey guys, Has anyone here managed to find or write some unit tests for their Phaser games? I already searched with different keywords for unit tests on phaser games, but the articles / posts I've been able to found, are pretty much outdated or don't provide any tutorials / extra info. The game for which I want to write unit tests is pretty UI heavy, and it would be useful to find at least some tutorials somewhere, or at least some tests written for another game. I've already tried playing with Nightwatch.js, but I hit a roadblock when I need to interact with the objects from the app ( such as clicking a button, and by clicking, I mean I want to know on what button I make a click, not just navigate the cursor to it's coordinates ). Any tips are welcome, or tutorials. Thanks in advance,
  13. Hey! Did anybody compare Phaser and pixi for performance? We're going to make isometric game. bottom line is about objects you could render per screen. What do you think? What to choose? Phaser 2, PIXI, or maybe Phaser 3? Need the canvas renderer of course, not webgl. Update: I've the same question in the phaser slack channel. It seems that the PIXI would be better for isometric game then Phaser 2.
  14. Hello guys, I haven't posted my tutorial in a while. This is part 5 of multiplayer game tutorial series. We're creating a leaderboard for top scorers! http://gojasonyang.com/post/phaserMultiplayerGamePart5.html
  15. How does one animate the gain or loss in degree's of an arc drawn around a sprite ( based on how much health the spite has. ) E.g. 50% = 180 degree arc. Gain 25% health, grow the arc to 75 degrees. Loose 50% health, reduce ark down to 25 degrees.
  16. datahandler

    bouncing ball maximum height

    Let's say I have 3 balls in a game: large, medium, small. I want each of these balls to bounce to a maximum height (defined by me) but without bouncing at the top. Simply to arc naturally to the maximum height, then start falling again. Is there a straightforward way to accomplish this?
  17. tomfog

    Move world position on canvas

    Hi I have a newbie question that I feel silly asking but I couldn't find an example that demonstrated this yet. I have set the size of the canvas using the following code: var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'new-phaser-game', { preload: preload, create: create, update: update, render: render }); I have added a sprite that sits at the bottom of the screen full width (as expected) using the following: shapeMenu = game.add.sprite(0, 500, 'shapeMenu'); Now I would like to resize the world so that it sits inside this area with a margin around it (but inside the canvas). I have done this, but the world is sitting in the top left corner: game.world.setBounds(0, 0, 400, 400); Could any one advise on how I move this to the center of the screen (without moving the shapeMenu sprite as well)? Thanks!
  18. Hi I'm new to phaser and have been trying to use some of the examples as a starting point. I'm planning on using the "Pick Up Object" example, but restrict the area that the tetris shapes are placed in - so that they land on a solid platform. I would then add 3 x buttons to add more of the shapes onto the screen. Example here: https://phaser.io/examples/v2/p2-physics/pick-up-object Would the best way to achieve this be to build the solid platform using a kinematic sprite as documented here: http://phaser.io/examples/v2/p2-physics/kinematic-body If not, what is the best way define the area that the shapes are placed in - so they do not fall behind or in front of the platform and buttons? Thanks! Tom
  19. Welisa Lewis

    Help to make sprite follow curved path

    i need the penguin sprite to follow the blue curved path , I have used a sin cos generator for the platform the code is attached below.
  20. SkyWorld

    Phaser + VueJS

    Excuse me! I have a problem with the game develop. I have 5 states: state1~state5, and every state has preload, create and update 3 function. How should I put them in mounted and methods? In original code: var GameObj = {}; GameObj.Index = function (game) { }; GameObj.Index.prototype = { create: function(){}, update: function(){}, player: function(){} }; And I try to write in VueJS: import 'pixi'; import 'p2'; import Phaser from 'phaser'; export default { name: 'game', props: { height: Number, width: Number, }, mounted() { let self = this; const gameHeight = document.querySelector('#gameBox').offsetHeight; const gameWidth = document.querySelector('#gameBox').offsetWidth; if (this.game === null) { this.game = new Phaser.Game({ width: gameWidth, height: gameHeight, renderer: Phaser.AUTO, parent: this.$el, }); } this.addSate(); }, methods: { addSate() { this.game.state.add('GamePreloader', function() { this.prototype = { preload(Phaser) { ... }, create(phaser) { .... this.game.state.start('GameIndex'); }, }; }); this.game.state.add('GameIndex', function() { this.prototype = { create(phaser) { .... }, memberLogin(phaser) { .... }, }; }); this.game.state.start('GamePreloader'); }, }, data() { return { game: null }; }, }; I don't know if my structure has a fault? Because there is nothing in the canvas to display.
  21. Hi, To simulate a laser blaster heating and cooling I used setInterval for the cooling and setTimeout to delay the cooling if the weapon overheat (firelimit reached). While the weapon is cooling, if it fires again the cooling is aborted (clearInterval, only if the weapon has not overheated). Although it is working correctly while in game, the cooling or the delay is not paused when the game window loose focus, that's because of setTimeout and setInterval. Here is a demo Blaster heating and cooling, some heating and cooling feedbacks are logged in the browser console and a heating meter in the top right camera corner. The colldown function using setInterval. The overheat handler using setTimeout. The cooldown aborter using clearInterval. The github repo. How should I use Phaser.Timer and Phaser.TimerEvent to implement the same behaviour and then get the cooling timer and cooling delay paused when the game window looses focus.
  22. Hi there everyone, As someone asked on the phaser slack, here's a guide to get auto completion for Phaser in Atom on Windows. It is powered by Angelo's tern-phaser plugin. Installing tern This first part explains how to get npm, install tern and the tern-phaser plugin. The first thing that you need to ensure is that you have Node.js installed on your computer. You can download it on https://nodejs.org/en/. This will give you access to npm as well, a handy package manager for js libraries and plugins. It allows you to download install all sorts of packages from the command prompt. Once Node.js has finished installing, we have a few commands to call from the command prompt. On windows, you can access the command line need to press the Windows R key combination, type "cmd" and press enter. Then we need to install a few packages. First, there is tern, the JS analyzer that the tern-phaser plugin uses. In the command line tool, type "npm install tern" and press enter. Npm will take care of the install for you, it will just take a moment. We then need the tern-phaser plugin to be installed where the tern package has been put. You can let windows find the folder for you by typing "npm install -g tern-phaser" in the command prompt and pressing enter. The manual route If AND ONLY IF the automatic install of tern-phaser doesn't work, you'll have to go navigate to the tern install folder manually from the command prompt. To change the folder the command prompt is in, you need to type cd (current directory) followed by the path you want to reach. By default, tern should be installed to C:\Users\YourName\node_modules and tern-phaser should go into your global modules folder, into C:\Users\YourName\AppData\Roaming\npm\node_modules. In the command prompt, you then have to enter "cd C:\Users\YourName\AppData\Roaming\npm\node_modules". Note that you can copy the path from windows and paste it in the command prompt using the right mouse button (Ctrl V doesn't work by default). Right click on the command line window to paste text. Once you got to the right folder, just type npm "install tern-phaser" and press enter. Without -g, the command installs the tern-phaser package in the folder you're currently in. Using tern-phaser with Atom Now, you have both tern and tern-phaser installed on your computer. Let's move to setting up atom to work with tern. There is no native integration of tern in atom. However, there is a plugin called atom-ternjs that works like a charm. We can install the package from the command line as well. Either close and reopen the command prompt or navigate back to your root folder with the following command: "cd C:\Users\YourName". Then, to call the Atom Package Manager, you need to use the apm command. Type "apm install atom-ternjs" and press enter. This will add this package to atom for you. To use tern with your project, you just need to have a tern configuration file. Atom-ternjs can create a basic config file for you. In Atom, you first need to have at least one javascript file loaded. Then, go to packages -> Atom ternjs -> Configure project You can set some parameters in the newly opened tab and click on save and restart server. This will create a new .tern-project file in your project folder. We still need to tell it to use the phaser plugin. You just have to add "phaser" in the plugins section. Here's the content of my .tern-project file: { "ecmaVersion": 5, "libs": ["browser"], "plugins": { "phaser": {} } } Save your file, and then go to package -> Atom Ternjs -> Restart server. If you don't get any error, you're good to go! Note that having a phaser.js file next to your .tern-project file can prevent tern-phaser from working - in which case you'll get a series of errors in Atom.
  23. buttonsrtoys

    Best Typescript/Phaser IDE?

    A couple years ago a built an Asteroids clone using JS and Phaser on Cloud9 (c9.io). Was a great experience and a great way to learn JS. I'm now looking at a second game that I'd like to code with Typescript and distribute on the Android platform and possibly iOS. C9 has since been bought by Amazon and not supporting the C9 IDE as much. Regardless, it never supported breakpoints for JS, so had to debug using the Chome dev tools. My day job is coding C++ on visual studio. What's the best IDE for coding Typescript for Phaser? Ideally (for me) it would be close to Visual Studio experience (e.g., eclipse) but I'm up for something different. Mostly, I'd like to get away from the clunky C9 / Chome debugging.
  24. GideonSam

    TileSprite Alternative

    Hi All, I have been working on a Endless Runner game for mobile and web . Initially i Used TileSprite for the looping background,but it affects the performance on mobile. Then i used the classic method of moving two backgrounds simultaneously. But if i increase the speed of the movement , it gives a gap between two backgrounds. Kindly help me with the logic bgSpeed = 10 update() { mainBg1.y += bgSpeed; mainBg2.y += bgSpeed; if(mainBg1.y >= this.game.height) { mainBg1.y = -this.game.height; } if(mainBg2.y >= this.game.height) { mainBg2.y = -this.game.height; } }
  25. Hello to everyone, I'm currently developing a fan-made, retro-style and non-profit game with Phaser based on the TV show Stranger Things. The main idea is to do a Point and Click game like old classics (Monkey Island saga, Indiana Jones and the fate of atlantis, etc...) with retro pixel-art graphics and chiptune music. I'm looking for GFX and Music artists If you are interested to collaborate with this project please contact with me and I'll send you a link to see the work in progress. (Sorry if there are some grammar errors, I'm Spanish).