git init
This commit is contained in:
commit
80f2563cdc
95 changed files with 3327 additions and 0 deletions
42
scenes/Duck/Duck.gd
Normal file
42
scenes/Duck/Duck.gd
Normal file
|
@ -0,0 +1,42 @@
|
|||
extends CharacterBody2D
|
||||
|
||||
|
||||
const JUMP_VELOCITY = -230.0
|
||||
signal gameover
|
||||
|
||||
@onready var alive = true
|
||||
|
||||
func die():
|
||||
print("die")
|
||||
gameover.emit()
|
||||
alive = false
|
||||
|
||||
func start():
|
||||
global_position = Vector2(21,91)
|
||||
alive = true
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
if not is_on_floor():
|
||||
velocity += get_gravity() * delta
|
||||
|
||||
if Input.is_action_pressed("jump") and is_on_floor() and alive and $"/root/Global".gamerunning:
|
||||
velocity.y = JUMP_VELOCITY
|
||||
move_and_slide()
|
||||
|
||||
func _process(_delta: float) -> void:
|
||||
if position.x < -20:
|
||||
if alive:
|
||||
die()
|
||||
if not $"/root/Global".gamerunning:
|
||||
$AnimationPlayer.play("idle")
|
||||
elif not is_on_floor():
|
||||
$AnimationPlayer.play("fly")
|
||||
elif not alive:
|
||||
$AnimationPlayer.play("die")
|
||||
else:
|
||||
$AnimationPlayer.play("walk")
|
||||
|
||||
func _collide_with_hindernis(_body: Node2D) -> void:
|
||||
print("colide")
|
||||
if alive:
|
||||
die()
|
136
scenes/Duck/Duck.tscn
Normal file
136
scenes/Duck/Duck.tscn
Normal file
|
@ -0,0 +1,136 @@
|
|||
[gd_scene load_steps=11 format=3 uid="uid://8v5mbbnddorh"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://dc6grg2oaq3a6" path="res://scenes/Duck/ente.png" id="1"]
|
||||
[ext_resource type="Script" path="res://scenes/Duck/Duck.gd" id="1_pvotk"]
|
||||
|
||||
[sub_resource type="Animation" id="5"]
|
||||
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": 0,
|
||||
"values": [4]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="6"]
|
||||
resource_name = "die"
|
||||
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),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [5]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="7"]
|
||||
resource_name = "fly"
|
||||
length = 0.5
|
||||
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),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [2]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="2"]
|
||||
resource_name = "idle"
|
||||
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.5),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 1,
|
||||
"values": [0, 1]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="3"]
|
||||
resource_name = "walk"
|
||||
length = 0.5
|
||||
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.5),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [3, 4]
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_rcmnp"]
|
||||
_data = {
|
||||
"RESET": SubResource("5"),
|
||||
"die": SubResource("6"),
|
||||
"fly": SubResource("7"),
|
||||
"idle": SubResource("2"),
|
||||
"walk": SubResource("3")
|
||||
}
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_1551i"]
|
||||
radius = 1.21655
|
||||
|
||||
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_46c8m"]
|
||||
radius = 6.0
|
||||
height = 14.0
|
||||
|
||||
[node name="Duck" type="CharacterBody2D"]
|
||||
script = ExtResource("1_pvotk")
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||
root_node = NodePath("../hitbox")
|
||||
libraries = {
|
||||
"": SubResource("AnimationLibrary_rcmnp")
|
||||
}
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||
texture_filter = 3
|
||||
position = Vector2(0, -7)
|
||||
texture = ExtResource("1")
|
||||
hframes = 3
|
||||
vframes = 2
|
||||
frame = 4
|
||||
|
||||
[node name="physicsbox" type="CollisionShape2D" parent="."]
|
||||
position = Vector2(2.38419e-07, -6)
|
||||
scale = Vector2(5, 5)
|
||||
shape = SubResource("CircleShape2D_1551i")
|
||||
|
||||
[node name="hitbox" type="Area2D" parent="."]
|
||||
position = Vector2(13, -2)
|
||||
collision_layer = 2
|
||||
collision_mask = 2
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="hitbox"]
|
||||
position = Vector2(-13, -4)
|
||||
shape = SubResource("CapsuleShape2D_46c8m")
|
||||
debug_color = Color(0.906661, 0.254677, 0.42413, 0.42)
|
||||
|
||||
[connection signal="area_entered" from="hitbox" to="." method="_collide_with_hindernis"]
|
BIN
scenes/Duck/ente.png
Normal file
BIN
scenes/Duck/ente.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1 KiB |
34
scenes/Duck/ente.png.import
Normal file
34
scenes/Duck/ente.png.import
Normal file
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://dc6grg2oaq3a6"
|
||||
path="res://.godot/imported/ente.png-89549b44b337187eba16391bfd7f28f9.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://scenes/Duck/ente.png"
|
||||
dest_files=["res://.godot/imported/ente.png-89549b44b337187eba16391bfd7f28f9.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=1
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
Loading…
Add table
Add a link
Reference in a new issue