Jump to content

goide

Members
  • Posts

    55
  • Joined

  • Last visited

Profile Information

  • Gender
    Male
  • Location
    Colombia

Contact Methods

  • Twitter
    goide

goide's Achievements

Newbie

Newbie (1/14)

1

Reputation

  1. Many thanks brother, if you ran the code that describistes me, thanks.
  2. Watch the video, if I miss these lines of code, the bullet starts from zero. What this does is update the bullet pocision, where is the enemy. look: https://db.tt/BMdB0BL8
  3. This is my result. Otherwise, only the last enemy shoots screen, the above does not fire. My class game.Disparar. game.createClass('Disparar', { init: function(){ this.bodyBala = new game.Body(); this.bodyBala.collisionGroup = 5; this.bodyBala.velocity.set(10,10); this.bodyBala.collideAgainst = [0,3]; for(var i=0; i<game.scene.enemigosRazo.length; i++){ this.bodyBala.position.set(game.scene.enemigosRazo[i].sprite.position.x, game.scene.enemigosRazo[i].sprite.position.y); } this.bodyBala.collide = this.colisionBarricada.bind(this); this.bala = new game.Sprite('bala.png'); this.bala.anchorCenter(); this.bala.addTo(game.scene.contenedor); var shape = new game.Circle(this.bala.width, this.bala.height); this.bodyBala.addShape(shape); this.bodyBala.addTo(game.scene.world); }, removeBala: function(){ this.bodyBala.remove(); this.bala.remove(); game.scene.removeObject(this); }, update: function(){ this.bala.position.copy(this.bodyBala.position);//Update position bullet } });You speak Spanish?
  4. My Code. Class EnemigoRazo game.createClass('EnemigoRazo',{ vida: true, init:function(x,y){ this.cuerpoEnemigo = new game.Body(); this.cuerpoEnemigo.collisionGroup = 7; this.cuerpoEnemigo.position.set(x,y); this.cuerpoEnemigo.collideAgainst = [0]; this.sprite = new game.Sprite('enemigo.png'); this.sprite.anchorCenter(); this.sprite.position.set(x,y); this.sprite.visible = false; this.sprite.addTo(game.scene.contenedor); this.animateSprite = new game.Animation([ 'enemigo/enemigoRun-0.png', 'enemigo/enemigoRun-1.png', 'enemigo/enemigoRun-2.png', 'enemigo/enemigoRun-3.png', 'enemigo/enemigoRun-4.png', 'enemigo/enemigoRun-6.png', 'enemigo/enemigoRun-7.png', 'enemigo/enemigoRun-8.png', 'enemigo/enemigoRun-9.png' ]); this.animateSprite.addAnim('correr',[0,1,2,3,4,3,2,1,0,5,6,7,8,7,6,5,0],{speed:7}); this.animateSprite.width = 40; this.animateSprite.height = 19; this.animateSprite.anchorCenter(); this.animateSprite.position.set(x,y); this.animateSprite.addTo(game.scene.contenedor); this.animateSprite.play('correr'); var shape = new game.Rectangle(this.sprite.width,this.sprite.height); this.cuerpoEnemigo.addShape(shape); this.cuerpoEnemigo.addTo(game.scene.world); this.enemigoCorriendo(); game.scene.addTimer(400, this.disparaEnemigo.bind(this), true); }, enemigoCorriendo: function(){ game.scene.balaBuscaSoldado(this.cuerpoEnemigo,game.scene.sprite,20,0); }, removeAnimation: function(){ this.animateSprite.remove(); }, disparaEnemigo: function(){ this.balas = new game.Disparar(); this.balas.rotation = game.scene.balaBuscaSoldado(this.balas.bodyBala,game.scene.sprite,300,0);//The bullet seeking the position of my hero. }, update: function(){ this.animateSprite.position.copy(this.cuerpoEnemigo.position); this.sprite.position.copy(this.cuerpoEnemigo.position); } });This is my enemy class and this works, as you see in the video.
  5. Try as you explained to me. My enemy class, add the eBullet method, and this method has a timer calls. Ok, my main.js file and call the class enemy as you indicate me in your example. look at the video, I still have the same result. when an enemy is added, the previous stop shooting. Video: https://db.tt/xlo4Xlyq
  6. goide

    Rotation Animation

    yes, I resolved, and if that was my mistake, that by the method call in the wrong place. Thanks for everything, for your help.
  7. goide

    Rotation Animation

    Thank you very much for your answer, but look and achieve my goal. look this is my function, is the angle of my two objects, and my mistake was that it was not updated each positioned himself as the animation was moving. anguloEntre: function(source, target){ var dx = target.x - source.x; var dy = target.y - source.y; return Math.atan2(dy, dx); }
  8. goide

    Rotation Animation

    I need to make an object of class animation(game.Animation) rotate and point where my hero.
  9. A question. I need to rotate an animation, in the direction of another object. Create a method that allows me to do this. but for a sprite, but when I try to type an object animation, but does not rotate. watch the video, which have two methods, which are angles to me to turn my animation, you work to perfection and the other not. Video: https://db.tt/f01HXSmj Look how the sprite with the same angle, pointing to my hero. and when I use the animation with the same angle and not pointing to it. and when I change the method by spinning according to the pointer, rotating smoothly. the animation changes its angle to the method I use for the angle of the pointer, but the method if it works, to change the angle for the sprite. but to change the angle of the animation is not working. why?
  10. Yes, I thought that, that every time a new enemy called, acts as if you were creating a new object, and returns and calls the two methods. why not keep shooting the former enemy. I thought of all the enemy build through an array and cross it with a for loop. instead of using the timer. Can you help me how to build what you're saying.
  11. The problem is as described in the following video. https://db.tt/NAvsrdVD I have two timers, one to generate a new enemy. and the other to generate the shot. this.addTimer(3000, this.addEnemy.bind(this), true); //Call method for generate enemysthis.agregarEnemigo(); //update rotation angle for enemythis.addTimer(400, this.eBullets.bind(this), true);addEnemy: function(){ this.enemigo = new game.Enemigo(game.width.random(), game.height.random()); //call class enemy}eBullets: function(){ if(this.enemigo.life === true){ this.enemigo.Shoot(); } }This is my code to work as this in the video. The goal is to generate enemies and shoot them my hero. So far the problem that I have is that when you build the next enemy. the former enemy stops shooting. And I want to shoot the enemies simultaneously.
  12. I uploaded my game to a server, and the browser on my laptop see the game, income from the iphone and I see nothing. As I set to work on my iphone? Thanks.
  13. Camera issue. https://github.com/ekelokorpi/panda.js-engine/issues I think that is not working properly at all at the moment.
×
×
  • Create New...