public Personaje(SpriteBatch spritebatch_, Vector2 posicion_, Texture2D textura_) : base(posicion_, textura_) { SpriteBatch = spritebatch_; animIdle = new Animation("idle", 10, 2, 1, true, Posicion); animJump = new Animation("jump", 1, 1, 1, true, Posicion); animWalk = new Animation("walk", .1f, 6, 1, true, Posicion); flash = new Animation("flash", 1, 2, 1, true, Vector2.Zero); plus25HP = new Animation("plus25HP", 50, 15, 1, false, Vector2.Zero); currentAnim = animIdle; estado_ = Estado.Idle; arma = new Arma(Posicion); }
public Moneda(SpriteBatch spritebatch_, Vector2 posicion_, Texture2D textura_) : base(posicion_, textura_) { SpriteBatch = spritebatch_; Textura = textura_; Posicion = posicion_; animMoneda = new Animation("animMoneda", .1f, 10, 1, true, Posicion); //soundMoneda = Juego.content.Load<SoundEffect>("Audio/soundMoneda"); posicionA = (int)Posicion.Y - 50; posicionB = (int)Posicion.Y + 50; arriba = true; recolectado = false; }
public Enemigo(SpriteBatch spritebatch_, Vector2 posicion_, Texture2D textura_) : base(posicion_, textura_) { SpriteBatch = spritebatch_; this.Textura = textura_; this.Posicion = posicion_; estado_ = Estado.Idle; detectado = false; //soundDetectado = Juego.content.Load<SoundEffect>("Audio/soundDetectado"); signoDetectado = Juego.content.Load<Texture2D>("signoDetectado"); animIdle = new Animation("idle", 10, 2, 1, true, Posicion); animJump = new Animation("jump", 1, 1, 1, true, Posicion); animWalk = new Animation("walk", .1f, 6, 1, true, Posicion); currentAnim = animIdle; posicionSigno = new Vector2(Posicion.X + currentAnim.anchoFrame / 2 - signoDetectado.Width / 2, Posicion.Y - signoDetectado.Height); setDificultad(); }
private void ActualizarEstado() { if (TocaSuelo() && Velocidad == Vector2.Zero)//si toca suelo y no se mueve esta Idle { estado_ = Estado.Idle; currentAnim = animIdle; } else if (TocaSuelo() && Velocidad.Y ==0 && Velocidad.X != 0)//si toca suelo y solo se mueve en X esta caminando { estado_ = Estado.Caminando; currentAnim = animWalk; } else if (!TocaSuelo()) //si Y tiene velocidad esta en el aire=saltando { estado_ = Estado.Saltando; currentAnim = animJump; } }
public static Vector2 pickUpAnim(Vector2 pos, Animation anim) { return new Vector2(pos.X + Nivel.Player.currentAnim.anchoFrame / 2 - anim.anchoFrame / 2, pos.Y - anim.alturaFrame - 10); }