create red turtle behavior logic
This commit is contained in:
parent
9adf496504
commit
bb6550851a
19
scenes/enemies/turtle/red/RedTurtle.cs
Normal file
19
scenes/enemies/turtle/red/RedTurtle.cs
Normal file
@ -0,0 +1,19 @@
|
||||
using Godot;
|
||||
using System;
|
||||
|
||||
public class RedTurtle : EnemyWalking
|
||||
{
|
||||
private AnimatedSprite _sprite;
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
base._Ready();
|
||||
_sprite = GetNode<AnimatedSprite>("AnimatedSprite");
|
||||
_sprite.Play("walk");
|
||||
}
|
||||
|
||||
public void OnVisibilityNotifier2DScreenExited()
|
||||
{
|
||||
Reset();
|
||||
}
|
||||
}
|
@ -1,7 +1,8 @@
|
||||
[gd_scene load_steps=10 format=2]
|
||||
[gd_scene load_steps=11 format=2]
|
||||
|
||||
[ext_resource path="res://assets/turtle/red_walking.png" type="Texture" id=1]
|
||||
[ext_resource path="res://assets/turtle/red_shell.png" type="Texture" id=2]
|
||||
[ext_resource path="res://scenes/enemies/turtle/red/RedTurtle.cs" type="Script" id=3]
|
||||
|
||||
[sub_resource type="AtlasTexture" id=8]
|
||||
atlas = ExtResource( 2 )
|
||||
@ -39,6 +40,7 @@ extents = Vector2( 9.5, 8 )
|
||||
extents = Vector2( 5.5, 6 )
|
||||
|
||||
[node name="RedTurtle" type="KinematicBody2D"]
|
||||
script = ExtResource( 3 )
|
||||
|
||||
[node name="AnimatedSprite" type="AnimatedSprite" parent="."]
|
||||
frames = SubResource( 4 )
|
||||
@ -54,3 +56,9 @@ visible = false
|
||||
position = Vector2( -0.5, 2 )
|
||||
shape = SubResource( 7 )
|
||||
disabled = true
|
||||
|
||||
[node name="VisibilityEnabler2D" type="VisibilityEnabler2D" parent="."]
|
||||
process_parent = true
|
||||
physics_process_parent = true
|
||||
|
||||
[connection signal="screen_exited" from="VisibilityEnabler2D" to="." method="OnVisibilityNotifier2DScreenExited"]
|
||||
|
Loading…
Reference in New Issue
Block a user