Noaml1

Members
  • Content Count

    22
  • Joined

  • Last visited

About Noaml1

  • Rank
    Member

Contact Methods

  • Twitter
    noamlerner
  1. This helped a lot - knowing that cropping one effects everyone using the texture and knowing where 0,0 is placed at explained a lot. I seem to still be having issues though, if i set the x,y to something other than 0,0 like this: var currentHeart: Phaser.Image = this.heartFills[i][this.heartFills[i].length - 1]; var height: number = 55 * KillableInGame.players[i].hp / 1000; //56 is height of picture this.cropRects[i] = new Phaser.Rectangle(0,56-height,currentHeart.width,height); currentHeart.crop(null); currentHeart.crop(this.cropRects[i]);the image is cropped and moved and i dont understand why. Im trying to get it to drain from top to bottom.
  2. I have and that causes the image to just not be displayed...although no error is thrown haha - but then this would be a problem if i wanted to crop the left side anyway so idoubt that would be it. I noticed something with the phaser code that seems off to me though, the error is thrown here: if(frame.x + frame.width > this.baseTexture.width || frame.y + frame.height > this.baseTexture.height) { throw new Error('Texture Error: frame does not fit inside the base Texture dimensions ' + this); }but then, what if the x of the frame (which is the passed in rectangle) is say, 100 but the width of the texture is 50 Maybe im not correctly interpreting the variables but shouldnt it be if(frame.x + frame.width > this.baseTexture.width + this.baseTexture.x || frame.y + frame.height > this.baseTexture.height +this.baseTexture.y) { throw new Error('Texture Error: frame does not fit inside the base Texture dimensions ' + this); }?
  3. So i'm trying to crop an image and it isnt working - i keep getting Uncaught Error: Texture Error: frame does not fit inside the base Texture dimensions [object Object] But this isnt making sense to me because this is how making the rectangle: var currentHeart: Phaser.Image = this.heartFills[i][this.heartFills[i].length - 1]; this.cropRects[i] = new Phaser.Rectangle(currentHeart.x,currentHeart.y, currentHeart.width-10,currentHeart.height-10); currentHeart.crop(this.cropRects[i]); currentHeart.position.y = 56 - currentHeart.height;Literally telling it "just go 10 pixels smaller than the image itself in both directions". My end goal is to the x be currentHeart.x and my y be a fraction of the height based on the players health, but right now I can;t get it to crop and i dont understand why.
  4. Ok, thanks. Looks like we'll be making our own class to handle this.
  5. A friend and I are working on a platformer-fighting game using the Phaser framework and are wondering if there is anyway built in function to keep multiple sprites on the screen at the same time? We want it so that we can zoom in to the players if they are all next to each other but for the camera to zoom out if they separate (kinda like super smash bros melee).
  6. So i'm at a hackathon (btw quick responses appreciated because of this fact (´・ω・`) ) and my friend and i are dealing with a players die and respawn often. we know that when we want to add a sprite to the game from within a class that extends Phaser.Sprite we have to run the code: super(this.game, x, y, ResKeys.player2Sprit); this.game.add.existing(this); //<-----this is the line im referring toso we want to know if theres an opposite to this.game.add.existing where we can remove the sprite from game existence without killing the class, put it back into that state of limbo between the super() and add() calls.
  7. Thanks a lot rich! helps
  8. I think it sets the point which the 'body' of the sprite is centered - like, this is where the sprite will revolve around or this is what will be considered in things such as onFloor() or to check if its in the bounds. I'm trying to use it on a sword to a) make it stay with my character and appear in his hand b ) have a realistic fall - by this i mean, if it falls upright, i want it to slowly fall to its side...i realize that if i dont change the anchor, it floats in air and thinks its on the floor (it is much taller than it is wide)
  9. I kind of understand what it does, but i can't seem to utilize it.
  10. Found the documentation, realized angle is readonly. my bad
  11. I'm testing some things out with the phaser framework and one thing i can't figure out is angles. I'm currently trying to make a sword (see attached picture) go from upright to horizontal once it falls to the floor using angularAcceleration. First im trying to play with the angles themselves and understand how it works but no matter what i set the .angle equal to it, the picture stays the same orientation
  12. Wow that worked thanks! My game now runs the internet explorer issue is still there though, and yea im loading phaser.js
  13. Also, when i try to run in internet explorer i get this error: Unhandled exception at line 10, column 5 in http://localhost:16322/scripts/Main.js 0x800a1391 - Microsoft JScript runtime error: 'Phaser' is undefined
  14. i'm trying to follow the starstruck example in remake it in typescript and im getting an error i dont understand. This is what i have so far : create() { this.game.physics.startSystem(Phaser.Physics.ARCADE); this.game.stage.backgroundColor = '#000000'; this.bg = this.game.add.tileSprite(0, 0, 800, 600, 'background'); this.bg.fixedToCamera = true; this.map = this.game.add.tilemap('level1'); this.map.addTilesetImage('tiles-1'); this.map.setCollisionByExclusion([13, 14, 15, 16, 46, 47, 48, 49, 50, 51]); this.layer = this.map.createLayer('Tile Layer 1'); this.layer.resizeWorld(); this.game.physics.arcade.gravity.y = 250; this.player = this.game.add.sprite(32, 32, 'dude'); this.game.physics.enable(this.player, Phaser.Physics.ARCADE); this.player.body.bounc.y = 0.2; this.player.body.collideWorldBounds = true; this.player.body.setSize(20, 32, 5, 16); this.player.animations.add('left', [0, 1, 2, 3], 10, true); this.player.animations.add('turn', [4], 20, true); this.player.animations.add('right', [5, 6, 7, 8], 10, true); this.game.camera.follow(this.player); this.cursors = this.game.input.keyboard.createCursorKeys(); this.jumpbutton = this.game.input.keyboard.addKey(Phaser.Keyboard.SPACEBAR); } update() { this.game.physics.arcade.collide(this.player, this.layer); this.player.body.velocity.x = 0; if (this.cursors.right.isDown) { this.player.body.velocity.x = 150; this.player.animations.play('right'); } }everythings been loaded correctly in the preload method and im getting the error: Phaser v2.0.5 - Canvas - WebAudio http://phaser.io ♥♥♥ phaser.js:19908Uncaught TypeError: Cannot set property 'y' of undefined Main.ts:39Uncaught TypeError: Cannot read property 'right' of undefined Main.ts:58 the first error occurs in this area: this.game.physics.enable(this.player, Phaser.Physics.ARCADE); this.player.body.bounc.y = 0.2;the second here: this.player.body.velocity.x = 0; if (this.cursors.right.isDown) {what's happening?
  15. that did it! thanks