public void Hitbox_BodyEntered(KinematicBody2D body) { if (body.IsInGroup("roach")) { _isRecover = false; ((Health)GetNode("Health")).Damage(5); } else if (body.IsInGroup("enemy")) { _isRecover = false; ((Health)GetNode("Health")).Damage(1); } }
public void _on_Area2D_body_entered(KinematicBody2D body) { if (body.IsInGroup(ENEMY_GROUP)) { (body as Seagull).Die(); camera.Shake(); Score.instance.KillCount += 1; RefreshAfterKill(); } else if (body.IsInGroup(FECES_GROUP)) { lost = true; poopAudio.Play(); } }
public void _on_Area2D_body_entered(KinematicBody2D area) { if (area.IsInGroup("enemy")) { ChangeState("Dead"); } }
private void _on_Exit_body_entered(KinematicBody2D body) { if (body.IsInGroup("player")) { GetTree().ChangeScene("res://Levels/WinScreen.tscn"); } }
private void _on_Area2D_body_exited(KinematicBody2D body) { if (body.IsInGroup("player")) { _canChase = false; ChangeState("Wander"); } }
private void _on_Area2D_body_entered(KinematicBody2D body) { if (body.IsInGroup("player")) { _canChase = true; GetNode <Timer>("States/Wander/WanderTimer").Stop(); ChangeState("Chase"); } }
void PotentialTargetExited(KinematicBody2D body) { if (body.IsInGroup("EnemyTarget")) { nTarget = null; } //GD.Print($"{body.Name} exited"); }
void PotentialTargetDetected(KinematicBody2D body) { if (body.IsInGroup("EnemyTarget")) { nTarget = body; } //GD.Print($"{body.Name} entered"); }
private async void OnDoorDetection_BodyEntered(KinematicBody2D body) { if (body.IsInGroup("player")) { AudioSystem.PlaySFX(AudioSystem.SFXCollection.GuildHallEnter); await Autoload.Get <Transitions>().ChangeSceneDoubleTransition (WorldScenePath, new Transitions.TransitionParams( Transitions.TransitionType.ShrinkingCircle, 0.3f)); } }
private async void OnDoorDetection_BodyEntered(KinematicBody2D body) { if (body.IsInGroup("player")) { var offset = new Vector2(0, 5); SaveManager.SaveData.WorldPosition = _player.Position + offset; AudioSystem.PlaySFX(AudioSystem.SFXCollection.GuildHallEnter); var transitionParams = new Transitions.TransitionParams( Transitions.TransitionType.ShrinkingCircle, 0.3f); await Autoload.Get <Transitions>() .ChangeSceneDoubleTransition(GuildHallScenePath, transitionParams); } }
protected override void OnCantMoveRigidBody2D(KinematicBody2D go)//sino puede moverse por un kinematicbody como un personaje { GD.Print("enemigo colisionando con alguien"); //parece que hay un bug cuando colisionan entre enemigos por eso verifico si esta en el grupo player el cuerpo kinematico if (go.IsInGroup("Player")) //detectamos que esta en el grupo player para evitar un bug al solicionar los enemigos entre sí { hitPlayer = (Player)go; //de esta forma tendria que acceder al script que tiene el personaje } if (hitPlayer != null) //si estoy en la casilla player { hitPlayer.LoseFood(playerDamage); //descuento comida del personaje playback.Travel("EnemyAttack"); //el enemigo ataca cuando le quitamos puntos al jugador _GameManager.RandomizeSfx(scavengers_enemy, scavengersEnemyNode); //activo sonido golpe if (hitPlayer.food >= 10) //si la comida del personaje es mayor o igual a 10 { AnimationPlayerEfectos.Play("pantallaRoja"); //play color rojo en pantalla AnimationPlayerEfectos.PlayBackwards("pantallaRoja"); //play al reves color rojo en pantalla para que quede transparente } } }