• Content Count

  • Joined

  • Last visited

  1. Wow, so simple! This worked! Basically what @samme said. Thanks a lot @michebn!!! Example of solved problem:
  2. @TboneXXIV If you wanna load it locally, just place it in the same folder as your index.html for a start and you can call it simply with the following line in your HTML file: <script type="text/javascript" src="phaser.min.js"></script> If it was in a subdirectory of where your index.html file is located, in the folder "scripts" lets say, you would call it like this from your HTML file: <script type="text/javascript" src="scripts/phaser.min.js"></script> Usually you call files relative to where your index.html is located, so if your file is in a subdirectory called scripts one folder above where your index.html is located, you would call it like this: <script type="text/javascript" src="../scripts/phaser.min.js"></script> ../ makes it go one folder up in the folder tree, starting from where your index.html is. So it doesn't really matter where you locate it, as long as set the relative path to it correctly. If that troubles you, your safest would be just locating it in the same folder as your index.html and call it like in the first example. Or you do it like syntaxidermy and call your file from an absolute path in form of an URL that points to the file hosted on a server, like this: <script src="//"></script> Hope that is of help, you can learn more about it here
  3. Thanks, I'll give that a shot. The duration is still at a fixed speed in your pen. Changing it to the duration variable exactly recreates my issue:
  4. Any hint how I could go about that? I'm really clueless to this problem as of right now. It would be of huge help. Would it be the same or similar solution to this thread you posted to? I found it by googling my problem but unfortunately I'm really stuck at the moment.
  5. Hi, I'm very new to game programming and Phaser and been sitting on this problem for days now. Any help or hint (or improvement to what I got so far) is greatly appreciated! What I wanna do: I basically want to create a "2D point and click physic". So far it works as excepted and perfectly fine if I set the tween duration to a fixed value, but that makes my sprite go faster the further you click away from it's current position: function create() { this.input.on('pointerdown', moveSprite, this); } function moveSprite (pointer) { var tween = this.tweens.add({ targets: player, x: pointer.x, onStart: function () { if (point.x < player.x) { player.flipX = true;'right', true); } else if (point.x > player.x) { player.flipX = false;'right', true); } }, duration: 500, onComplete: animStopCallback, onUpdate: tweenOnUpdate }); } I tried adding some math to the function which I found here, to have the movement speed of the character at same rate no matter the position and it works the way I want it: function moveSprite (pointer) { var distance = player.x - point.x; var speed = 200; var duration = (Math.sqrt(distance*distance) / speed) * 1000; var tween = this.tweens.add({ ... duration: duration, ... }); } But now the problem is, when the pointer event happens before the other one is finished it causes all kinds of weird glitches, making the character jump around. For example, I click 300 pixel to the right of the character, and while it's moving I click in between the way it's walking right now but it doesn't stop there where I clicked last, instead goes to the pointer.x position I clicked first. Apologies if my english is rather confusing. I'd be glad to serve more examples of what I mean or post screenshots if needed.