Popular Content

Showing content with the highest reputation on 10/07/13 in all areas

  1. 1 point

    Game.input.onDown question

    I know, am preparing an example for you (no ETA yet, sorry, but it will be part of the 1.0.7 update)
  2. 1 point

    Error in Sprite.crop

    While using Sprite.crop I noticed that changing crop.width doesn't always work. For example, the following code won't have any effect: var sprite = game.add.sprite(0, 0, 'someSprite');sprite.crop = new Phaser.Rectangle(0, 0, sprite.width, sprite.height);sprite.crop.width = v; // some value vNow the following code will work without problem: var sprite = game.add.sprite(0, 0, 'someSprite');sprite.crop = new Phaser.Rectangle(0, 0, sprite.width, sprite.height);sprite.crop = sprite.crop; // adding this line fixes the problemsprite.crop.width = v; // some value vThe problem is inside crop's "set" function: set: function (value) { if (value instanceof Phaser.Rectangle) { if (this._cropUUID == null) { this._cropUUID = this.game.rnd.uuid(); PIXI.TextureCache[this._cropUUID] = new PIXI.Texture( PIXI.BaseTextureCache[this.key], { x: value.x, y: value.y, width: value.width, height: value.height } ); } else { PIXI.TextureCache[this._cropUUID].frame = value; } this._cropRect = value; this.setTexture(PIXI.TextureCache[this._cropUUID]); }}The first time we set a crop rectangle R, sprite._cropRect is assigned R but in PIXI texture cache we actually create a new frame instance. So if we set sprite.crop.width we do change the width of _cropRect but not the width of the texture's frame.
  3. 1 point

    Problem with multiline text

    OK.. I worked it out myself.. using instead of \nseems to work, I guess its because its being pulled from an XML file the encoding is different.
  4. 1 point

    Captain Rogers - Defense of Karmax-3

    I don't think I've really seen this graphic style much before, it looks great.
  5. 1 point

    What's your favourite text editor/IDE ?

    I use vim mostly. If I have to use another editor, I use vim keybindings wherever possible.
  6. 1 point

    Collision between objects

    What you're doing is perfectly reasonable with a small number of objects, but when you have more objects doing all those tests isn't really an option. One way to deal with it, is to store references to your objects in a quadtree. Depending on the number, size and distribution of your objects, it may or may not be a better idea to have a broadphase collision pass. To put it simply, maintain two sorted lists of your objects (one sorted according their X coordinate, the other sorted by Y), which will then help you select potential colliders without going through the whole list of objects. However, while this approach is simple in principle, its implementation can be really tricky, because updating the lists is slow, and you have to use a few tricks to do that efficiently. Still, that's what many physics engines do.
  7. 1 point

    Howto setup Phaser in FlashDevelop

    Well, it actually gives you what it says. A typed script language. And therefore, all advantages a (strong) typed language has over weak/loose typed. This includes for example: early error catching during compile process preventing of logic errors (e.g. you are always safe which type of var you proccess) better support in IDEs possible, e.g.: refactoring intellisense ... ...