summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Scenes/MonsterIdle.gd6
-rw-r--r--Scenes/MonsterIdle.tscn11
-rw-r--r--Scenes/MonsterRandCardinal.gd3
-rw-r--r--Scenes/MonsterRandom.gd40
-rw-r--r--Scenes/MonsterRandom.tscn10
-rw-r--r--Scenes/MonsterSquare.gd32
-rw-r--r--Scenes/MonsterSquare.tscn11
-rw-r--r--Scenes/Obstacle.tscn9
8 files changed, 113 insertions, 9 deletions
diff --git a/Scenes/MonsterIdle.gd b/Scenes/MonsterIdle.gd
new file mode 100644
index 0000000..6974aa7
--- /dev/null
+++ b/Scenes/MonsterIdle.gd
@@ -0,0 +1,6 @@
+extends Monster
+
+func try_moving(player_pos : Vector2, monster_pos : Vector2) -> MonsterAction:
+ var action = MonsterAction.new()
+ action.type = MonsterActionType.IDLE
+ return action
diff --git a/Scenes/MonsterIdle.tscn b/Scenes/MonsterIdle.tscn
new file mode 100644
index 0000000..75711fd
--- /dev/null
+++ b/Scenes/MonsterIdle.tscn
@@ -0,0 +1,11 @@
+[gd_scene load_steps=3 format=2]
+
+[ext_resource path="res://Scenes/Monster.tscn" type="PackedScene" id=1]
+[ext_resource path="res://Scenes/MonsterIdle.gd" type="Script" id=2]
+
+[node name="MonsterIdle" instance=ExtResource( 1 )]
+script = ExtResource( 2 )
+actionable = false
+
+[node name="Sprite3D" parent="." index="0"]
+modulate = Color( 0.992157, 1, 0, 1 )
diff --git a/Scenes/MonsterRandCardinal.gd b/Scenes/MonsterRandCardinal.gd
index 0fdabb1..fba5fee 100644
--- a/Scenes/MonsterRandCardinal.gd
+++ b/Scenes/MonsterRandCardinal.gd
@@ -9,9 +9,6 @@ func _ready():
if randf() < 0.5:
cardinal = Vector2.RIGHT
-func get_weakness():
- return ['2','4','6']
-
func try_moving(player_pos : Vector2, monster_pos : Vector2) -> MonsterAction:
var action = MonsterAction.new()
diff --git a/Scenes/MonsterRandom.gd b/Scenes/MonsterRandom.gd
new file mode 100644
index 0000000..34cf7a9
--- /dev/null
+++ b/Scenes/MonsterRandom.gd
@@ -0,0 +1,40 @@
+extends Monster
+
+onready var cardinal = Vector2.UP
+
+const directions = [Vector2(1,0), Vector2(0,1), Vector2(-1,0), Vector2(0,-1)]
+var dir_i = 0
+var moved = true
+
+func _ready():
+ ._ready()
+ dir_i = 0
+ if randf() < 0.5:
+ cardinal = Vector2.RIGHT
+
+func try_moving(player_pos : Vector2, monster_pos : Vector2) -> MonsterAction:
+ var action = MonsterAction.new()
+
+ if moved:
+ moved = false
+ action.type = MonsterActionType.IDLE
+ return action
+ else:
+ moved = true
+
+ var next_tile = monster_pos
+ var next_movement = directions[dir_i]
+
+ var next_pos = monster_pos + next_movement
+
+ if next_pos == player_pos:
+ action.type = MonsterActionType.ATTACK
+ else:
+ action.type = MonsterActionType.MOVE
+ action.dir = next_movement
+ dir_i = randi()%4
+
+ return action
+
+func cor_attack(args : Array):
+ yield(.cor_attack(args), "completed")
diff --git a/Scenes/MonsterRandom.tscn b/Scenes/MonsterRandom.tscn
new file mode 100644
index 0000000..c4f9643
--- /dev/null
+++ b/Scenes/MonsterRandom.tscn
@@ -0,0 +1,10 @@
+[gd_scene load_steps=3 format=2]
+
+[ext_resource path="res://Scenes/Monster.tscn" type="PackedScene" id=1]
+[ext_resource path="res://Scenes/MonsterRandom.gd" type="Script" id=2]
+
+[node name="MonsterSquare" instance=ExtResource( 1 )]
+script = ExtResource( 2 )
+
+[node name="Sprite3D" parent="." index="0"]
+modulate = Color( 0.337255, 1, 0.533333, 1 )
diff --git a/Scenes/MonsterSquare.gd b/Scenes/MonsterSquare.gd
new file mode 100644
index 0000000..89ae2e3
--- /dev/null
+++ b/Scenes/MonsterSquare.gd
@@ -0,0 +1,32 @@
+extends Monster
+
+onready var cardinal = Vector2.UP
+
+const directions = [Vector2(1,0), Vector2(0,1), Vector2(-1,0), Vector2(0,-1)]
+var dir_i = 0
+
+func _ready():
+ ._ready()
+ dir_i = 0
+ if randf() < 0.5:
+ cardinal = Vector2.RIGHT
+
+func try_moving(player_pos : Vector2, monster_pos : Vector2) -> MonsterAction:
+ var action = MonsterAction.new()
+
+ var next_tile = monster_pos
+ var next_movement = directions[dir_i]
+
+ var next_pos = monster_pos + next_movement
+
+ if next_pos == player_pos:
+ action.type = MonsterActionType.ATTACK
+ else:
+ action.type = MonsterActionType.MOVE
+ action.dir = next_movement
+ dir_i = (dir_i + 1) % 4
+
+ return action
+
+func cor_attack(args : Array):
+ yield(.cor_attack(args), "completed")
diff --git a/Scenes/MonsterSquare.tscn b/Scenes/MonsterSquare.tscn
new file mode 100644
index 0000000..4adf339
--- /dev/null
+++ b/Scenes/MonsterSquare.tscn
@@ -0,0 +1,11 @@
+[gd_scene load_steps=3 format=2]
+
+[ext_resource path="res://Scenes/Monster.tscn" type="PackedScene" id=1]
+[ext_resource path="res://Scenes/MonsterSquare.gd" type="Script" id=2]
+
+[node name="MonsterSquare" instance=ExtResource( 1 )]
+script = ExtResource( 2 )
+actionable = false
+
+[node name="Sprite3D" parent="." index="0"]
+modulate = Color( 0.513726, 0.337255, 1, 1 )
diff --git a/Scenes/Obstacle.tscn b/Scenes/Obstacle.tscn
index 40d9338..aeb41d6 100644
--- a/Scenes/Obstacle.tscn
+++ b/Scenes/Obstacle.tscn
@@ -1,15 +1,12 @@
-[gd_scene load_steps=5 format=2]
+[gd_scene load_steps=4 format=2]
[ext_resource path="res://Scenes/Entity.gd" type="Script" id=1]
-[ext_resource path="res://Assets/Environment/Obstacle.png" type="Texture" id=2]
[sub_resource type="CubeMesh" id=6]
-size = Vector3( 1, 1, 1 )
+size = Vector3( 0.8, 0.8, 0.8 )
[sub_resource type="SpatialMaterial" id=5]
-albedo_color = Color( 0.627451, 0.701961, 0.788235, 1 )
-albedo_texture = ExtResource( 2 )
-uv1_scale = Vector3( 3, 2, 1 )
+albedo_color = Color( 0.976471, 0.541176, 0.541176, 1 )
[node name="Obstacle" type="Spatial"]
script = ExtResource( 1 )