E03 Notes
Closed this issue · 4 comments
tylerecouture commented
Enemy
- Enemy as KinematicBody (new scene)
- Mesh Capsule (rotate 90 on X and move up on Y by 1.4)
- Color green?
Navigation Mesh
- Add a Navigation Node
- NavigationMeshInstance
- Move the Ground under the NavMesh
- Bake the navmesh and see the area.
- Add a CSGCube as an obstance and rebake.
- Color obstacle
tylerecouture commented
Enemy Follow
- Enemy Script
- (Add a timer for the follow update)
Script:
extends KinematicBody
# var target # Player location variable
onready var nav = $"../Navigation"
onready var player = $"../Player"
var path = []
var path_node = 0
export var speed = 2
func _ready():
# target = # find object with tab "Player", transform.
pass
func _physics_process(delta):
if path_node <path.size():
var direction = (path[path_node] - global_transform.origin)
if direction.length() < 1:
path_node += 1
else:
move_and_slide(direction.normalized() * speed, Vector3.UP)
# move to player
func update_path(target_pos):
path = nav.get_simple_path(global_transform.origin, target_pos)
path_node = 0
# Move to player on a timer so doesnt recalc each frame at refresh rate seconds (1 second?)
func _on_Timer_timeout():
print("Looking for Player!")
update_path(player.global_transform.origin)
tylerecouture commented
tylerecouture commented
Remove comments "Pew!", Looking for Player"
Script > Search > Find in Files "print("
Bullet Collision
- Add Collishion Shape (error, can't)
- Add an Area (Volume?)
- Test! Woah... it pushes the guy back!
- Don't SCALE IN THE EDITOR! Godot Docs says bad
Player collisions
- Add collision shape so it collides with the obstacles and the enemy
tylerecouture commented
Box Shadows
- Shadows > Contact = 0.5 (ish, or whatever works)