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
    • Coding and Game Design
  • Frameworks
    • Phaser
    • Pixi.js
    • Babylon.js
    • Panda.js
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered

Found 2,711 results

  1. Noob here, I'm trying to get an update function to call inside a separate JS file. I have a basic phaser structure in load.js: var myGame = {}; myGame.load = function (game) { }; myGame.load.prototype = { preload: function() { //.. }, create: function(){ //... } }; myGame.update = function(game) { }; myGame.load.prototype = { update: update }; And the update function I'm trying to add and call in update.js update = function() { game.physics.arcade.collide(blue_player, platforms); console.log("update is working"); }; load.js is loaded before update.js in my HTML Thanks a lot for reading
  2. Phaser CE v2.8.0 | WebGL I have a game with lots of enemies, and each enemy needs to shoot out blood particles when attacked. My problem is, my world size is much larger than the size of the emitter bitmapdata that ParticleStorm creates. I tried making it larger, but that caused extreme lag. Then I tried making an emitter for each enemy, and moving the x/y coordinates of the emitter's display to the enemy's location: this also caused heavy lag after just 2 or 3 emitters were created. Any ideas on what I can do to have enemies emit particles across a large map (1920x1920)?
  3. Hello, How to optimize this? 96 draws, 707 calls. 40 cards and they are drawn separately. all textures are in one atlas, all cards are on the same parent. The card object is a sprite in which the sprite in which 2 sprites for shirt and card face and 4 textures for this. Card class code on the gist: https://gist.github.com/maxmonax/fd8ea7605a7558986aa152c63338f9fd Thanks!
  4. Hello everyone, I'd like to show my new HTML5 (Phaser) game that I've developed called Adventure of Ryan Hunter I would love some feedback! Priyo Hutomo (www.tweaknow.com)
  5. Hi, I am noob, and this is a nooby question. I've looked everywhere for a fix, but I can't get my ground to show, I'm not sure if it's even there. My code: (updated to show all my code so far) <!doctype html> <html> <head> <meta charset="UTF-8" /> <title>hello phaser!</title> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script> <script src="phaser.js"></script> <link rel="stylesheet" href="game.css"> </head> <body> <script type="text/javascript"> window.onload = function() { var width = $( document ).width(); var height = $( document ).height(); var game = new Phaser.Game(width, height, Phaser.AUTO, '', { preload: preload, create: create }); function preload () { //800 336 game.load.spritesheet("background" , "backgroundgif1.png", 800, 336); game.load.image("ground","red.png"); game.load.spritesheet("blue_player", "player_sprites/playertwo standing.png", 96, 96); } function create () { game.physics.startSystem(Phaser.Physics.ARCADE); platforms = game.add.group(); platforms = game.add.physicsGroup(); platforms.enableBody = true; var ground = platforms.create(400, 450, 'ground'); platforms.setAll('body.immovable', true); ground.scale.setTo(2, 2); var background = game.add.sprite(0, 0, 'background'); background.animations.add("background", [0,1,2,3,4,5,6,7,8], 10, true); background.animations.play("background"); background.width = game.width; background.height = game.height; blue_player = game.add.sprite(-10, game.world.height -490, 'blue_player'); game.physics.arcade.enable(blue_player); blue_player.body.bounce.y = 0.2; blue_player.body.gravity.y = 300; blue_player.body.collideWorldBounds = true; blue_player.animations.add('left', [0, 1, 2], 2, true); blue_player.animations.play("left"); } function update() { game.physics.arcade.collide(blue_player, platforms); } }; </script> </body> <script src="update.js"></script> </html> Any ideas as to what I'm doing wrong?
  6. In the trivial case of creating and then destroying an instance of Phaser.Game there appears to be a memory leak. Below is a complete working example: click the button to create an instance, click again to destroy it. Repeatedly clicking the button causes memory usage to grow without bound. Is there something I'm missing about the phaser lifecycle that I should be doing instead? <!doctype html> <html> <head> <meta charset="UTF-8"/> <title>test</title> <script src="https://cdnjs.cloudflare.com/ajax/libs/phaser/2.6.2/phaser.min.js"></script> </head> <body> <button id="button">Click</button> <div id="canvas"></div> <script> window.onload = function() { var d, n, game; d = document.getElementById('button'); n = document.getElementById('canvas'); function preload() { } function create() { } function update() { } function handler() { if(game) { game.destroy(); game = null; } else { game = new Phaser.Game(800, 600, Phaser.AUTO, n, { preload: preload, create: create, update: update }); } } d.onclick = handler; }; </script> </body> </html>
  7. Hey all! I'm trying to update my game every time the screen is resized or turned from portrait to landscape and visa versa. What I'm doing right now is using window.onresize = this.resize(); but resize() is being called every frame. Does anyone either know why this isn't working or how to do this better? Thank you!!!
  8. Hey folks, i'm Tyjow, I'm a web developer junior since a year and i share you my "second" game created with Phaser. (For the little first who i've learn, go to https://tyjow.github.io/Tyjow-Games/ : not finished) After a fight to come on the forum, (- Thanks Rich) i looking for to share you my new game on which I working called Space Phazphaz. Please do not hesitate to give me your feedback and pull request if you want Link : https://tyjow.github.io/MyShooterGame/ I'm actually working on the next levels. Have Fun !
  9. Noob here, Having a hard time with making game states to work - I've been following tutorials and still no luck. I'm really looking for an overview of what I have so far on states, more so than an error fix (witch is loadState is not defined in index.html line 23) HTML: <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>game v1</title> <script src="phaser.js"></script> <script src="jquery-3.2.1.js"></script> <script src="loadState.js"></script> <script src="update.js"></script> <link rel="stylesheet" href="css/game.css"> </head> <body> <div class="gameDiv"></div> </body> <script type="text/javascript"> (function() { var width = window.innerWidth; var height = window.innerHeight; var game = new Phaser.Game(width, height, Phaser.AUTO, 'gameDiv'); game.state.add("loadState",loadState); game.state.add("updateState",updateState); game.state.start("loadState"); })(); </script> </html> loadState.js: var loadState = { preload: function() { game.load.spritesheet("background" , "assets/backgroundgif2.png", 800, 336); game.load.image("ground","assets/red.png"); game.load.spritesheet("blue_player", "assets/player_sprites/playertwo standing.png", 96, 96); }, create: function(){ game.scale.fullScreenScaleMode = Phaser.ScaleManager.EXACT_FIT; game.physics.startSystem(Phaser.Physics.ARCADE); platforms = game.add.group(); platforms = game.add.physicsGroup(); var background = game.add.sprite(0, 0, 'background'); background.animations.add("background", [0,1,2,3,4,5,6,7,8], 10, true); background.animations.play("background"); background.width = game.width; background.height = game.height; game.world.sendToBack(background); //used this to place background behind platforms var ground = platforms.create(0, game.world.height - 64, 'ground'); platforms.enableBody = true; platforms.setAll('body.immovable', true); ground.scale.setTo(2, 2); ground.alpha = 0; //used this to make the ground transparent blue_player = game.add.sprite(-10, game.world.height -490, 'blue_player'); game.physics.arcade.enable(blue_player); blue_player.body.bounce.y = 0.2; blue_player.body.gravity.y = 300; blue_player.body.collideWorldBounds = true; blue_player.animations.add('idle', [0, 1, 2], 2, true); blue_player.animations.play("idle"); game.state.start("updateState"); } }; and updateState.js: I have also had var updateState error as undefined, witch does not happen in the tutorials I've used. Though this does not happen now with the code you see here. console.log("update is working"); var updateState = { update: function() { game.physics.arcade.collide(blue_player, platforms); } }; Thanks for reading, hope you can set me straight.
  10. Hi, I have made a game in resolution 1000:600px, but I realized that it's to big, and I want to scale it by ~0.7, and here is a problem because when I do this: game.camera.setSize(1000*0.7,600*0.7); game.stage.width*=0.7; game.stage.height*=0.7; game.width*=0.7; game.height*=0.7; game.camera.setSize(center.x*2*0.7,center.y*2*0.7); game.scale.refresh(); the game is scaled, but mouse pointer doesn't seem to be in the right position. How can I fix it?
  11. Hi All!, I want to introduce my first game in html5 (Phaser), and, as you can see, I love to start with one of the most difficult of all the games!. First a picture of the game: And off course, a link to play it: https://multionline.herokuapp.com/ As you can see the game is RPG like, and have the following features: · Multiplayer game (all the players in the same map for now!), · You can chat with other players (press enter, type message and then enter again), · Level up as you kill monsters, · Items drop with different attributes (more than 20 items types), · 5 types of monster that appears as you level up, · 6 spells. The game is yet in alpha, we are showing a concept of how it will looks like when it is finished J. The objective right now is to kill the cosmic monster, it is this one (it appears when you are lvl 5): To kill him, you will need really good items!, so try to equip as good as you can or engaged him with some other friends!. I would like to thanks the two persons that help me do this game: · Leonardo: That make the tiles for the game and the side bar! (and help me to test it a lot!), · Julian: That make all the draws, specially the cosmic monster and the principal character!. We are a team of people that love to play games, and love more to make them. What we use to make this game? All of this: · Phaser C.E 2.7.5 (so great framework!!). · Node.js for the server. · Server and Client write in Typescript (much better than plane javascript, it help a lot to debug the game). · Some pictures and sounds were taken from http://opengameart.org/. · JS Signals by Miller Medeiros for the server. · TileMap to do the map of the game. If you like the game please give us some feedback and ideas to continue the development of the game!. Hope you enjoy it!.
  12. Hello there, I'm new to phaser and the first thing I had a minor quip with was the way animation calls were handled (they look messy and unorganized). I have experience coding in engines such as Vylocity ( http://vylocity.com ) where icon states are handled and managed by the direction the player/npc has chosen to go in. A player is set with an icon "state" which is a specific type of animation, each with its own directional states spit up (with the same number of states for each direction). This state references a file that is icons from a number to a number that those states are bound to. Here is an example of how the icon file looks, and i was wondering if there'd be an easy way to split up these images manually in code by specifying where each direction is, and then storing the file that they are referenced to as a string that would then be called. Then to set a character's animation, you would call this function that assigned the animation to it, grab the direction, and select the chosen section of the png file that contained that character's movement state. Maybe if I were to reorganize the icon file into something a bit easier for the engine to keep track of it wouldn't end up messy code-wise, especially when I needed to edit something. I could just split up each character direction into it's own file - the initial state would be for inactive movement while facing that direction, while the rest of the states would play while moving (e.g. while the key is being held) Can I get some idea on how I'd go about coding this. or if there already exists a library that simplifys animation calls.
  13. Hello guys, exist some function for stopping time or best the game in action?
  14. Hi, I downloaded the following from https://github.com/BonbonLemon/basketball.. Why is it everytime I played the game in the chrome browser/firefox after 1 minute it started to become laggy, Thanks <!doctype html> <html lang="en"> <head> <meta charset="UTF-8" /> <title>Basketball Game</title> <script type="text/javascript" src="js/phaser.js"></script> <h2>Basketball Game (inspired by Facebook Messenger!)</h2> <style type="text/css"> body { margin: 0; } canvas { margin: 0 auto; border: thin solid black; } span { display: block; margin: 30px auto; width: 500px; text-align: center; } h2 { text-align: center; } </style> </head> <body> <script type="text/javascript"> // NOTE: Originally 640x1000. Other possible sizes: 512x800, 400x625 var game = new Phaser.Game(400, 625, Phaser.CANVAS, '', { preload: preload, create: create, update: update }); function preload() { game.load.image('ball', 'assets/images/ball.png'); game.load.image('hoop', 'assets/images/hoop.png'); game.load.image('side rim', 'assets/images/side_rim.png'); game.load.image('front rim', 'assets/images/front_rim.png'); game.load.image('win0', 'assets/images/win0.png'); game.load.image('win1', 'assets/images/win1.png'); game.load.image('win2', 'assets/images/win2.png'); game.load.image('win3', 'assets/images/win3.png'); game.load.image('win4', 'assets/images/win4.png'); game.load.image('lose0', 'assets/images/lose0.png'); game.load.image('lose1', 'assets/images/lose1.png'); game.load.image('lose2', 'assets/images/lose2.png'); game.load.image('lose3', 'assets/images/lose3.png'); game.load.image('lose4', 'assets/images/lose4.png'); game.load.audio('score', 'assets/audio/score.wav'); game.load.audio('backboard', 'assets/audio/backboard.wav'); game.load.audio('whoosh', 'assets/audio/whoosh.wav'); game.load.audio('fail', 'assets/audio/fail.wav'); game.load.audio('spawn', 'assets/audio/spawn.wav'); } var hoop, left_rim, right_rim, ball, front_rim, current_score = 0, current_score_text, high_score = 0, high_score_text, current_best_text; var score_sound, backboard, whoosh, fail, spawn; var moveInTween, fadeInTween, moveOutTween, fadeOutTween, emoji, emojiName; var collisionGroup; function create() { game.physics.startSystem(Phaser.Physics.P2JS); game.physics.p2.setImpactEvents(true); game.physics.p2.restitution = 0.63; game.physics.p2.gravity.y = 0; collisionGroup = game.physics.p2.createCollisionGroup(); score_sound = game.add.audio('score'); backboard = game.add.audio('backboard'); backboard.volume = 0.5; whoosh = game.add.audio('whoosh'); fail = game.add.audio('fail'); fail.volume = 0.1; spawn = game.add.audio('spawn'); game.stage.backgroundColor = "#ffffff"; // high_score_text = game.add.text(450, 25, 'High Score\n' + high_score, { font: 'Arial', fontSize: '32px', fill: '#000', align: 'center' }); current_score_text = game.add.text(187, 312, '', { font: 'Arial', fontSize: '40px', fill: '#000', align: 'center' }); // 300, 500 current_best_text = game.add.text(143, 281, '', { font: 'Arial', fontSize: '20px', fill: '#000', align: 'center' });// 230, 450 current_best_score_text = game.add.text(187, 312, '', { font: 'Arial', fontSize: '40px', fill: '#00e6e6', align: 'center' }); // 300, 500 hoop = game.add.sprite(88, 62, 'hoop'); // 141, 100 left_rim = game.add.sprite(150, 184, 'side rim'); // 241, 296 right_rim = game.add.sprite(249, 184, 'side rim'); // 398, 296 game.physics.p2.enable([ left_rim, right_rim], false); left_rim.body.setCircle(2.5); left_rim.body.static = true; left_rim.body.setCollisionGroup(collisionGroup); left_rim.body.collides([collisionGroup]); right_rim.body.setCircle(2.5); right_rim.body.static = true; right_rim.body.setCollisionGroup(collisionGroup); right_rim.body.collides([collisionGroup]); createBall(); cursors = game.input.keyboard.createCursorKeys(); game.input.onDown.add(click, this); game.input.onUp.add(release, this); var instructions = document.createElement("span"); instructions.innerHTML = "Instructions: Quickly drag the ball to shoot the ball into the hoop!"; document.body.appendChild(instructions); } function update() { if (ball && ball.body.velocity.y > 0) { front_rim = game.add.sprite(148, 182, 'front rim'); ball.body.collides([collisionGroup], hitRim, this); } if (ball && ball.body.velocity.y > 0 && ball.body.y > 188 && !ball.isBelowHoop) { ball.isBelowHoop = true; ball.body.collideWorldBounds = false; var rand = Math.floor(Math.random() * 5); if (ball.body.x > 151 && ball.body.x < 249) { emojiName = "win" + rand; current_score += 1; current_score_text.text = current_score; score_sound.play(); } else { emojiName = "lose" + rand; fail.play(); if (current_score > high_score) { high_score = current_score; // high_score_text.text = 'High Score\n' + high_score; } current_score = 0; current_score_text.text = ''; current_best_text.text = 'Current Best'; current_best_score_text.text = high_score; } emoji = game.add.sprite(180, 100, emojiName); emoji.scale.setTo(0.25, 0.25); moveInTween = game.add.tween(emoji).from( { y: 150 }, 500, Phaser.Easing.Elastic.Out, true); fadeInTween = game.add.tween(emoji).from( { alpha: 0 }, 200, Phaser.Easing.Linear.None, true, 0, 0, false); moveInTween.onComplete.add(tweenOut, this); } if (ball && ball.body.y > 1200) { game.physics.p2.gravity.y = 0; ball.kill(); createBall(); } } function tweenOut() { moveOutTween = game.add.tween(emoji).to( { y: 50 }, 600, Phaser.Easing.Elastic.In, true); moveOutTween.onComplete.add(function() { emoji.kill(); }, this); setTimeout(function () { fadeOutTween = game.add.tween(emoji).to( { alpha: 0 }, 300, Phaser.Easing.Linear.None, true, 0, 0, false); }, 450); } function hitRim() { backboard.play(); } function createBall() { var xpos; if (current_score === 0) { xpos = 200; } else { xpos = 60 + Math.random() * 280; } spawn.play(); ball = game.add.sprite(xpos, 547, 'ball'); game.add.tween(ball.scale).from({x : 0.7, y : 0.7}, 100, Phaser.Easing.Linear.None, true, 0, 0, false); game.physics.p2.enable(ball, false); ball.body.setCircle(60); // NOTE: Goes from 60 to 36 ball.launched = false; ball.isBelowHoop = false; } var location_interval; var isDown = false; var start_location; var end_location; function click(pointer) { var bodies = game.physics.p2.hitTest(pointer.position, [ ball.body ]); if (bodies.length) { start_location = [pointer.x, pointer.y]; isDown = true; location_interval = setInterval(function () { start_location = [pointer.x, pointer.y]; }.bind(this), 200); } } function release(pointer) { if (isDown) { window.clearInterval(location_interval); isDown = false; end_location = [pointer.x, pointer.y]; if (end_location[1] < start_location[1]) { var slope = [end_location[0] - start_location[0], end_location[1] - start_location[1]]; var x_traj = -2300 * slope[0] / slope[1]; launch(x_traj); } } } function launch(x_traj) { if (ball.launched === false) { ball.body.setCircle(36); ball.body.setCollisionGroup(collisionGroup); current_best_text.text = ''; current_best_score_text.text = ''; ball.launched = true; game.physics.p2.gravity.y = 3000; game.add.tween(ball.scale).to({x : 0.6, y : 0.6}, 500, Phaser.Easing.Linear.None, true, 0, 0, false); ball.body.velocity.x = x_traj; ball.body.velocity.y = -1750; ball.body.rotateRight(x_traj / 3); whoosh.play(); } } </script> </body> </html>
  15. I've been messing around with Phaser for a little over a year now for fun and a month ago I decided I need to harness my Phaser-fu and actually release something. Learn Japanese & Korean by playing games in space! Currently they only have two categories (numbers & colors), but I will be slowly expanding everything in the coming months. Korean: https://play.google.com/store/apps/details?id=com.jernung.infinite.kor Japanese: https://play.google.com/store/apps/details?id=com.jernung.infinite.jpn
  16. I started working on a top down racing game as fun project a while back. I didn't use any game framework. Only node.js, express.js, socket.io and bunch of node modules and webpack. I got a working prototype where I can drive around and get real time sync between players that was good enough for now. The next thing I started on was collision detection. After a while I realised that I need some framework for it rather than create my own thing. After some research I started looking at phaser and finally bought box2d plugin for phaser which included a simple top down racing game as a example. I spent some time on tweaking parameters and got a result I was happy with. So I brought phaser into my project and got problems with pixi.js on the node server because there are no dom elements and pixi seems to be baked into phaser. After some googling it seems like running phaser on the server is a bad idea, but I only wanted box2d anyway. So I got a box2d version called box2dweb and tried to create the same thing that I had working in phaser + box2d. After getting errors I couldn't figure out it turns out after some googling that there is missing functionality (edgeChains) in box2dweb. So I try all the other implementations of box2d in JS that I can find and all of them reports errors (different errors with each version) and it's code that works fine in the box2dweb version. Sigh. I can not be the first person wanting to do a real time multiplayer game using node and box2d. Any advice how to move forward?
  17. Play Link: Squares Vs Circles Game Circles don't like Squares, because Squares have edges... Welcome to this fun mobile Puzzle Game You tap Squares to toggle their position: defensive or vulnerable. Toggle smart to survive against the incoming Circles. There are different Square types that require different strategies: - Normal Square - Lazy Square - Coward Square This is my first Puzzle game. If you guys like it, I will add more levels Have fun! Play Link: Squares Vs Circles Game
  18. Hi. We're working on a few HTML5 games. Maze Runners is absolutely a work in progress but I'm hoping to quickly improve it and get it sort of to beta by Saturday. It requires at least two players to test. Instructions: (Desktop only) Clicking play will put you in the lobby and a game will start if there's another player. Clicking the blue box on the Maze Runners panel will bring up an invite url to link to someone you want to test with. Thoughts and comments welcome! BIT ARCADE PS: Pretty much nothing else on the site works yet (pool etc are mostly dead links)
  19. Hi again, I made a game with Phaser framework and created an apk file with cocoonjs' web site but when I try to upload the game to the Play Store, I get an error about security. Google wants a key but even I try many things I couldn't create a key, I used android studio but the studio does not create a key for an apk file. I think the studio can add key just for xml files, Is there anyone who made games with Phaser and puslished them on Play Store? If so, can you explain everything about creating keys step by step, thanks.
  20. Hi, I'm writting a platform game in phaser, and i want it to have 30 levels. I wanna post them in a wordpress page and i really don't know how can i storage the data: levels passed, lifes left, etc... so i can use it in the wordpress site to show some "leves/icons" as completed and in my phaser game to get this informacion further than the cache data i can pass throught States. My programmer skills are few so i don't even know how to start. Anyone can tel me where to start looking? Many thanks!! Barbara
  21. I have a graphics issue that I cannot pinpoint. My sprite appears more blurry at some positions of the map. Does anyone have an idea what this kind of problem can depend on? Both of these pictures shows the sprite when idle on different positions - so no animation is playing - and at the first picture the sprite looks more clear than it does on the second one. I don't know what more information I can give on this that is relevant.
  22. Quicket - A cricket game for people who don't necessarily like cricket Play it here: Quicket Get it for Android here: Quicket Android It's cricket mixed with a puzzle game! Blast fours, smash sixes and beat your friends on the leaderboard! There are several different modes to play including Classic, Run Chase and lots of challenge modes, each with their own leaderboards. Built with Phaser.
  23. I have this idea for creating a character customization system. The system would be implemented as follows. 1) Organize a base template sprite sheet with character components arranged in a composition for future compositing. Example: Lets assume a full body template for a characters design is 125 by 125 consisting of head, body, and leg components. The head component of the character would use 25 pixels and would be isolated on separate parts of the sprite sheet that occupies the respective pixels while the rest of the 100/125 pixels are blank. The same would be done for the body and leg components. 2) Bind the components together via some sort of linked list or maybe even graph based implementation. I'm still learning about graphs and am thinking they're best for this system given compositing more complex sprite sheets will involve layers. Any advised implementations or any kind of information on graphs associated with player creation systems is highly appreciated. I think this is a great opportunity to practice graphs. 3) Next there will be an interface that allows the player to choose the color and textures of each of these components. The player will confirm and submit their design when finished. Now that the player has submitted their design, I'm a bit puzzled about the next step and have a few ideas on composing the data. 4a) Use Phaser api to turn the data into bitmaps? I don't know much about this implementation yet since I'm still learning how to utilize bitmaps and how Phaser handles bitmaps 4b) Composite the items on a canvas and store it in a uri using the canvas to url method. I also lack experience with api but I definitely can see how it would work. 5) Ideally I'll save the data to a database and retrieve them via player credentials. I'm not sure if I'm over complicating things or not so any feedback would be appreciated. I use Phaser but any html5 based idea or solution should be fine.
  24. Hello! I'm trying to refactor my code making some inheritance. I'm using a Character prototype which is supposed to inherit from Phaser.Sprite and then there can be - for example - a Player prototype which inherits from the Character. The problem is that i get this error: this.onTextureUpdate is not a function inside phaser.js when trying to create the Player object inside the create-function of the level. I would be greatful if someone could take a look on this. Here is the code relevant to the issue (I think) (It's in separate files): Character = function(game, x, y, type){ Phaser.Sprite.call(this, game, x, y, type); this.id = 0; this.name = ""; this.health = 0; this.dexterity = 0; this.defense = 0; this.strength = 0; /*Räknas ut*/ this.primalDamage = 0; //TODO: Lägg till uträkning this.weaponDamage = 0; this.attackRate = 0; this.hit = 0; this.protection = 0; this.block = 0; this.reach = 0; /*---------*/ }; Character.prototype = Object.create(Phaser.Sprite.prototype); Character.prototype.constructor = Character; Character.prototype = { countStats: function(){ }, Etc. etc etc...... Then the player: Player = function(game, x, y){ Character.call(this, game, x, y, 'player'); this.equipped = { rightHand: { name: "broadsword", type: "weapon", damage: 4, protection: 0, attackRate: 1.6 , block: 0, }, }; this.health = 20; this.dexterity = 13; this.defense = 14; this.strength = 15; this.groupCombatEnabled = false; this.animations.add('idleRight', [0], 5, true); this.animations.add('right', [0, 1, 2], 5); this.animations.add('hitRight', [0, 3, 4], 5, true); this.animations.add('idleLeft', [5], 5, true); this.animations.add('left', [5, 6, 7], 5); this.animations.add('hitLeft', [5, 8, 9], 5, true); this.animations.add('idleUp', [10], 5, true); this.animations.add('up', [10, 11, 12], 5); this.animations.add('idleDown', [15], 5, true); this.animations.add('down', [15, 16, 17], 5); this.animations.add('hitDown', [15, 18, 19], 5, true); this.reachCircle = this.game.add.graphics(); this.reachCircle.beginFill(0x000000, 1); this.reachCircle.drawCircle(this.x+24, this.y+24, this.reach*48); this.reachCircle.alpha = 0.2; this.reachCircle.endFill(); this.events.onAnimationComplete.add(function(self, animation){ this.animations.stop(true, true); if(animation.name.includes("hit") && this.enemiesAttacked.length > 0){ this.enemiesAttacked.pop().takeDamage(this, "primary"); } }, this); this.wasd = { up: this.game.input.keyboard.addKey(Phaser.Keyboard.W), down: this.game.input.keyboard.addKey(Phaser.Keyboard.S), left: this.game.input.keyboard.addKey(Phaser.Keyboard.A), right: this.game.input.keyboard.addKey(Phaser.Keyboard.D) }; this.combatKeys = { switchCombatStyle: this.game.input.keyboard.addKey(Phaser.Keyboard.Q) }; this.dmgTextColour = "#ff0000"; }; Player.prototype = Object.create(Character.prototype); Player.prototype.constructor = Player; Player.prototype = { checkActions: function(levelObjects){ this.reachCircle.clear(); this.reachCircle.beginFill(0x000000, 1); this.reachCircle.drawCircle(this.x+24 Etc. etc. etc.. Then there is the level: /** * Level state. */ function Level() { Phaser.State.call(this); // TODO: generated method. } /** @type Phaser.State */ var proto = Object.create(Phaser.State.prototype); Level.prototype = proto; Level.prototype.constructor = Level; Level.prototype = { create: function(){ this.map = this.game.add.tilemap('oryxtiles'); this.map.addTilesetImage('tiles', 'tiles'); this.map.addTilesetImage('tree', 'tree'); this.backgroundLayer = this.map.createLayer('backgroundLayer', 768, 768); this.blockLayer = this.map.createLayer('blockLayer', 768, 768 ); this.map.setCollisionBetween(1, 3000, true, 'blockLayer'); this.backgroundLayer.resizeWorld(); this.createItems(); this.createDoors(); var playerStart = this.findObjectsByType('playerStart', this.map, 'objectLayer')[0]; this.player = new Player(this.game, playerStart.x, playerStart.y);
  25. Hi, I am trying to make a game for mobile, how can I test my game in terms of its performance, I am trying on devices but it takes my time a lot, testing the game every time. And one other question is what do you think about the phaser's future? I mean, nowadays I read about some performance issues when running phaser games on mobile. Should I choose any other programming language to make mobile games? I like phaser but if it will not good for mobile, I will have to pass any other programming language like java, instead of javascript.