First Level Test
This commit is contained in:
parent
c12c4be394
commit
d7fab32f44
16 changed files with 549 additions and 26 deletions
75
sprites/common/kimberly/kimberly.gd
Normal file
75
sprites/common/kimberly/kimberly.gd
Normal file
|
@ -0,0 +1,75 @@
|
|||
extends CharacterBody2D
|
||||
|
||||
var theta: float = 0.0
|
||||
@export_range(0,2*PI) var alpha: float = 1.5
|
||||
var bullet = load("res://sprites/common/bullet/arrow.tscn")
|
||||
|
||||
const SPEED = 300.0
|
||||
const JUMP_VELOCITY = -400.0
|
||||
var vangle = 2
|
||||
var weakness = 1
|
||||
|
||||
|
||||
func _ready():
|
||||
var stimer = $Speed
|
||||
stimer.start(0.05)
|
||||
|
||||
func get_vector(angle):
|
||||
theta = angle + alpha
|
||||
return Vector2(cos(theta),sin(theta))
|
||||
|
||||
# Get the gravity from the project settings to be synced with RigidBody nodes.
|
||||
var gravity = ProjectSettings.get_setting("physics/2d/default_gravity")
|
||||
|
||||
@onready var anim := $AnimationPlayer
|
||||
|
||||
func _physics_process(delta):
|
||||
velocity.x = 0
|
||||
velocity.y = 0
|
||||
# Add the gravity.
|
||||
#var velocity = Vector2.ZERO
|
||||
#if Global.live == 1:
|
||||
#velocity = (Vector2.RIGHT.rotated(rotation) * 500 * Global.xm * delta)-Vector2.UP.rotated(rotation) * 500 * Global.ym * delta
|
||||
#origmpos = get_viewport().get_mouse_position()
|
||||
#if Input.get_joy_axis(0,JOY_AXIS_LEFT_Y) != 0:
|
||||
# velocity = Vector2.UP.rotated(rotation) * -400 * Input.get_joy_axis(0,JOY_AXIS_LEFT_Y)
|
||||
#position += velocity
|
||||
position += velocity
|
||||
if velocity.y > 0.3:
|
||||
vangle = 2
|
||||
elif velocity.y < -0.3:
|
||||
vangle = 0
|
||||
elif velocity.x > 0.3:
|
||||
vangle = 1
|
||||
elif velocity.x < -0.3:
|
||||
vangle = 3
|
||||
if velocity.y != 0 || velocity.x != 0:
|
||||
if vangle == 0:
|
||||
anim.play("nwalk")
|
||||
elif vangle == 1:
|
||||
anim.play("ewalk")
|
||||
elif vangle == 3:
|
||||
anim.play("wwalk")
|
||||
else:
|
||||
anim.play("swalk")
|
||||
else:
|
||||
if vangle == 0:
|
||||
anim.play("nidle")
|
||||
elif vangle == 1:
|
||||
anim.play("eidle")
|
||||
elif vangle == 3:
|
||||
anim.play("widle")
|
||||
else:
|
||||
anim.play("sidle")
|
||||
#move_and_slide()
|
||||
func shoot(angle):
|
||||
var new_bullet = bullet.instantiate()
|
||||
new_bullet.position = Vector2(position.x, position.y)
|
||||
new_bullet.direction = get_vector(angle)
|
||||
new_bullet.btype = "boss"
|
||||
get_parent().call_deferred("add_child",new_bullet)
|
||||
|
||||
|
||||
func _on_speed_timeout():
|
||||
if Global.live == 1:
|
||||
shoot(theta)
|
185
sprites/common/kimberly/kimberly.tscn
Normal file
185
sprites/common/kimberly/kimberly.tscn
Normal file
|
@ -0,0 +1,185 @@
|
|||
[gd_scene load_steps=14 format=3 uid="uid://wo77i5ql2esb"]
|
||||
|
||||
[ext_resource type="Script" path="res://sprites/common/kimberly/kimberly.gd" id="1_g5qsa"]
|
||||
[ext_resource type="Texture2D" uid="uid://by7git27p1fp6" path="res://sprites/common/kimberly/sprite.png" id="2_hhs4a"]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_dj8gt"]
|
||||
size = Vector2(86, 68)
|
||||
|
||||
[sub_resource type="Animation" id="Animation_i5rhc"]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Sprite2D:frame")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [0]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_8my4d"]
|
||||
resource_name = "eidle"
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Sprite2D:frame")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [6]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_op07l"]
|
||||
resource_name = "ewalk"
|
||||
length = 0.3
|
||||
loop_mode = 1
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Sprite2D:frame")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.1, 0.2),
|
||||
"transitions": PackedFloat32Array(1, 1, 1),
|
||||
"update": 1,
|
||||
"values": [7, 6, 8]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_cajcr"]
|
||||
resource_name = "nidle"
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Sprite2D:frame")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0.2),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [3]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_7lhgw"]
|
||||
resource_name = "nwalk"
|
||||
length = 0.3
|
||||
loop_mode = 1
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Sprite2D:frame")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.1, 0.2),
|
||||
"transitions": PackedFloat32Array(1, 1, 1),
|
||||
"update": 1,
|
||||
"values": [4, 3, 5]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_w3ius"]
|
||||
resource_name = "sidle"
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Sprite2D:frame")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [0]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_u56r5"]
|
||||
resource_name = "swalk"
|
||||
length = 0.3
|
||||
loop_mode = 1
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Sprite2D:frame")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.1, 0.2),
|
||||
"transitions": PackedFloat32Array(1, 1, 1),
|
||||
"update": 1,
|
||||
"values": [1, 0, 2]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_isodq"]
|
||||
resource_name = "widle"
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Sprite2D:frame")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0.2),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [9]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_letwb"]
|
||||
resource_name = "wwalk"
|
||||
length = 0.3
|
||||
loop_mode = 1
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Sprite2D:frame")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.1, 0.2),
|
||||
"transitions": PackedFloat32Array(1, 1, 1),
|
||||
"update": 1,
|
||||
"values": [10, 9, 11]
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_mh65y"]
|
||||
_data = {
|
||||
"RESET": SubResource("Animation_i5rhc"),
|
||||
"eidle": SubResource("Animation_8my4d"),
|
||||
"ewalk": SubResource("Animation_op07l"),
|
||||
"nidle": SubResource("Animation_cajcr"),
|
||||
"nwalk": SubResource("Animation_7lhgw"),
|
||||
"sidle": SubResource("Animation_w3ius"),
|
||||
"swalk": SubResource("Animation_u56r5"),
|
||||
"widle": SubResource("Animation_isodq"),
|
||||
"wwalk": SubResource("Animation_letwb")
|
||||
}
|
||||
|
||||
[node name="Kimberly" type="CharacterBody2D"]
|
||||
script = ExtResource("1_g5qsa")
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||
texture = ExtResource("2_hhs4a")
|
||||
hframes = 3
|
||||
vframes = 4
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
position = Vector2(0, 94)
|
||||
shape = SubResource("RectangleShape2D_dj8gt")
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||
libraries = {
|
||||
"": SubResource("AnimationLibrary_mh65y")
|
||||
}
|
||||
|
||||
[node name="Speed" type="Timer" parent="."]
|
||||
wait_time = 0.1
|
||||
|
||||
[connection signal="timeout" from="Speed" to="." method="_on_speed_timeout"]
|
Loading…
Add table
Add a link
Reference in a new issue