Initial commit

This commit is contained in:
2020-10-26 00:50:16 -04:00
commit e3358f6dd1
707 changed files with 12028 additions and 0 deletions

26
scripts/Creature.cs Normal file
View File

@@ -0,0 +1,26 @@
using Godot;
using System;
public class Creature : KinematicBody2D
{
[Export]
public String creatureName = "UNKNOWN";
public Health health = new Health();
private Vector2 worldPosition = Vector2.Zero;
private TileMap map {
get {
return GetParent().GetChild<TileMap>(0);
}}
protected void Move(Vector2 movement)
{
// Generate new position in world and check
// if location is a valid location to move to.
Vector2 new_pos = worldPosition + movement;
if (map.IsValidMapPosition(new_pos))
{
Position = map.MapToWorld(worldPosition); // Update position based on tile location
worldPosition = new_pos; // Save new location
}
}
}