UPDATE : Some more Enemies for level 2
Level 2 is going to be in a factory so most of the enemies are robotics.
Mechanical Arms
Arm movement using Tweens and shoot slow moving projectiles. Aiming by using look_at().
The ones on conveyor belt are moving using PathFollow3D. They will only shoot or get shot when above ground by using PathFollow.progress. For example, I know the progress between 1 and 10 is above ground so:
if pathfollow3d_4.progress >= 1 and pathfollow3d_4.progress <= 10:
arm_robot.shoot()
arm_robot.area_collision.disabled = false
else:
arm_robot.area_collision.disabled = true
Mechanical Walker
Starts by walking out of the background and turning to face the player. For example:
# Walking
position += global_transform.basis.z...
# Turning once reaching the foreground (z axis = 0)
if position.z < 0.05:
body.rotation.y = lerp_angle(body.rotation.y..)
I'm using Enum States for 2 attack types.
A) Shooting projectiles according to where the player is. As an example:
if distance_to_player > 2 :
projectile.velocity = Vector3(-2,2,0)
B) If the player tries to crawl under it will squash you.
if distance_to_player <= 2 :
State = state.SQUASH
Using a simple animation_tree for blending animations (by lerping the values of blendspace2D)