generated from hertog/godot-module-template
2d template pushed
This commit is contained in:
parent
aa8cc49f4d
commit
4da7e28cb5
73 changed files with 3120 additions and 11 deletions
15
project/player/bullet.gd
Normal file
15
project/player/bullet.gd
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
class_name Bullet
|
||||
extends RigidBody2D
|
||||
|
||||
var disabled = false
|
||||
|
||||
func _ready():
|
||||
($Timer as Timer).start()
|
||||
|
||||
|
||||
func disable():
|
||||
if disabled:
|
||||
return
|
||||
|
||||
($AnimationPlayer as AnimationPlayer).play("shutdown")
|
||||
disabled = true
|
||||
BIN
project/player/bullet.png
Normal file
BIN
project/player/bullet.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 146 B |
34
project/player/bullet.png.import
Normal file
34
project/player/bullet.png.import
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://7sv64orewgmb"
|
||||
path="res://.godot/imported/bullet.png-5615cb9904aab8db60fe6f48e996475f.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://player/bullet.png"
|
||||
dest_files=["res://.godot/imported/bullet.png-5615cb9904aab8db60fe6f48e996475f.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=0
|
||||
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
|
||||
85
project/player/bullet.tscn
Normal file
85
project/player/bullet.tscn
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
[gd_scene load_steps=7 format=3 uid="uid://dlfwkokoudcwv"]
|
||||
|
||||
[ext_resource type="Script" path="res://player/bullet.gd" id="1"]
|
||||
[ext_resource type="Texture2D" uid="uid://7sv64orewgmb" path="res://player/bullet.png" id="2"]
|
||||
|
||||
[sub_resource type="CanvasItemMaterial" id="1"]
|
||||
blend_mode = 1
|
||||
|
||||
[sub_resource type="CircleShape2D" id="2"]
|
||||
radius = 4.5
|
||||
|
||||
[sub_resource type="Animation" id="3"]
|
||||
length = 1.5
|
||||
tracks/0/type = "method"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath(".")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(1.31),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"values": [{
|
||||
"args": [],
|
||||
"method": &"queue_free"
|
||||
}]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("Sprite2D:modulate")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0, 1.03),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [Color(1, 1, 1, 1), Color(1, 1, 1, 0)]
|
||||
}
|
||||
tracks/2/type = "value"
|
||||
tracks/2/imported = false
|
||||
tracks/2/enabled = true
|
||||
tracks/2/path = NodePath("GPUParticles2D:self_modulate")
|
||||
tracks/2/interp = 1
|
||||
tracks/2/loop_wrap = true
|
||||
tracks/2/keys = {
|
||||
"times": PackedFloat32Array(0, 0.5),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [Color(1, 1, 1, 1), Color(1, 1, 1, 0)]
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_hkd2b"]
|
||||
_data = {
|
||||
"shutdown": SubResource("3")
|
||||
}
|
||||
|
||||
[node name="Bullet" type="RigidBody2D"]
|
||||
continuous_cd = 2
|
||||
script = ExtResource("1")
|
||||
|
||||
[node name="GPUParticles2D" type="CPUParticles2D" parent="."]
|
||||
material = SubResource("1")
|
||||
emitting = false
|
||||
lifetime = 0.3
|
||||
speed_scale = 3.0
|
||||
texture = ExtResource("2")
|
||||
spread = 0.0
|
||||
gravity = Vector2(0, 0)
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||
texture = ExtResource("2")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
shape = SubResource("2")
|
||||
|
||||
[node name="Timer" type="Timer" parent="."]
|
||||
one_shot = true
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||
libraries = {
|
||||
"": SubResource("AnimationLibrary_hkd2b")
|
||||
}
|
||||
|
||||
[connection signal="timeout" from="Timer" to="." method="disable"]
|
||||
BIN
project/player/osb_fire.png
Normal file
BIN
project/player/osb_fire.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.4 KiB |
34
project/player/osb_fire.png.import
Normal file
34
project/player/osb_fire.png.import
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://dfaohortmfvm7"
|
||||
path="res://.godot/imported/osb_fire.png-67a49910acd764fd7c67429af0ad5cb8.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://player/osb_fire.png"
|
||||
dest_files=["res://.godot/imported/osb_fire.png-67a49910acd764fd7c67429af0ad5cb8.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=0
|
||||
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
|
||||
BIN
project/player/osb_jump.png
Normal file
BIN
project/player/osb_jump.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 802 B |
34
project/player/osb_jump.png.import
Normal file
34
project/player/osb_jump.png.import
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://c7ymjckh78mib"
|
||||
path="res://.godot/imported/osb_jump.png-0d4d2b2d1a7d2c11e3e4fd800b8589ed.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://player/osb_jump.png"
|
||||
dest_files=["res://.godot/imported/osb_jump.png-0d4d2b2d1a7d2c11e3e4fd800b8589ed.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=0
|
||||
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
|
||||
BIN
project/player/osb_left.png
Normal file
BIN
project/player/osb_left.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 777 B |
34
project/player/osb_left.png.import
Normal file
34
project/player/osb_left.png.import
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://dx42eijx3d7df"
|
||||
path="res://.godot/imported/osb_left.png-95ec3a371455889d592aa8cae0a755bc.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://player/osb_left.png"
|
||||
dest_files=["res://.godot/imported/osb_left.png-95ec3a371455889d592aa8cae0a755bc.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=0
|
||||
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
|
||||
BIN
project/player/osb_right.png
Normal file
BIN
project/player/osb_right.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 785 B |
34
project/player/osb_right.png.import
Normal file
34
project/player/osb_right.png.import
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://dykiknf7km7u4"
|
||||
path="res://.godot/imported/osb_right.png-db9bb4651315f3d42b87bd17a86cce76.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://player/osb_right.png"
|
||||
dest_files=["res://.godot/imported/osb_right.png-db9bb4651315f3d42b87bd17a86cce76.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=0
|
||||
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
|
||||
208
project/player/player.gd
Normal file
208
project/player/player.gd
Normal file
|
|
@ -0,0 +1,208 @@
|
|||
class_name Player
|
||||
extends RigidBody2D
|
||||
|
||||
const WALK_ACCEL = 1000.0
|
||||
const WALK_DEACCEL = 1000.0
|
||||
const WALK_MAX_VELOCITY = 200.0
|
||||
const AIR_ACCEL = 250.0
|
||||
const AIR_DEACCEL = 250.0
|
||||
const JUMP_VELOCITY = 380.0
|
||||
const STOP_JUMP_FORCE = 450.0
|
||||
const MAX_SHOOT_POSE_TIME = 0.3
|
||||
const MAX_FLOOR_AIRBORNE_TIME = 0.15
|
||||
|
||||
const BULLET_SCENE = preload("res://player/bullet.tscn")
|
||||
const ENEMY_SCENE = preload("res://enemy/enemy.tscn")
|
||||
|
||||
var anim := ""
|
||||
var siding_left := false
|
||||
var jumping := false
|
||||
var stopping_jump := false
|
||||
var shooting := false
|
||||
|
||||
var floor_h_velocity: float = 0.0
|
||||
|
||||
var airborne_time: float = 1e20
|
||||
var shoot_time: float = 1e20
|
||||
|
||||
@onready var sound_jump := $SoundJump as AudioStreamPlayer2D
|
||||
@onready var sound_shoot := $SoundShoot as AudioStreamPlayer2D
|
||||
@onready var sprite := $Sprite2D as Sprite2D
|
||||
@onready var sprite_smoke := sprite.get_node(^"Smoke") as CPUParticles2D
|
||||
@onready var animation_player := $AnimationPlayer as AnimationPlayer
|
||||
@onready var bullet_shoot := $BulletShoot as Marker2D
|
||||
|
||||
|
||||
func _integrate_forces(state: PhysicsDirectBodyState2D) -> void:
|
||||
var velocity := state.get_linear_velocity()
|
||||
var step := state.get_step()
|
||||
|
||||
var new_anim := anim
|
||||
var new_siding_left := siding_left
|
||||
|
||||
# Get player input.
|
||||
var move_left := Input.is_action_pressed(&"move_left")
|
||||
var move_right := Input.is_action_pressed(&"move_right")
|
||||
var jump := Input.is_action_pressed(&"jump")
|
||||
var shoot := Input.is_action_pressed(&"shoot")
|
||||
var spawn := Input.is_action_just_pressed(&"spawn")
|
||||
|
||||
if spawn:
|
||||
_spawn_enemy_above.call_deferred()
|
||||
|
||||
# Deapply prev floor velocity.
|
||||
velocity.x -= floor_h_velocity
|
||||
floor_h_velocity = 0.0
|
||||
|
||||
# Find the floor (a contact with upwards facing collision normal).
|
||||
var found_floor := false
|
||||
var floor_index := -1
|
||||
|
||||
for contact_index in state.get_contact_count():
|
||||
var collision_normal = state.get_contact_local_normal(contact_index)
|
||||
|
||||
if collision_normal.dot(Vector2(0, -1)) > 0.6:
|
||||
found_floor = true
|
||||
floor_index = contact_index
|
||||
|
||||
# A good idea when implementing characters of all kinds,
|
||||
# compensates for physics imprecision, as well as human reaction delay.
|
||||
if shoot and not shooting:
|
||||
_shot_bullet.call_deferred()
|
||||
else:
|
||||
shoot_time += step
|
||||
|
||||
if found_floor:
|
||||
airborne_time = 0.0
|
||||
else:
|
||||
airborne_time += step # Time it spent in the air.
|
||||
|
||||
var on_floor := airborne_time < MAX_FLOOR_AIRBORNE_TIME
|
||||
|
||||
# Process jump.
|
||||
if jumping:
|
||||
if velocity.y > 0:
|
||||
# Set off the jumping flag if going down.
|
||||
jumping = false
|
||||
elif not jump:
|
||||
stopping_jump = true
|
||||
|
||||
if stopping_jump:
|
||||
velocity.y += STOP_JUMP_FORCE * step
|
||||
|
||||
if on_floor:
|
||||
# Process logic when character is on floor.
|
||||
if move_left and not move_right:
|
||||
if velocity.x > -WALK_MAX_VELOCITY:
|
||||
velocity.x -= WALK_ACCEL * step
|
||||
elif move_right and not move_left:
|
||||
if velocity.x < WALK_MAX_VELOCITY:
|
||||
velocity.x += WALK_ACCEL * step
|
||||
else:
|
||||
var xv := absf(velocity.x)
|
||||
xv -= WALK_DEACCEL * step
|
||||
if xv < 0:
|
||||
xv = 0
|
||||
velocity.x = signf(velocity.x) * xv
|
||||
|
||||
# Check jump.
|
||||
if not jumping and jump:
|
||||
velocity.y = -JUMP_VELOCITY
|
||||
jumping = true
|
||||
stopping_jump = false
|
||||
sound_jump.play()
|
||||
|
||||
# Check siding.
|
||||
if velocity.x < 0 and move_left:
|
||||
new_siding_left = true
|
||||
elif velocity.x > 0 and move_right:
|
||||
new_siding_left = false
|
||||
if jumping:
|
||||
new_anim = "jumping"
|
||||
elif absf(velocity.x) < 0.1:
|
||||
if shoot_time < MAX_SHOOT_POSE_TIME:
|
||||
new_anim = "idle_weapon"
|
||||
else:
|
||||
new_anim = "idle"
|
||||
else:
|
||||
if shoot_time < MAX_SHOOT_POSE_TIME:
|
||||
new_anim = "run_weapon"
|
||||
else:
|
||||
new_anim = "run"
|
||||
else:
|
||||
# Process logic when the character is in the air.
|
||||
if move_left and not move_right:
|
||||
if velocity.x > -WALK_MAX_VELOCITY:
|
||||
velocity.x -= AIR_ACCEL * step
|
||||
elif move_right and not move_left:
|
||||
if velocity.x < WALK_MAX_VELOCITY:
|
||||
velocity.x += AIR_ACCEL * step
|
||||
else:
|
||||
var xv := absf(velocity.x)
|
||||
xv -= AIR_DEACCEL * step
|
||||
|
||||
if xv < 0:
|
||||
xv = 0
|
||||
velocity.x = signf(velocity.x) * xv
|
||||
|
||||
if velocity.y < 0:
|
||||
if shoot_time < MAX_SHOOT_POSE_TIME:
|
||||
new_anim = "jumping_weapon"
|
||||
else:
|
||||
new_anim = "jumping"
|
||||
else:
|
||||
if shoot_time < MAX_SHOOT_POSE_TIME:
|
||||
new_anim = "falling_weapon"
|
||||
else:
|
||||
new_anim = "falling"
|
||||
|
||||
# Update siding.
|
||||
if new_siding_left != siding_left:
|
||||
if new_siding_left:
|
||||
sprite.scale.x = -1
|
||||
else:
|
||||
sprite.scale.x = 1
|
||||
|
||||
siding_left = new_siding_left
|
||||
|
||||
# Change animation.
|
||||
if new_anim != anim:
|
||||
anim = new_anim
|
||||
animation_player.play(anim)
|
||||
|
||||
shooting = shoot
|
||||
|
||||
# Apply floor velocity.
|
||||
if found_floor:
|
||||
floor_h_velocity = state.get_contact_collider_velocity_at_position(floor_index).x
|
||||
velocity.x += floor_h_velocity
|
||||
|
||||
# Finally, apply gravity and set back the linear velocity.
|
||||
velocity += state.get_total_gravity() * step
|
||||
state.set_linear_velocity(velocity)
|
||||
|
||||
|
||||
func _shot_bullet() -> void:
|
||||
shoot_time = 0
|
||||
var bullet := BULLET_SCENE.instantiate() as RigidBody2D
|
||||
var speed_scale: float
|
||||
if siding_left:
|
||||
speed_scale = -1.0
|
||||
else:
|
||||
speed_scale = 1.0
|
||||
|
||||
bullet.position = position + bullet_shoot.position * Vector2(speed_scale, 1.0)
|
||||
get_parent().add_child(bullet)
|
||||
|
||||
bullet.linear_velocity = Vector2(400.0 * speed_scale, -40)
|
||||
|
||||
sprite_smoke.restart()
|
||||
sound_shoot.play()
|
||||
|
||||
add_collision_exception_with(bullet) # Make bullet and this not collide.
|
||||
|
||||
|
||||
func _spawn_enemy_above() -> void:
|
||||
var enemy := ENEMY_SCENE.instantiate() as RigidBody2D
|
||||
enemy.position = position + 50 * Vector2.UP
|
||||
get_parent().add_child(enemy)
|
||||
278
project/player/player.tscn
Normal file
278
project/player/player.tscn
Normal file
|
|
@ -0,0 +1,278 @@
|
|||
[gd_scene load_steps=20 format=3 uid="uid://bbxsp4gp554vh"]
|
||||
|
||||
[ext_resource type="Script" path="res://player/player.gd" id="1"]
|
||||
[ext_resource type="Texture2D" uid="uid://dh57uloeigwj6" path="res://player/player.webp" id="2_675nc"]
|
||||
[ext_resource type="Texture2D" uid="uid://7sv64orewgmb" path="res://player/bullet.png" id="3"]
|
||||
[ext_resource type="AudioStream" uid="uid://gw2a4ii0oby2" path="res://audio/sound_shoot.wav" id="8"]
|
||||
[ext_resource type="AudioStream" uid="uid://bpyko2i13mj0v" path="res://audio/sound_jump.wav" id="9"]
|
||||
|
||||
[sub_resource type="PhysicsMaterial" id="1"]
|
||||
friction = 0.0
|
||||
|
||||
[sub_resource type="Gradient" id="2"]
|
||||
colors = PackedColorArray(0.708353, 0.72498, 1, 1, 1, 1, 1, 0)
|
||||
|
||||
[sub_resource type="Animation" id="3"]
|
||||
length = 0.01
|
||||
step = 0.25
|
||||
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": [22]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="4"]
|
||||
length = 0.01
|
||||
step = 0.25
|
||||
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": [21]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="5"]
|
||||
length = 0.5
|
||||
step = 0.25
|
||||
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": [26]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="6"]
|
||||
length = 2.0
|
||||
loop_mode = 1
|
||||
step = 0.25
|
||||
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.3575, 0.429, 0.572, 1.287, 1.3585, 1.43, 1.5015),
|
||||
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1, 1),
|
||||
"update": 1,
|
||||
"values": [16, 17, 18, 16, 19, 20, 19, 16]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="7"]
|
||||
length = 0.5
|
||||
step = 0.25
|
||||
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": [25]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="8"]
|
||||
length = 0.5
|
||||
step = 0.25
|
||||
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.25, 0.5),
|
||||
"transitions": PackedFloat32Array(1, 1, 1),
|
||||
"update": 1,
|
||||
"values": [23, 24, 23]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="9"]
|
||||
length = 0.5
|
||||
step = 0.25
|
||||
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": [26]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="10"]
|
||||
length = 0.5
|
||||
loop_mode = 1
|
||||
step = 0.25
|
||||
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, 0.3, 0.4, 0.5),
|
||||
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1),
|
||||
"update": 1,
|
||||
"values": [0, 1, 2, 3, 4, 0]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="11"]
|
||||
length = 0.5
|
||||
loop_mode = 1
|
||||
step = 0.25
|
||||
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, 0.3, 0.4, 0.5),
|
||||
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1),
|
||||
"update": 1,
|
||||
"values": [5, 6, 7, 8, 9, 5]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="12"]
|
||||
length = 0.5
|
||||
loop_mode = 1
|
||||
step = 0.25
|
||||
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, 0.3, 0.4, 0.5),
|
||||
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1),
|
||||
"update": 1,
|
||||
"values": [10, 11, 12, 13, 14, 5]
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_30623"]
|
||||
_data = {
|
||||
"crouch": SubResource("3"),
|
||||
"falling": SubResource("4"),
|
||||
"falling_weapon": SubResource("5"),
|
||||
"idle": SubResource("6"),
|
||||
"idle_weapon": SubResource("7"),
|
||||
"jumping": SubResource("8"),
|
||||
"jumping_weapon": SubResource("9"),
|
||||
"run": SubResource("10"),
|
||||
"run_weapon": SubResource("11"),
|
||||
"standing_weapon_ready": SubResource("12")
|
||||
}
|
||||
|
||||
[sub_resource type="SeparationRayShape2D" id="13"]
|
||||
custom_solver_bias = 0.5
|
||||
length = 18.0
|
||||
|
||||
[node name="Player" type="RigidBody2D"]
|
||||
mass = 1.5
|
||||
physics_material_override = SubResource("1")
|
||||
lock_rotation = true
|
||||
custom_integrator = true
|
||||
max_contacts_reported = 4
|
||||
contact_monitor = true
|
||||
script = ExtResource("1")
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||
texture = ExtResource("2_675nc")
|
||||
hframes = 16
|
||||
vframes = 2
|
||||
frame = 22
|
||||
|
||||
[node name="Smoke" type="CPUParticles2D" parent="Sprite2D"]
|
||||
self_modulate = Color(1, 1, 1, 0.26702)
|
||||
position = Vector2(10, 1.5)
|
||||
rotation = -1.45648
|
||||
emitting = false
|
||||
lifetime = 0.3
|
||||
one_shot = true
|
||||
explosiveness = 1.0
|
||||
texture = ExtResource("3")
|
||||
spread = 65.84
|
||||
gravity = Vector2(0, -15)
|
||||
color_ramp = SubResource("2")
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||
libraries = {
|
||||
"": SubResource("AnimationLibrary_30623")
|
||||
}
|
||||
|
||||
[node name="Camera2D" type="Camera2D" parent="."]
|
||||
zoom = Vector2(2, 2)
|
||||
limit_left = 0
|
||||
limit_top = 0
|
||||
|
||||
[node name="BulletShoot" type="Marker2D" parent="."]
|
||||
position = Vector2(15, 2)
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
position = Vector2(0.15, -6)
|
||||
shape = SubResource("13")
|
||||
|
||||
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="."]
|
||||
polygon = PackedVector2Array(-0.138, 8.25, -10, -12, 11, -12)
|
||||
|
||||
[node name="UI" type="CanvasLayer" parent="."]
|
||||
layer = 0
|
||||
|
||||
[node name="Left" type="TouchScreenButton" parent="UI"]
|
||||
position = Vector2(27.7593, 360.87)
|
||||
scale = Vector2(1.49157, 1.46265)
|
||||
passby_press = true
|
||||
action = "move_left"
|
||||
visibility_mode = 1
|
||||
|
||||
[node name="Right" type="TouchScreenButton" parent="UI"]
|
||||
position = Vector2(121.542, 361.415)
|
||||
scale = Vector2(1.49157, 1.46265)
|
||||
passby_press = true
|
||||
action = "move_right"
|
||||
visibility_mode = 1
|
||||
|
||||
[node name="Jump" type="TouchScreenButton" parent="UI"]
|
||||
position = Vector2(666.224, 359.02)
|
||||
scale = Vector2(1.49157, 1.46265)
|
||||
action = "jump"
|
||||
visibility_mode = 1
|
||||
|
||||
[node name="Fire" type="TouchScreenButton" parent="UI"]
|
||||
position = Vector2(668.073, 262.788)
|
||||
scale = Vector2(1.49157, 1.46265)
|
||||
action = "shoot"
|
||||
visibility_mode = 1
|
||||
|
||||
[node name="SoundShoot" type="AudioStreamPlayer2D" parent="."]
|
||||
stream = ExtResource("8")
|
||||
|
||||
[node name="SoundJump" type="AudioStreamPlayer2D" parent="."]
|
||||
stream = ExtResource("9")
|
||||
BIN
project/player/player.webp
Normal file
BIN
project/player/player.webp
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.7 KiB |
34
project/player/player.webp.import
Normal file
34
project/player/player.webp.import
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://dh57uloeigwj6"
|
||||
path="res://.godot/imported/player.webp-f8efd9c2246a95708b9c4853ed21513e.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://player/player.webp"
|
||||
dest_files=["res://.godot/imported/player.webp-f8efd9c2246a95708b9c4853ed21513e.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=0
|
||||
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