notalentgeek

Members
  • Content count

    50
  • Joined

  • Last visited

1 Follower

About notalentgeek

  • Rank
    Advanced Member
  • Birthday 01/29/1993

Contact Methods

  • Twitter
    notalentgeek

Profile Information

  • Gender
    Male
  • Location
    Enschede
  • Interests
    I want to make a small story based game studio.

Recent Profile Visitors

537 profile views
  1. How can I adjust `Phaser.Creature` height and width proportionally?

    I found a weird behavior.... dragon_character.play(true); // `true` is used for looping forever. dragon_character.scale.set(1); console.log("=========="); console.log("after setting up scale and before setting up width and height"); console.log("scale.x = " + dragon_character.scale.x); // `1`, which is expected. console.log("scale.y = " + dragon_character.scale.y); // `1`, which is expected. console.log("height = " + dragon_character.height); // `undefined`, which is expected. console.log("width = " + dragon_character.width); // `undefined`, which is expected. console.log("=========="); dragon_character.height = dragon_character.scale.y*100; dragon_character.width = dragon_character.scale.x*100; console.log("=========="); console.log("after setting up scale and after setting up width and height"); console.log("scale.x = " + dragon_character.scale.x); // `0`, which is NOT expected. console.log("scale.y = " + dragon_character.scale.y); // `4.138100158128295`, which is NOT expected. console.log("height = " + dragon_character.height); // `100`, which is expected. console.log("width = " + dragon_character.width); // `0`, which is expected, if the `scale.x` is indeed `0`. console.log("=========="); dragon_characters.push_with_limit(dragon_character); Here is my full codes: https://pastebin.com/fk5ZZ5e8.
  2. What is "no constructor" error? Details are inside.

    Yea, I just figure it out myself. But this does not explain why `Uncaught TypeError: PIXI.Point is not a constructor` error happened. Neither, there is no information in the documentation. Is there any JavaScript file that I should never import to the HTML file?
  3. I am currently learning Phaser by doing some examples. I am currently here: https://phaser.io/examples/v2/animation/creature-dragon-multiple. I am wondering, how can I set the height and width of `Phaser.Creature` object? The default `height` and `width` are set to undefined. Hence I need to set both height and width in order to set the `Phaser.Creature` dimension. Here are some codes. dragon_character.play(true); // `true` is used for looping forever. dragon_character.scale.set(20); dragon_character.height = 100; dragon_character.width = 100; console.log(dragon_character.height); // 100. console.log(dragon_character.width); // 100. Here are another codes. dragon_character.play(true); // `true` is used for looping forever. dragon_character.scale.set(20); dragon_character.height = 100; console.log(dragon_character.height); // 100. console.log(dragon_character.width); // Undefined. // Additionally the animation does not show up in the screen. If I only set either height or width, the `Phaser.Creature` will not show up in the screen. I don't know if there is no way to set height and let the width adjusted proportionally (vice-versa). Additionally, I could not found a way to get the height and width properties if the dimension is set with `Phaser.Creature.scale.set(25)`. To sum up, my questions: Is there any way to set either height or width and let the un-set properties to adjust in proportion? How can I know the `Phaser.Creature` height and width if it is set with `Phaser.Creature.scale.set()`?
  4. What is "no constructor" error? Details are inside.

    Finally, a respond. I have downloaded twice the library from `npm` the error still persists.
  5. Doing the multiple dragon example here: https://phaser.io/examples/v2/animation/creature-dragon-multiple. Is there anyway so that both dragon appear at the same time, but each starts its animation on different frame?
  6. What is "no constructor" error? Details are inside.

    Up please... someone knows about this issue?
  7. I am currently learning Phaser by doing examples. Got into the dragon creature example, I need to import additional add-ons for Phaser. I tried to import these JavaScript files. <script src="{{ node_modules_root }}/node_modules/phaser-ce/build/custom/phaser-minimum.js"></script> <script src="{{ node_modules_root }}/node_modules/phaser-ce/build/custom/phaser-no-physics.js"></script> <script src="{{ node_modules_root }}/node_modules/phaser-ce/build/custom/phaser-split.js"></script> <script src="{{ node_modules_root }}/node_modules/phaser-ce/build/custom/pixi.js"></script> These files are irrelevant for the dragon example. But, interesting error happened, `... is not a constructor`. For example `pixi.js:76 Uncaught TypeError: PIXI.Point is not a constructor`. The error happened when I imported the JavaScript file, even without any other JavaScript codes written. Why is that so? Can some explain what this error meant to me? And why the error happens by importing the JavaScript files? Example of the error. Uncaught TypeError: PIXI.Point is not a constructor at Phaser.Stage.PIXI.DisplayObject (pixi.js:76) at Phaser.Stage.PIXI.DisplayObjectContainer (pixi.js:904) at new Phaser.Stage (phaser-split.js:9193) at Phaser.Game.boot (phaser-split.js:13780) at Phaser.Device._readyCheck (phaser-split.js:40872)
  8. Creature Dragon example is not working.

    Solved. From the most recent Phaser version, I need to import these .js files. <script src="{{ node_modules_root }}/node_modules/phaser-ce/build/phaser.js"></script> <script src="{{ node_modules_root }}/node_modules/phaser-ce/build/custom/creature.js"></script> <script src="{{ node_modules_root }}/node_modules/phaser-ce/build/custom/p2.js"></script> <script src="{{ node_modules_root }}/node_modules/phaser-ce/build/custom/phaser-arcade-physics.js"></script> <script src="{{ node_modules_root }}/node_modules/phaser-ce/build/custom/phaser-creature.js"></script> <script src="{{ node_modules_root }}/node_modules/phaser-ce/src/animation/creature/CreatureMeshBone.js"></script> Hence, I think the documentation here: https://photonstorm.github.io/phaser-ce/Phaser.Creature.html is not valid anymore. It says that I need to compile my own version of Phaser with `Creature` included. Whereas `Creature` is now implemented by default.
  9. Creature Dragon example is not working.

    The main.html file. <!doctype html> <html> <head> <meta charset="utf-8" /> <link href="{{ root }}/app.css" rel="stylesheet" type="text/css"> </head> <body> <div class="flex-basic flex-row"> <div class="flex-1"></div> <div class="flex-basic flex-column"> <div class="flex-1"></div> <div id="phaser"></div> <div class="flex-1"></div> </div> <div class="flex-1"></div> </div> <script src="{{ node_modules_root }}/node_modules/phaser-ce/build/phaser.js"></script> <script src="{{ node_modules_root }}/node_modules/phaser-ce/build/custom/creature.js"></script> <script src="{{ node_modules_root }}/node_modules/phaser-ce/build/custom/p2.js"></script> <script src="{{ node_modules_root }}/node_modules/phaser-ce/build/custom/phaser-arcade-physics.js"></script> <script src="{{ node_modules_root }}/node_modules/phaser-ce/build/custom/phaser-creature.js"></script> <script src="{{ node_modules_root }}/node_modules/phaser-ce/build/custom/phaser-minimum.js"></script> <script src="{{ node_modules_root }}/node_modules/phaser-ce/build/custom/phaser-no-physics.js"></script> <script src="{{ node_modules_root }}/node_modules/phaser-ce/build/custom/phaser-split.js"></script> <script src="{{ node_modules_root }}/node_modules/phaser-ce/build/custom/pixi.js"></script> <script src="{{ root }}/bunch_of_functions.js"></script> <script src="{{ root }}/decorators.js"></script> <script src="./app.js"></script> </body> </html> The app.js. var game = new Phaser.Game(800, 600, Phaser.WEBGL, 'phaser-example', { preload: preload, create: create }); function preload() { game.load.image('sky', 'assets/background.png'); game.load.image('dragonTexture', 'assets/dragon_character_texture.png'); game.load.json('dragonMesh', 'assets/dragon_character_mesh.json'); } var dragon = null; function create() { game.add.image(0, 0, 'sky'); dragon = game.add.creature(450, 350, 'dragonTexture', 'dragonMesh'); dragon.scale.set(25.0); dragon.play(true); // true = loop } Error: pixi.js:76 Uncaught TypeError: PIXI.Point is not a constructor at Phaser.Stage.PIXI.DisplayObject (pixi.js:76) at Phaser.Stage.PIXI.DisplayObjectContainer (pixi.js:904) at new Phaser.Stage (phaser-split.js:9193) at Phaser.Game.boot (phaser-split.js:13780) at Phaser.Device._readyCheck (phaser-split.js:40872)
  10. Found the solution, `Object.keys(sprite.animations._anims)`. The codes return a list of string.
  11. Let say, with `sprite.animations.add("run");` I add an animation to an AnimationManager object. How can I see what animations are already there? Looking through, it is actually in `sprite.animations._anims` but it is listed as an object that cannot be read systematically (for example, `sprite.animations._anims[0]`).
  12. Why my `phaser_game` is `undefined` here?

    It is in `preload()` regardless I have solved this problem. It seems, it was misunderstanding from my part.
  13. Why my `phaser_game` is `undefined` here?

    This is ain't good I am moving back to vanilla JS XD.