• Content Count

  • Joined

  • Last visited

About cornstipated

  • Rank

Recent Profile Visitors

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

  1. cornstipated

    Dynamic zoom bounds?

    // update() <----- var cam = this.cameras.main; var min = (expression1); var max = (expression2); cam.setZoom(Phaser.Math.Clamp(cam.zoom, min, max));
  2. cornstipated

    Why are my sprites rendered badly on mobile browser?

    it has probably to do with devicePixelRatio . You can configure phaser to use a higher dpi by setting a value for 'resolution' in the game config or by using setResolution on specific gameobjects(like text) config = { resolution : window.devicePixelRatio } but it will warned that it can be very costly battery and performance wise.
  3. cornstipated

    Can't create image 2 conditionals in

    all the callbacks in phaser have an argument after the function that will be used as the scope ie gameobject.on(eventtype,callback,callbackscope) which could be gameobject.on('pointerdown',function(){},this) About your original question: it really doesnt ask what you want to achieve or how the code output differs from what you would expect and on top of that it is not self contained so it cant be executed to reproduce and see the problem (relies on things that are not visible in the snippet). That being said one potential problem I see is adding eventlisteners inside eventlistener callback and i doubt this is intentional. For example every time you drop something you will add an on pointerdown listener to clickbutton so the first time you drop it will have one but the second one it will have two and call the callback twice and so on. Also it is totally unnecessary to setinteractive there, you could just do it when you create the button.
  4. cornstipated

    How to modify gravity from user input? in the context of a scene.
  5. cornstipated

    Recommended approach in setting collision properties

    If you dont want to use indices there is another way setCollisionByProperty You'll have to add the property to the tile in Tiled
  6. cornstipated

    Update tween END value

    good god just create the tween when you know what value to tween to
  7. You can control roundpixels/antialiasing on a per texture basis by using sprite.texture.setFilter(filtermode) Phaser.Textures.FilterMode.LINEAR or Phaser.Textures.FilterMode.Nearest
  8. cornstipated

    Object Specific Event Handlers

    this.input.on('drop', function (pointer, gameObject, dropZone) { if(gameObject.myondrop) gameObject.myondrop(pointer,dropZone,whatever) });
  9. cornstipated

    How do I call a callback function when two objects stop overlapping?

    it is one way but it is so desperately dependant on phaser. Why not a simple check for distance in the npc update loop
  10. cornstipated

    How to replace arrow keys with wasd movement?

    this.cursors = this.input.keyboard.addKeys( {up:Phaser.Input.Keyboard.KeyCodes.W, down:Phaser.Input.Keyboard.KeyCodes.S, left:Phaser.Input.Keyboard.KeyCodes.A, right:Phaser.Input.Keyboard.KeyCodes.D});
  11. cornstipated

    Destroying a Blitter

    blitter.children.each(function(bob,context){bob.destroy()},this) is a way
  12. the code would definitely help but it might be something as simple as trying to use something you have not loaded yet. IE scene.js references player.js but player.js is loaded after scene.js (the order of the script elements matter)
  13. cornstipated

    Help understanding createContainer

    parent isnt created automatically. If there an element with id parent then createContainer flag will append a properly styled div to it and create the canvas in there. If parent has a bogus value then it will just default to the body element
  14. cornstipated

    Extending GameObjects?

    class MySprite extends Phaser.GameObjects.Sprite { constructor (scene, x, y,myExtra) { super(scene, x, y); this.myExtra = myExtra; this.setTexture('cachedtexturekey'); this.setPosition(x, y); } preload() { } create() { } preUpdate (time, delta) { // do stuff with this.myExtra } } Yes you can example above. Those 3 functions overload function of the baseclass GameObject that are called at various points of the object lifecycle. You could Also overload Sprite specific methods like preUpdate if you needed to. All and all it is just javascript and you can do what you want with it. The extended class istance can be pooled too
  15. cornstipated

    Rotating / changing angular velocity

    physicsenabledgameobject.body.angularVelocity = 100; positive for clockwise, body also has angularDrag for damping, both are in degrees per second