Jump to content

liakos1992

Members
  • Content Count

    30
  • Joined

  • Last visited

About liakos1992

  • Rank
    Advanced Member

Recent Profile Visitors

1091 profile views
  1. This code allows you to zoom out, then center the camera to a desired point. var zoomFactor = 0.5; var cameraFocusX = 100; var cameraFocusY = 200; game.world.scale.setTo(zoomFactor); game.camera.focusOnXY(cameraFocusX * game.world.scale.x, cameraFocuzY * game.world.scale.y); If you want to zoom out from the center, set var cameraFocusX = game.world.width / 2; var cameraFocusY = game.world.height / 2; EDIT: Have in mind that after you zoom in/out (scale up/down the world), sprite.collideWorldBounds = true; will not work correctly. Also, if you want to get mouse X, Y c
  2. What is this language? I'm just using simple javascript. The "while (true)" is there to show a simple example where we construct "infinite" tweens. If the "game.add.tween" function ONLY returns a tween, then the code doesn't leak memory. If the function not only returns a tween, but also generates data and place it to somewhere else, then it does leak memory. I run the above example handreds of times per second, and when I scan the memory via chrome profile tools I get the same amount of memory usage, which means that memory is not leaked, but I need to make sure. (I am not sure
  3. Does this code leak memory? var sprite = game.add.sprite(0, 0, "texture"); var tween = null; while (true) { tween = game.add.tween(sprite).to({x: X, y: Y}, 1000, null, true); }
  4. Nice idea, but this works only when game.scale.fullScreenScaleMode = Phaser.ScaleManager.EXACT_FIT; . I need to use: scale.fullScreenScaleMode = Phaser.ScaleManager.SHOW_ALL; then black areas appear at the edge of the screen because the game scales up with the same width/height factor, and "vw" and "vh" calculate black areas too, so the elements scale more
  5. I had to mention it, mattstyles. I am using nwjs.io. It is a tool that converts your javascript project into a binary .exe file, so the non-fullscreen window has 800x600 dimensions, so there is a big difference between the windowed and fullscreen mode. Because of that, I can't host the project on a server. By fixing the "zebra.min.js" I mean changing the code inside. It will be hard because their community is too small and I can't find anything about that problem
  6. I want to create a game that can go fullscreen and back to normal via options. The problem is that along with the game sprites, I want the html elements to be scaled up too. I need the html elements to create a hud/ui for my game. I have found some solutions but none is perfect. I can use the phaser buttons and texts so they can scale up too, but I also need input, scroll elements and checkboxes. Checkboxes are easy to make with phaser. Scrolls are a little harder and creating inputs seems completely impossible. Because I also need a pointer/cursor while writing inside the input, and t
  7. Nice. Used game.state.preRender = function() { // my code here } inside the "create()" function and it's working fine.
  8. I want to combine phaser arcade physics with some custom physics of my own. But it seems that objects with velocity are playing 1 tick ahead of objects whose x and y properties are changed in the update function (like "sprite.x += 10;"). What I need is to render the game AFTER the update loop. Is there any way to do this? I've been searching this for weeks and haven't found anything yet.
  9. I want to render the game after update() for various reasons
  10. When changing a sprite's x and y in the update loop, the new position will not show until the next update(). This way, when I attach a health bar on a unit with velocity, while the unit is moving the health bar will always be behind that unit. How can I have the rendering to be done AFTER the "update()" loop?
  11. thank you. do you know how i can render everything AFTER the update loop? changes at x, y will not be seen until the next "update()"
  12. By default, the desiredFps is 60, so the delta time (physicsElapsedMS) is 16.66 ms. Each 16.66 ms phaser update sprites based on velocity, gravity and other things with a function. How to capture this physics update function or implement a callback there? I want to try to make a custom physics system
  13. If you are confused about how each client can control each character I will show you some code structure. var serverWorldData = null;tryingConnectingToServer(function(serverData) { serverWorldData = serverData; startPhaserGame(); // game = new Phaser.Game( ... ) .. });function preload() {}function create() { buildWorldBasedOnServerData(serverWorldData); loginToServerWithNameAndPassword();}function update() { clientUpdateYourGame();}- FIrst you connect to server ("tryingConnectingToServer"). Start the phaser game after you connect, if you want the starting world to be based on so
×
×
  • Create New...