JakeCake

Members
  • Content count

    82
  • Joined

  • Last visited

About JakeCake

  • Rank
    Advanced Member

Profile Information

  • Gender
    Male
  • Location
    Denmark

Recent Profile Visitors

780 profile views
  1. One big atlas or several small ones - performance

    One big one is better, but keep in mind maximum size supported for some graphic-units. I think the general rule is to keep atlases at or below 4048x4048. If you have to split them into multiple atlases, try to put sprites that would be drawn at the same time on the same atlas, like background images in one and foreground in another. That way you can minimize the number of texture-swaps to a minimum.
  2. Pixel Cave [roguelike]

    THIS!!???!!?=??!! OMG cant get past lvl 32!! Very nice game so far, seems very polished, but I hope to see more updates to the difficulty curve and randomization. Now that I got the hold of it, it's alright difficulty wise for me, besides lvl 32 of cause, but as a first-time player it was super difficult to get past even the first boss or two. Even now though, because of the randomization, some runs I just can't get very far because of poor items / not enough health-potion drops etc. So maybe some kind of rating of items and make them drop at least X amout before lvl 10, 20, 30 etc. instead of what seems like completely random drops. Very nice so far though
  3. Protect your phaser code

    Best you can do is to uglify the code using something like Google Closure Compiler Service. To be fair, if competitors really wants to steal your stuff, it doesn't matter what language you use, they will always be able to get the source-code, even if you obscure variable-names and remove comments etc. Use copyright and go the legal way instead of making the code unavailable.
  4. How to get the distance traveled by a sprite ?

    You can use sqrt( (ship.x - bullet.x)^2 + (ship.y - bullet.y)^2 ) to get the distance between the ship and a bullet. Check this each frame for each bullet and kill the bullet if the calculated distance is greater than 250. The other option is to set a lifetime on your bullet, all sprites have this I believe. After the given time it is automatically destroyed. Just figure out how fast a bullet is traveling per second and make sure this add up to 250 or whatever you thing is proper. Third option is to check if the bullet is in the camera-bounds. I think sprites have a method for this as well. That way bullets will never vanish while in view of the player, but also not travel around the gameworld where the player cannot see it.
  5. Make Jpeg Transparent

    I agree with matt; transparency in png is a built in mask, so why overcomplicate? If you like the compression-rate of jpeg over png I suggest you take a look at some good png-compression like on https://tinypng.com/ You can get just as good results with png compression as jpeg. EDIT: I myself use a gulp task to take my loseless PNG-files and combine them into texture atlases and then pipe them into a compression task using gulp-pngquant. So I am always working with uncompressed png-files, but the final build will be compressed based on settings I can always change for quality over size. For my next project I might even move to working purely with photoshop files and have a task to convert my photoshop files into pngs.
  6. Upgraded from 2.4.7 to 2.4.9.rc4 and did a throughout test. No problems to report, everything I tested works. Is there a way to test release candidates with NPM? I normally just update my package.json to the newest version of Phaser when it comes out, but I can't seem to find release candidates in NPM, newest is 2.4.8
  7. Too many asset files for Phaser game

    Something I've been longing to ask for, if you don't mind. Does Phaser draw all sprites from one atlas first and then move on to the next as it saves the depth-value for each, or does it draw in the order of depth, so behind most sprites are drawn first and multiple texture-swaps to the same texture might occur per frame? It's so I know how to pack my textures, as in which order of depth they are usually drawn in. Little off-topic sorry, but it's just a quicky question.
  8. I don't think it's directly possible, as the parent sprite works as a display group and applies it's transformation on all it's children. You could however negate the effect by either: Not adding it as a child, but instead set the x/y of the child to the same as wave_left each frame and then have them in the same display group. Negate the rotation by setting the childs rotation to the negative of the parent and then displace with a vector from child to parent, but the first solution seems easier Wait for a better answer, there might be a built in way of doing this.
  9. Game inventory

    Well it depends a lot on what you are doing. Developing websites or libraries, populating the global scope is a big no-no, but I don't think HTML5 games have aged enough to have best-practices yet. I mean if all you have on your website is just your game, and you know this for sure, then I don't see a reason not to use the global scope, and in the end you can just throw a function-scope around your entire game-code. Best practices are widely different depending on which language you use, but also the type of project you are developing.
  10. Game inventory

    I like to have one class per file, so I would have put your Inventory inside a separate file and then do this.inventory = new Inventory() in your player class. Either way it's fairly nice code, you divide responsibility in a good way. If your player is the only one ever to use an inventory I think what you are doing is perfectly fine and won't populate the global scope as bad as my "one class per file" will do. So go on along the path you're on, it looks good.
  11. Phaser 2.4.7 is released

    Also just wanted to let you know that upgrading 2.4.6 -> 2.4.7 went without problems. Where can I read more in details about the new Camera shake effect? I wrote my own one for my current project, but if the built in is better and easy to implement I might as well switch to it.
  12. Polution in Global Namespace

    (function() { // ALL YOUR CODE HERE })(); Effectively puts everything into it's own scope. You want one of these around each game. You can also switch out all your "var"s with "let" and just put { } around the games, but I like to add function scope around better. Alternatively you can make it a class object instead that you initialise with a "new" operator, and then all values defined as "this.yourValName" will be available through that object, the rest closed off completely inside the function-scope.
  13. Phaser 2.5 Roadmap (and request for ideas)

    1. Yes to this, v4 is a huge step it seems. I don't think Phaser needs to natively support new features of v4, but the performance is definitely worth the effort in my opinion. 2. Havn't heard of this yet, but it seems awesome! Generally anything that has to do with better performance, or the illusion of better performance gets a +1 from me. 3. There are some great plugins for this already, so I vote no. 4. This seems like a huge API change. I'd wait and only do it for Lazer. 5. A rebase of code seems too timeconsuming and error-prone, maybe let this be a Lazer-only feature.
  14. WebGL Analytics

    Use Google Tag Manager perhaps. You can set up events in javascript such as: dataLayer.push({ event: 'canvas_loaded', load_time: '2867ms', label: 'whatever you want here etc.'}); These events you can add anywhere. You can even log all client-side javascript errors to see if your game have any fatal bugs.
  15. I use brackets as my IDE for it's flexibility, and automated Gulp-tasks for as many other tasks as possible like atlas-generation, image-compression, javascript bundling, localhosting etc. Visual studio is probably the way to go if you develop in typescript over javascript.