Jump to content


  • Content Count

  • Joined

  • Last visited

About ldd

  • Rank
    Advanced Member

Profile Information

  • Location

Recent Profile Visitors

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

  1. I made a game in a week for a game jam with Phaser 3 and React: itch.io's page: https://ldd.itch.io/re-wand Youtube let's play (not by me):
  2. You should post on the new forums: https://phaser.discourse.group As for your question, I'd guess playing with `scene.start()` and `scene.sendToBack()` should work. Anyways, please use the new forum. Thanks!
  3. You are making the right type of mistakes! (which is good) try this: let fn = ()=>false; console.log( fn == true && true, fn && true); a function is truthy, but when compared to true with ==, it will return false. This seems voodo magic until you read the specs[0][1] ps: there is a difference between fn, and fn(), just like in your example. You'd need `condition(count)` to make it work [0] http://www.ecma-international.org/ecma-262/5.1/#sec-11.9.3 [1] http://www.ecma-international.org/ecma-262/5.1/#sec-11.8.5
  4. Adding a parameter where needed[0]: function preload() {...} function create() { ... fun1(this.game, a, b, etc) } function update() { ... fun2(this.game, a, b, etc); fun3(this.game, a, b, etc) } function fun1(game, etc) {...} function fun2(game, etc) {...} function fun3(game, etc) {...} module.exports = { // Calling this file as state object later preload, create, update } Or using IIFE var App = (function(api, game){ api.game = game; function preload() {...} function create() { /* use api.game to access game instead of this.game */ /* read the docs, an
  5. Does this example help? https://phaser.io/examples/v2/input/drag If not, there are other examples here: https://phaser.io/examples/v2/category/input Otherwise, I think trying to list the things you want to accomplish would help. I'd guess you want to do something like 1) click on structure 2) drag structure to map 3) leave structure in map Most of that is just a combination of the tutorials that I linked, so hopefully you figure it out
  6. const addOnce = (keyString, self) => { const key = game.input.keyboard.addKey(Phaser.Keyboard[keyString]); key.onDown.addOnce(self.start, self); } or maybe even const addKeys = (keyStrings, self) => { keyStrings.forEach( (keyString) => { const key = game.input.keyboard.addKey(Phaser.Keyboard[keyString]); key.onDown.addOnce(self.start, self); }); } //usage addKeys(['W','A','S','D'], something);
  7. I think they meant const add = (list, item) => list.concat(item) //example add([3,4],5) //output is [3,4,5] otherwise you have a function that returns a function and you'd use it like so: const add = list => item => list.concat(item) //example add([3,4])(5) //output is [3,4,5] (keep in mind that in functional programming you'd rather use `concat` rather than `push` )
  8. Couple of quick pointers: 1) Avoid using function names that closely match reserved words or already existing native code. Array.prototype.forEach already exists, so avoid names like 'forEach' 2) is_exist sounds weird, and can be simplified: const is_defined = (obj) => obj !== undefined just keep in mind that there are better check than this, and consider cases like when obj is null, etc (be careful when doing comparisons and read on the topic) 3) you are trying to use a method that can be accessed by each individual item in an array. If it
  9. from my experience, and plenty of other people's experience, it is 'bullets against bullets' that is causing your problems. If you can, disable that type of collision. If you absolutely must have bullets against bullets or other things, consider making less collisions anyways (maybe bullets only collide before 1 second has passed away, or only if your level is high, etc) In general, avoid collisions as much as you possibly can.
  10. Phaser examples are in another repository, away from the main phaser project. https://github.com/photonstorm/phaser-examples Just clone and download that repo ;D
  11. ldd

    AsterWaster Game

    Interesting idea! Some comments: - It should be "Let's Battle". Spellcheck your game. - your UI needs a lot of work
  12. per the documentation: new Phaser.Image(game, x, y, key, frame) so you are missing an argument to specify the frame ps: why is this forum using a rich text editor and not markdown? +.+
  13. var myArray = []; function doStuff(arr){ for (var i=0; i< 3; i++){ arr[i] = function(){ console.log(i); } } } doStuff(myArray); myArray[0](); //3 myArray[1](); //3 //fix with ES6 let function doStuffImproved(arr){ for(let k=0;k < 3; k++){ arr[k] = function(){ console.log(k); } } } doStuffImproved(myArray); myArray[0](); //0 myArray[1](); //1 //fix with forEach function doStuffOther(arr){ return arr.forEach(function(el,l){ console.log(l); } } doStuffOther(myArray); myArray[0](); //0 myArray[1](); //1 //fix with closure //etc You need to le
  14. physics are opt-in, not opt-out. If you do not need physics, just don't use them. On the other hand, aer you asking about disabling physics AFTER enabling them before?
  15. is this still under active development?
  • Create New...