Zondre
This commit is contained in:
parent
c266d22f58
commit
2eb65c3092
24 changed files with 566 additions and 49 deletions
24
scripts/components/zombies/ZombieMover.cs
Normal file
24
scripts/components/zombies/ZombieMover.cs
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
using Godot;
|
||||
using System;
|
||||
|
||||
public partial class ZombieMover : Node
|
||||
{
|
||||
private float _speed;
|
||||
|
||||
private Node2D _zombie;
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
_zombie = GetParent<Node2D>();
|
||||
}
|
||||
|
||||
public override void _PhysicsProcess(double delta)
|
||||
{
|
||||
_zombie.Position -= _zombie.Transform.X * _speed * (float)delta * Utility.TileWidth;
|
||||
}
|
||||
|
||||
public void SetSpeed(float speed)
|
||||
{
|
||||
_speed = speed;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue