• Content Count

  • Joined

  • Last visited

About InsaneHero

  • Rank
    Advanced Member

Profile Information

  • Gender
    Not Telling

Recent Profile Visitors

1156 profile views
  1. @drhayes apologies! I didn't realise that it has been generating those error messages from internal layers. Rich has fixed that. In the meantime the current dev branch contains updated tile renderer which should now handle 'rotated' tiles (they're actually flipped and/or diagonally flipped but the effect is the same as a rotation!), and multiple tilesets/multiple layers. I've also added the screen shake functionality and layer resize is working... NOTE: at the moment in webgl mode you need to read the displayWidth/displayHeight properties to see what size it is set to... width/height as used by Canvas will only give you the map dimensions in pixels. This means that the resize example doesn't work properly as it is using width < 800 as a criteria for permitting changes.
  2. @PRSolucoes (sorry I can't easily create those glyphs on my keyboard, and copy/paste wanted to bring the whole text format with it!) - the new tile system does not affect your keyboard or mouse input at all. Perhaps Rich or another user might be able to help you with that problem. It is probable that other things changed as well for this release but I am only responsible for the webgl tile drawing
  3. @drhayes each layer needs a unique name, you are creating nine layers (5+4) and I'm guessing you're giving them all the same name, so you get 8 errors. Please let me know if the webgl errors continue after you change the naming (which can be as simple as just adding a number to the end of each layer name). It looks like this is original Phaser code, so I think you should have got the same error using the previous Canvas tilemaps... have you tried your game running in Canvas mode, and did it work with previous versions of Phaser?
  4. You say "when I move line have been broken" which I'm guessing refers to the way the beam fragments look when you move up and down on the screen? Sounds like you just need a single sprite with the lazer beam drawn in it. If you want it to 'grow' then you could mess with the width (or scale.x), or use masking. Another alternative is to keep a link between each beam fragment and the ship which fired them, and on every update set the beam y value to match the ship's y value.
  5. There are a great many complications with this sort of test, the most important being that browsers do all sorts of stuff behind the scenes... dynamic optimisations sometimes make code triple in speed after about 30-60 seconds of run time. In order to test drawing speed for Phaser 3 I've been building incredibly simple test beds, and feeding the graphics to webgl with as few pieces of code as possible. Even then I find that sometimes I can get 250K bunnies and on other days, with no apparent change in the environment, it will cap out at 175k (a more than 25% difference). Unfortunately the nature of Phaser (being a complex and comprehensive API) is that you cannot do "simple" tests with it. Even the most basic implementation of sprites-on-screen has a ton of support code related to handling all the many different graphic sources and purposes that the system might be used for. With this amount of code the browser performance becomes somewhat random (in my experience) and optimisation of your demo code is unlikely to gain true benefits across all browser types and for all circumstances. If you absolutely need the fastest performance, you really have to use a very low level API... of course that means you won't get all the benefits that Phaser provides and you'll have to spend a lot more time finding solutions to the problems raised. However, thanks #jmp909 for making this test... I'll be sure to include it into the tests for Phaser 3 because even with such erratic behavior, I can hope that the new renderer will be significantly faster (Note: any speed improvement will most likely come from the tighter bonding between the new renderer and Phaser 3, PIXI is already extremely well optimised for pure drawing power) EDIT: I just ran the demo, I think that environment (dynamic code editing) has a fairly heavy performance impact... pretty sure Rich warned me about that just a few days ago. Try it locally or on a clean web-page and see if there's a big difference (or at least a more consistent response).
  6. Yes that helped a lot, thanks For anyone else caught out by this odd requirement, hit the WAMP icon in the task bar and in the apache|apache modules menu, enable "headers_module" and "rewrite_module". They don't appear to be set by default when you install WAMPServer so this will hit anyone attempting to use the examples locally with that program. Thanks Skeptron!
  7. Ah, brilliant idea thanks Skeptron. It generated this error: Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator at to inform them of the time this error occurred, and the actions you performed just before this error. More information about this error may be available in the server error log. So I looked in the WAMP logs and the apache_error.log contains lots of this message: [Tue Jul 21 21:15:39.739149 2015] [core:alert] [pid 5152:tid 1500] [client] C:/wamp/www/phaser_examples/examples/.htaccess: Invalid command 'Header', perhaps misspelled or defined by a module not included in the server configuration So it looks like the problem is in .htaccess - which came from the repo. So now, last question (possibly!) ... how do I fix that? BTW .htaccess contains only these lines:Header set Access-Control-Allow-Origin "*" RewriteEngine OnRewriteBase /RewriteRule ^(.*)\.html$ /index.php [QSA,R=302,L]
  8. Have you checked to see if resetting the state actually calls Time.reset too? It may not (I can think of justifications for either choice) and that could be why totalElapsedSeconds didn't reset. Easy fix if that's the case, call game.time.reset() when you reset the state... I don't think you should need a timer for this, the global Time system should give you all you need. If you use native JS you'll end up having to deal with all the nasty corner cases that Phaser wraps for you... Like navigating away from the page which stops the RAF timer but let's continue to increment.
  9. Ok, in this new example you are creating a timer (Timer.js file) which works differently to querying the system time (Time.js accessed by game.time). The Timer.js constructor takes two parameters: game, autoDestroy and if autoDestroy is undefined it is set to 'true'. The comment says: "If true, the timer will automatically destroy itself after all the events have been dispatched" So I'm guessing your timer is stopping because either you didn't add any events, or all of the events were completed. The Timer.js header says: * A Timer is a way to create small re-usable (or disposable) objects that wait for a specific moment in time, * and then run the specified callbacks. Sorry this doesn't help you find the original problem but might help resolve some of the confusion
  10. It surely must... unless the code has been changed. The relevant code from Time.js is: /** * The number of seconds that have elapsed since the game was started. * * @method Phaser.Time#totalElapsedSeconds * @return {number} The number of seconds that have elapsed since the game was started. */ totalElapsedSeconds: function() { return (this.time - this._started) * 0.001; }, /** * Resets the private _started value to now and removes all currently running Timers. * * @method Phaser.Time#reset */ reset: function () { this._started = this.time; this.removeAll(); }So reset sets this._started equal to this.time, and totalElapsedSeconds() subtracts this._started from this._time. The result has to be zero unless something else has changed the value of this._started or this.time in between your calls.
  11. Not sure if this is relevant but in the comment header for BitmapText.js: * For most use cases it is recommended to use XML. If you wish to use JSON, the formatting should be equal to the result of * converting a valid XML file through the popular X2JS library. An online tool for conversion can be found here: Although Littera is one of the recommended tools so you would imagine the output format is correct.Have you tried on the current release version to see if you get the same results?
  12. To show an effect where your shuriken collided, you can create another sprite object at that location and just make it run until it's animation is finished then remove it. Particle systems are good for this type of effect and for that you create a new particle system at the collision point, remove the shuriken, then run the particle system for a short while before removing it. For your second problem, I'm not familiar with the .trace variable you are using but would suggest that the speed problem is there. You need to set the speed as a constant value regardless of how near the players are to each other, and modified only by the direction: // example only, 5 is probably not a good velocity! if (player.sprite.x > enemy.sprite.x) shuriken.body.velocity = 5; else shuriken.body.velocity = -5;
  13. In the file Time.js you can see the reset function (line 507) and all it does is set an internal private variable _started to be equal to the current time. When you use the time functions to know how much time has elapsed, it will subtract the value in _started from that value. I imagine it does it this way because it may not be possible to reset the actual system time value to zero on all devices. Looking a bit further, this.time is set in the boot function to so indeed, it is not possible to set it to zero because the Date is not zero. You can use game.time.totalElapsedSeconds() to get a Number that represents how many seconds the game has been running. After you call reset that will go back to zero because it uses _started. The value is floating point so although it's in seconds you can check for fractions of a second too.
  14. I think the image says it all but details are: - had this problem with my old examples local repo, so I killed it and grabbed a brand new one - there is an 'examples' folder which contains almost all the phaser examples - I want to open it using /examples/debug.php - the /examples folder doesn't show up in WAMPServer, although it is definitely on my local machine Any ideas how to make WAMP see the folder?
  15. "Is that so that developers of Phaser Framework didn't want to make an opportunity of changing images?" As I mentioned, I'm not entirely familiar with the whole system, but it's important to remember that you're dealing with two separate systems here: the Phaser framework is sitting on top of the Pixi drawing framework. Because of this certain unusual types of action require good knowledge of both systems. What you are trying to do (access a previously loaded image with a new key) is very unusual, and is almost certainly not something that the designers of either of these two systems intended you to do. Can I suggest that you'd probably get the result you want without trying to change keys? There are many ways to achieve your goal, but the most obvious one is to make a Dictionary of your own where each 'key' which an image was loaded with, is referenced by another key which you can rename as you please. I haven't tested this, so I'm not entirely sure that JS will let you use strings as array indices like this, but the language is ripe for abuse so it'll probably be ok: // creatingmyDictionary = [];// addingmyDictionary["whatever_I_want_to_call_it_now"] = originalImageKey;// accessingvar imageKey = myDictionary["whatever_I_want_to_call_it_now"];// now get the image from Phaser using imageKey which is the originalImageKey...Doing it this way, you can have several new keys with your own names, which all access the same originalImageKey.