Basic launch
This commit is contained in:
25
Scenes/Enemy.gd
Normal file
25
Scenes/Enemy.gd
Normal file
@@ -0,0 +1,25 @@
|
||||
extends KinematicBody
|
||||
|
||||
onready var animation_player = $AnimationPlayer
|
||||
|
||||
var hit_acceleration = 10
|
||||
var hit_speed = 100
|
||||
|
||||
var velocity = Vector3()
|
||||
var movement = Vector3()
|
||||
var direction = Vector3()
|
||||
var gravity_vec = Vector3()
|
||||
|
||||
func _physics_process(delta):
|
||||
|
||||
velocity = velocity.linear_interpolate(direction * hit_speed, hit_acceleration * delta)
|
||||
|
||||
movement.x = velocity.x
|
||||
movement.y = velocity.y
|
||||
movement.z = velocity.z
|
||||
|
||||
move_and_slide(movement, Vector3.UP)
|
||||
|
||||
func get_slapped(slap_level, slap_vector):
|
||||
animation_player.play("head_wobble")
|
||||
direction = slap_vector
|
@@ -1,21 +1,70 @@
|
||||
[gd_scene load_steps=4 format=2]
|
||||
[gd_scene load_steps=9 format=2]
|
||||
|
||||
[ext_resource path="res://BlenderStuff/protoenemy.obj" type="ArrayMesh" id=1]
|
||||
[ext_resource path="res://Scenes/Enemy.gd" type="Script" id=2]
|
||||
[ext_resource path="res://Scripts/HurtBox.gd" type="Script" id=3]
|
||||
|
||||
[sub_resource type="BoxShape" id=1]
|
||||
|
||||
[sub_resource type="BoxShape" id=2]
|
||||
[sub_resource type="CapsuleShape" id=2]
|
||||
height = 2.5
|
||||
|
||||
[sub_resource type="CylinderShape" id=3]
|
||||
|
||||
[sub_resource type="Animation" id=4]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/path = NodePath("MeshInstance:rotation_degrees")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/keys = {
|
||||
"times": PoolRealArray( 0 ),
|
||||
"transitions": PoolRealArray( 1 ),
|
||||
"update": 0,
|
||||
"values": [ Vector3( 0, 0, -15 ) ]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id=5]
|
||||
resource_name = "head_wobble"
|
||||
length = 0.5
|
||||
tracks/0/type = "value"
|
||||
tracks/0/path = NodePath("MeshInstance:rotation_degrees")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/keys = {
|
||||
"times": PoolRealArray( 0, 0.1, 0.3, 0.5 ),
|
||||
"transitions": PoolRealArray( 1, 2.07053, 1, 0.482968 ),
|
||||
"update": 0,
|
||||
"values": [ Vector3( 0, 0, 0 ), Vector3( 0, 0, -15 ), Vector3( 0, 0, 15 ), Vector3( 0, 0, 0 ) ]
|
||||
}
|
||||
|
||||
[node name="Enemy" type="KinematicBody"]
|
||||
script = ExtResource( 2 )
|
||||
|
||||
[node name="MeshInstance" type="MeshInstance" parent="."]
|
||||
transform = Transform( 0.6, 0, 0, 0, 0.6, 0, 0, 0, 0.6, 0, 0, 0 )
|
||||
mesh = ExtResource( 1 )
|
||||
|
||||
[node name="BodyCollision" type="CollisionShape" parent="."]
|
||||
transform = Transform( 0.914478, 0, 0, 0, 1.50713, 0, 0, 0, 0.383312, 0, -0.479353, 0 )
|
||||
[node name="Head" type="Area" parent="."]
|
||||
script = ExtResource( 3 )
|
||||
|
||||
[node name="HeadCollision" type="CollisionShape" parent="Head"]
|
||||
transform = Transform( 0.432688, 0, 0, 0, 2.49394, 0, 0, 0, 0.432688, 0, -0.0876949, 0 )
|
||||
shape = SubResource( 1 )
|
||||
|
||||
[node name="Head" type="CollisionShape" parent="."]
|
||||
transform = Transform( 0.528959, 0, 0, 0, 0.728767, 0, 0, 0, 0.528959, 0, 1.87623, 0 )
|
||||
[node name="EnemyCollision" type="CollisionShape" parent="."]
|
||||
transform = Transform( 1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 0, -0.094023, 0 )
|
||||
shape = SubResource( 2 )
|
||||
|
||||
[node name="EnemyFeet" type="CollisionShape" parent="."]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -1.59606, 0 )
|
||||
shape = SubResource( 3 )
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||
reset_on_save = false
|
||||
anims/RESET = SubResource( 4 )
|
||||
anims/head_wobble = SubResource( 5 )
|
||||
|
Reference in New Issue
Block a user