Jump to content

Santiago

Members
  • Content Count

    42
  • Joined

  • Last visited

Everything posted by Santiago

  1. Like Samme said, using spritesheet every frame must be the same size, what you want to do requires an atlas.
  2. Hello, I'm doing a fighting videogame and I'm using Arcade Physics. since it's not possible to use multiple bodies with Arcade I'm trying to figure out how to update the bodies of my charecter (for complex positions I'll use more than 1 body to make it) once a key is down and when is up go back to the idle body. One of the possibilities I had in count and I tryied witout success is checking the current frame animation and adding some new invisible sprites like collliders and destroying it after the next frame. The first problem I had with it is that working on Update function it creates m
  3. Hello, Title could sound weird, but idk very well how to express it. I'm working on a proyect that has an inicial player just with an arcade body, and I'm trying to add invisible sprites to adjust the movements with animations cause arcade allows just one body, and those sprites will be being added and destroyed constantly, so, for now I need to debug the body of those invisible sprites while programming, but I can't do it because those ones don't exist in the game at first, I tried some if clauses on render function but couldn't get it. create: function(){ this.vShape = new P
  4. I'm trying to find some free alternative to Physics Editor to set polygons to my sprites for a game I'm trying to implement P2 physics, and for now I can't afford what it cost (even my proyect doesn't have commercial pruporses), and the 30 days trial is useless for me. I found a program called Physics body editor here: https://www.aurelienribon.com/post/2011-10-physics-body-editor-2-0-ex-box2d-editor but the program is quite uncomfortable to use (doesn't matter, actually is unfinished) and polygons are very precise, using a lot of decimals, and I just need int values in the array. Do
  5. I can't get on working some animations to a group of enemies, and I can't solve it. I could do it with a spritesheet, but with an atlas seems not working here's the code: moveEnemies: function () { for (var i = 0; i < this.enemies.length; i++) { this.enemyChild = this.enemies.children[i]; if (this.enemyChild.body.touching.down) { if (this.enemyChild.body.x < (this.player.body.x - 40)) { this.enemyChild.body.velocity.x = 100; this.enemyChild.scale.x = 1;
  6. If is useful for someone, I'm posting the solution I found: this.player.events.onKilled.add(function(){ var death = this.game.add.sprite(this.player.body.x,this.player.body.y,'vikingoAnim'); //Here I add my animation death.animations.add('death', Phaser.Animation.generateFrameNames('death_', 1, 10), 7, false); //I put the animations.play in the die variable die = death.animations.play('muerte'); //Kill animation when completes die.killOnComplete
  7. I tried but seems to do nothing, it just stop for a moment the current animation (idle), but anything else, I don't know what else to do
  8. I've corrected my mistake in the last exists, but now it just disappear, and if I take out the if clause the behaviour is the same as recently, still there, existing. this.death= this.player.animations.add('death', Phaser.Animation.generateFrameNames('death_', 1, 10), 5, true); this.player.events.onKilled.add(function(){ this.player.exists = true; this.player.animations.play('death'); if(this.death.onComplete){ this.player.exists = false; } }, this)
  9. I'm doing this: this.death= this.player.animations.add('death', Phaser.Animation.generateFrameNames('death_', 1, 10), 5, true); this.player.events.onKilled.add(function(){ this.player.exists = true; this.player.animations.play('death'); if(this.death.onComplete){ this.player.exist = false; } }, this) Now the player still there, but the animation is not playing. I have corroborated that the animation is working, is there anything I'm doing wrong?
  10. Hello! I want to do a death animation but I can't get it, last thing I tried was using events, but I need some help here I was doing this on the create function: this.player.events.onKilled.add(function(){this.player.animations.play('death')}, this); But it seems to do nothing, would be because the sprite is already killed? I am killing the sprite by damage() method. I don't know what else to do! And I can't find anything useful on Google Hope you can help me out!
  11. I set the loop parameter to false and still replaying it, using isDown propertie, but with justDown (what I need), doesn't play it at all, still playing the idle (I think I didin't say this, I forgot it)
  12. Hello, today my problem looks so stupid, but I can't find a way to solve it. I have a couple of animations that I add using: this.player.animations.add('idle', Phaser.Animation.generateFrameNames('idle_',1,4), 6, true); this.player.animations.add('ataque', Phaser.Animation.generateFrameNames('ataque_',1,2), 10, true); this.player.animations.add('daño', Phaser.Animation.generateFrameNames('daño_',1,2), 5, true); this.player.animations.add('camina', Phaser.Animation.generateFrameNames('camina_',1,5), 10, true); this.player.animations.add('muerte', Phaser.Anima
  13. Hello, today my problem looks so stupid, but I can't find a way to solve it. I have a couple of animations that I add using: this.player.animations.add('idle', Phaser.Animation.generateFrameNames('idle_',1,4), 6, true); this.player.animations.add('ataque', Phaser.Animation.generateFrameNames('ataque_',1,2), 10, true); this.player.animations.add('daño', Phaser.Animation.generateFrameNames('daño_',1,2), 5, true); this.player.animations.add('camina', Phaser.Animation.generateFrameNames('camina_',1,5), 10, true); this.player.animations.add('muerte', Phaser.Anima
  14. That was the problem, I don't know how I've overlooked that, got to read better the API.- Thank you very much.-
  15. If I understand, you want to change the black background into transparent. In that case I'd use photoshop, is very easy to do it. I'd try first the background remover, setting the tolerance between 15-20% and 20 minutes (even less) of your time, you can clean all that black background.
  16. Perfect, I realise now that I had this.enemies.createMultiple in exists = false (4th parameter), but if I set it to true, it avoids my addEnemies function and the MoveEnemies function and only appear one enemy flying. So, if exists is set to false everything's fine, but this.enemies.setAll('health',100); doesn't work, but if set to to true, works but I get a rare behavior, I'm uploading pictures to understand. Also, here is my code updated, I tried to simplify useless things. create: function () { this.cursor = game.input.keyboard.createCursorKeys(); this.jump =
  17. I also could set my own health variable, not the phaser propertie and with a forEachAlive I killed the sprites, but kills all the group
  18. That's what I thought! But can't set the health, I mean, I tried to this.enemies.health = 100, same with this.enemy of my addEnemies function. I can't change the health value of overlappingPlayer in this case, how could I do it? I don't know what else to do! I know I'm annoying but this cost me a lot to learn, I even re-write al the code 3 times with same results, I always end up in the same result!
  19. Seems no one can help...
  20. moveEnemies: function(){ for(var i = 0; i < 1; i++){ if(this.enemies.children[i].body.x < (this.player.body.x - 40)) { this.enemies.children[i].body.velocity.x = 100; } else if(this.enemies.children[i].body.x > (this.player.body.x + 40)){ this.enemies.children[i].body.velocity.x = -100; } } }, This is the function I use for moving my enemies. I don't think what you are saying is happening because in that case the health of enemies would be at a multiple of the damage t
×
×
  • Create New...