Yehuda Katz

  • Content count

  • Joined

  • Last visited

1 Follower

About Yehuda Katz

  • Rank
    Advanced Member

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Yehuda Katz

    emitter with particles gathering in one point

    This forums seems to be useless... you can find solution in sources codes of Phaser faster than here
  2. Yehuda Katz

    the onInputDown of sprite in a state didn't work

    @JohnXu sure give a try to second version, I am using v2.6.2 for almost a year. It has bugs but I will never change it because I have no idea what new bugs are waiting me in new version 😃 BTW the only reason sprite may not get input is another sprite over it. Are you sure that you do not have any overlapping/transparent objects over that text sprite? Try to remove all code except the one which generates that sprite and then give a shot. To be sure that nothing else is interrupting main code.
  3. Yehuda Katz

    the onInputDown of sprite in a state didn't work

    @JohnXu then I assume you are using Phaser3, am I right? If that's true then it could be some bug, but lets debug it step by step. Please try this: () { console.log('general tap'); }, this); Lets be sure that we are able to accept taps and there is no issues with input itself (as you can set how many pointers should be tracked by Phaser and bla bla bla)
  4. Yehuda Katz

    the onInputDown of sprite in a state didn't work

    @JohnXu could you please clarify, when you tap on textSprite, can you see console log message? () { console.log('tap dispatched') }, this) If you cannot see log message, can you see text sprite itself on screen?
  5. Yehuda Katz

    the onInputDown of sprite in a state didn't work

    @JohnXu you set InputDown event correctly. Take in an account your comment, the console.log() event is also handled successfully. So the problem seems to be with game state change. Could you please show how do you do it? game.state.add('new_stage', NewStage);'new_stage', true, false, some_custom_var); Please try to refer to game object via instead of just game Waiting for your reply
  6. I have seen in games emitter with coin particles which after certain time gather at some point (user panel showing total coins). I do believe it should be done with emitter. Yesterday I did research and found that emitter has particle class but I do not want reinvent the wheel. Could anyone share how this trick could be done in Phaser? Thanks
  7. Yehuda Katz

    Custom font works oddly with game.add.text

    I faced problem like you and did not like solution to wait for N seconds or wait for user input, here is 100% working and proper solution: var on_device_ready = function() { // var font_calibri = new FontFaceObserver('Calibri'); Promise.all([font_calibri.load()]).then(function () { game = new Phaser.Game(...) ... }); } window.onload = on_device_ready; Within your index.html file you should add <style> @font-face { font-family: 'Calibri'; src: url('assets/font/Calibri-Bold.woff') format('woff'), url('assets/font/Calibri-Bold.ttf') format('truetype'); font-weight: bold; font-style: normal; } </style> It may take some time before you can do everything correctly but I used this method on thousands of old/new mobiles and it works fine
  8. Yehuda Katz

    complete tween right away

    Hello, Imagine the scenario when we animate object (scale) during 3 sec. Animation is awesome but if user interacted with game, we need to complete animation right away and start new. Is there any way to force tween to complete? Currently I am doing following this.progress_tween.stop(); for (var key in[key] =[key]; this.progress_tween.onComplete.dispatch(); Thanks in advance
  9. Yehuda Katz

    How to cache Texture or BitmapData

    Hello, Can anyone share information how can I do manual caching of sprite or speed up rendering in general? If I have group with lots of small sprites, it's wise to convert it into single BitmapData and use it as texture to prevent recalculations. However, I have no clue how can I do that and what other methods Phaser may offer. Thanks everyone in advance for help
  10. Yehuda Katz

    proper loading in progress

    @samme you may ignore my previous post. I tried it in my app and it's not as smooth as it looks. You should not only put code within chunks but also wait for the whole queue to be completed, before you can execute the main code. It's just like loading content before starting the stage in Phaser. How Phaser manages to show loading screen before anything? When I added Phaser's native loading code and then execute my heavy code, Phaser still managed to display loading screen first! How can I do the same? If I can do the same then I can cover screen with membrane so user knows that button was clicked, input was accepted by app and user needs to wait 1-2 sec. Thanks
  11. Yehuda Katz

    proper loading in progress

    @samme basically you solved problem with calling each chunk with certain delay by using update() method. The only problem is, how to split work into chunks. Such code will be very difficult to debug or analyse. Of course any stage generation would have loops which theoretically could be exported to such update() method... but those loops should be executed in certain order. The second loop cannot start until first one is not finished... and what if there are dozens of loops. I am thinking to create some kind of queue where each chunk of loop is submitted as anonymous function. So old style code: for (var i in my_custom_buttons) { // create images, assign events etc } should be converted into something like create() { var queue = []; for (var i in my_custom_buttons) { queue.push(function() { // create images, assign events etc }) } } update() { queue.splice(0, 1)[0](); } as for queue, in update method we can do queue.pop() and execute given chunk of the code. What do you think?
  12. Yehuda Katz

    proper loading in progress

    Awesome @samme I have to try this logic with my code. Looks very promising!
  13. Yehuda Katz

    proper loading in progress

    p.s. btw @samme the game.updateRender is working in the way that update method of the stage is called but it does not update canvas itself.
  14. Yehuda Katz

    proper loading in progress

    @samme thanks, I tried to call both those methods within while loop but it did not help. I also came to the same conclusion yesterday regarding splitting job into chunks and executing them with 10ms delay, so Phaser will have time to update the canvas. What do you think about idea to convert function into string then pass it to function which will split it into chunks and executes them with 10ms delay each? Or may be there is some easier way to stop execution to tell system do jobs in other queues for 10ms? I even tried but without much success + Safari did not implemented it yet
  15. Yehuda Katz

    proper loading in progress

    So seems like Phaser stops rendering once CPU is in use (even in parallel thread): var sprite = this.add.sprite(100, 100, 'loading');{x: 1.5, y: 1.5}, 500, Phaser.Easing.Linear.None, true, 0, -1, true); setTimeout(function() { var time_now = (new Date()).getTime(); while ((new Date()).getTime() - time_now < 2000) {} }, 3000); This example demonstrates how animation works fine after stage is created but once while loop starts in 3 second, the tween animation freezes. Is there any way to force Phaser redraw stage? I can add that code in between lines which generate stage.