Compare commits
3 Commits
a245ebc135
...
8ba2c94cdf
| Author | SHA1 | Date | |
|---|---|---|---|
| 8ba2c94cdf | |||
| cf080b6088 | |||
| 579397cd8b |
BIN
assets/graphics/objects/grenade.png
Normal file
BIN
assets/graphics/objects/grenade.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 782 B |
40
assets/graphics/objects/grenade.png.import
Normal file
40
assets/graphics/objects/grenade.png.import
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://6vtsx7rnpd7w"
|
||||||
|
path="res://.godot/imported/grenade.png-d1c07918c8a2b35336be824628ce434f.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://assets/graphics/objects/grenade.png"
|
||||||
|
dest_files=["res://.godot/imported/grenade.png-d1c07918c8a2b35336be824628ce434f.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/uastc_level=0
|
||||||
|
compress/rdo_quality_loss=0.0
|
||||||
|
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/channel_remap/red=0
|
||||||
|
process/channel_remap/green=1
|
||||||
|
process/channel_remap/blue=2
|
||||||
|
process/channel_remap/alpha=3
|
||||||
|
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
assets/graphics/objects/small_crate.png
Normal file
BIN
assets/graphics/objects/small_crate.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 417 B |
40
assets/graphics/objects/small_crate.png.import
Normal file
40
assets/graphics/objects/small_crate.png.import
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://dickh4ulsdmhi"
|
||||||
|
path="res://.godot/imported/small_crate.png-88965ed493b5b6f0bfa03d326f4036bf.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://assets/graphics/objects/small_crate.png"
|
||||||
|
dest_files=["res://.godot/imported/small_crate.png-88965ed493b5b6f0bfa03d326f4036bf.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/uastc_level=0
|
||||||
|
compress/rdo_quality_loss=0.0
|
||||||
|
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/channel_remap/red=0
|
||||||
|
process/channel_remap/green=1
|
||||||
|
process/channel_remap/blue=2
|
||||||
|
process/channel_remap/alpha=3
|
||||||
|
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
assets/graphics/player/jump/player jump 48x48.png
Normal file
BIN
assets/graphics/player/jump/player jump 48x48.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1021 B |
40
assets/graphics/player/jump/player jump 48x48.png.import
Normal file
40
assets/graphics/player/jump/player jump 48x48.png.import
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://d2e455oxjbsf5"
|
||||||
|
path="res://.godot/imported/player jump 48x48.png-1ccba0c36041038682bf917e1f6cf991.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://assets/graphics/player/jump/player jump 48x48.png"
|
||||||
|
dest_files=["res://.godot/imported/player jump 48x48.png-1ccba0c36041038682bf917e1f6cf991.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/uastc_level=0
|
||||||
|
compress/rdo_quality_loss=0.0
|
||||||
|
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/channel_remap/red=0
|
||||||
|
process/channel_remap/green=1
|
||||||
|
process/channel_remap/blue=2
|
||||||
|
process/channel_remap/alpha=3
|
||||||
|
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
|
||||||
@ -1,6 +1,7 @@
|
|||||||
[gd_scene format=3 uid="uid://wt8o0uyqblsv"]
|
[gd_scene format=3 uid="uid://wt8o0uyqblsv"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://dn8v5sbqg05v3" path="res://scripts/brown_box.gd" id="1_g34fy"]
|
[ext_resource type="Script" uid="uid://dn8v5sbqg05v3" path="res://scripts/brown_box.gd" id="1_g34fy"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://dickh4ulsdmhi" path="res://assets/graphics/objects/small_crate.png" id="2_g748q"]
|
||||||
|
|
||||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_o3qty"]
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_o3qty"]
|
||||||
|
|
||||||
@ -11,3 +12,9 @@ metadata/_edit_group_ = true
|
|||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="." unique_id=274978092]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="." unique_id=274978092]
|
||||||
shape = SubResource("RectangleShape2D_o3qty")
|
shape = SubResource("RectangleShape2D_o3qty")
|
||||||
debug_color = Color(0.8449452, 0.37733862, 0.08704034, 0.41960785)
|
debug_color = Color(0.8449452, 0.37733862, 0.08704034, 0.41960785)
|
||||||
|
|
||||||
|
[node name="Sprite2D" type="Sprite2D" parent="." unique_id=1891218599]
|
||||||
|
texture_filter = 1
|
||||||
|
position = Vector2(3.874302e-07, 0.49999928)
|
||||||
|
scale = Vector2(0.55, 0.5609756)
|
||||||
|
texture = ExtResource("2_g748q")
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
[gd_scene format=3 uid="uid://cncmlpntwxxx5"]
|
[gd_scene format=3 uid="uid://cncmlpntwxxx5"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://bwjaypkvgpb6t" path="res://scripts/grenade.gd" id="1_cvyik"]
|
[ext_resource type="Script" uid="uid://bwjaypkvgpb6t" path="res://scripts/grenade.gd" id="1_cvyik"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://6vtsx7rnpd7w" path="res://assets/graphics/objects/grenade.png" id="2_wxtds"]
|
||||||
|
|
||||||
[sub_resource type="CircleShape2D" id="CircleShape2D_1xt3t"]
|
[sub_resource type="CircleShape2D" id="CircleShape2D_1xt3t"]
|
||||||
radius = 5.0
|
radius = 5.0
|
||||||
@ -15,4 +16,8 @@ metadata/_edit_group_ = true
|
|||||||
shape = SubResource("CircleShape2D_1xt3t")
|
shape = SubResource("CircleShape2D_1xt3t")
|
||||||
debug_color = Color(0.8627451, 0.03137255, 0.20392157, 0.41960785)
|
debug_color = Color(0.8627451, 0.03137255, 0.20392157, 0.41960785)
|
||||||
|
|
||||||
|
[node name="Sprite2D" type="Sprite2D" parent="." unique_id=1803673568]
|
||||||
|
texture_filter = 1
|
||||||
|
texture = ExtResource("2_wxtds")
|
||||||
|
|
||||||
[connection signal="body_entered" from="." to="." method="_on_body_entered"]
|
[connection signal="body_entered" from="." to="." method="_on_body_entered"]
|
||||||
|
|||||||
@ -1,11 +1,20 @@
|
|||||||
[gd_scene format=3 uid="uid://bhsvqyhsemekq"]
|
[gd_scene format=3 uid="uid://bhsvqyhsemekq"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://dlmf1p0vfitcx" path="res://scripts/player.gd" id="1_3vyb7"]
|
[ext_resource type="Script" uid="uid://dlmf1p0vfitcx" path="res://scripts/player.gd" id="1_3vyb7"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://d2e455oxjbsf5" path="res://assets/graphics/player/jump/player jump 48x48.png" id="2_dqkch"]
|
||||||
[ext_resource type="Texture2D" uid="uid://dio2ufnpnihce" path="res://assets/graphics/player/idle/Player Idle 48x48.png" id="2_g2els"]
|
[ext_resource type="Texture2D" uid="uid://dio2ufnpnihce" path="res://assets/graphics/player/idle/Player Idle 48x48.png" id="2_g2els"]
|
||||||
[ext_resource type="Texture2D" uid="uid://bl7p2n2kgw2qx" path="res://assets/graphics/player/idle/player run 48x48.png" id="3_qhqgy"]
|
[ext_resource type="Texture2D" uid="uid://bl7p2n2kgw2qx" path="res://assets/graphics/player/idle/player run 48x48.png" id="3_qhqgy"]
|
||||||
|
|
||||||
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_elsnr"]
|
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_elsnr"]
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_4ni07"]
|
||||||
|
atlas = ExtResource("2_dqkch")
|
||||||
|
region = Rect2(48, 0, 48, 48)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_i4ail"]
|
||||||
|
atlas = ExtResource("2_dqkch")
|
||||||
|
region = Rect2(96, 0, 48, 48)
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_qhqgy"]
|
[sub_resource type="AtlasTexture" id="AtlasTexture_qhqgy"]
|
||||||
atlas = ExtResource("2_g2els")
|
atlas = ExtResource("2_g2els")
|
||||||
region = Rect2(0, 0, 48, 48)
|
region = Rect2(0, 0, 48, 48)
|
||||||
@ -46,6 +55,10 @@ region = Rect2(384, 0, 48, 48)
|
|||||||
atlas = ExtResource("2_g2els")
|
atlas = ExtResource("2_g2els")
|
||||||
region = Rect2(432, 0, 48, 48)
|
region = Rect2(432, 0, 48, 48)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_a38lo"]
|
||||||
|
atlas = ExtResource("2_dqkch")
|
||||||
|
region = Rect2(0, 0, 48, 48)
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_jej6c"]
|
[sub_resource type="AtlasTexture" id="AtlasTexture_jej6c"]
|
||||||
atlas = ExtResource("3_qhqgy")
|
atlas = ExtResource("3_qhqgy")
|
||||||
region = Rect2(0, 0, 48, 48)
|
region = Rect2(0, 0, 48, 48)
|
||||||
@ -82,6 +95,22 @@ region = Rect2(336, 0, 48, 48)
|
|||||||
animations = [{
|
animations = [{
|
||||||
"frames": [{
|
"frames": [{
|
||||||
"duration": 1.0,
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_4ni07")
|
||||||
|
}],
|
||||||
|
"loop": false,
|
||||||
|
"name": &"apex",
|
||||||
|
"speed": 12.0
|
||||||
|
}, {
|
||||||
|
"frames": [{
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_i4ail")
|
||||||
|
}],
|
||||||
|
"loop": false,
|
||||||
|
"name": &"fall",
|
||||||
|
"speed": 12.0
|
||||||
|
}, {
|
||||||
|
"frames": [{
|
||||||
|
"duration": 1.0,
|
||||||
"texture": SubResource("AtlasTexture_qhqgy")
|
"texture": SubResource("AtlasTexture_qhqgy")
|
||||||
}, {
|
}, {
|
||||||
"duration": 1.0,
|
"duration": 1.0,
|
||||||
@ -117,6 +146,14 @@ animations = [{
|
|||||||
}, {
|
}, {
|
||||||
"frames": [{
|
"frames": [{
|
||||||
"duration": 1.0,
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_a38lo")
|
||||||
|
}],
|
||||||
|
"loop": false,
|
||||||
|
"name": &"jump",
|
||||||
|
"speed": 12.0
|
||||||
|
}, {
|
||||||
|
"frames": [{
|
||||||
|
"duration": 1.0,
|
||||||
"texture": SubResource("AtlasTexture_jej6c")
|
"texture": SubResource("AtlasTexture_jej6c")
|
||||||
}, {
|
}, {
|
||||||
"duration": 1.0,
|
"duration": 1.0,
|
||||||
@ -169,6 +206,7 @@ position = Vector2(-10, -12)
|
|||||||
texture_filter = 1
|
texture_filter = 1
|
||||||
position = Vector2(0, -1)
|
position = Vector2(0, -1)
|
||||||
sprite_frames = SubResource("SpriteFrames_jej6c")
|
sprite_frames = SubResource("SpriteFrames_jej6c")
|
||||||
animation = &"run"
|
animation = &"apex"
|
||||||
autoplay = "idle"
|
autoplay = "idle"
|
||||||
frame_progress = 0.8670586
|
|
||||||
|
[connection signal="animation_finished" from="graphic" to="." method="_on_graphic_animation_finished"]
|
||||||
|
|||||||
@ -12,8 +12,9 @@ var direction : float = 0
|
|||||||
enum FaceDirection { LEFT, RIGHT }
|
enum FaceDirection { LEFT, RIGHT }
|
||||||
var facing: FaceDirection = FaceDirection.LEFT
|
var facing: FaceDirection = FaceDirection.LEFT
|
||||||
var shove_target: RigidBody2D
|
var shove_target: RigidBody2D
|
||||||
enum State { IDLE, RUNNING }
|
enum State { IDLE, RUN, JUMP, APEX, FALL }
|
||||||
var state: State = State.IDLE
|
var state: State = State.IDLE
|
||||||
|
var up_jump:bool = false
|
||||||
|
|
||||||
func _physics_process(delta: float):
|
func _physics_process(delta: float):
|
||||||
handle_input()
|
handle_input()
|
||||||
@ -73,13 +74,34 @@ func handle_collisions():
|
|||||||
func handle_state():
|
func handle_state():
|
||||||
match state:
|
match state:
|
||||||
State.IDLE when velocity.x != 0:
|
State.IDLE when velocity.x != 0:
|
||||||
state = State.RUNNING
|
state = State.RUN
|
||||||
State.RUNNING when velocity.x == 0:
|
State.RUN when velocity.x == 0:
|
||||||
|
state = State.IDLE
|
||||||
|
State.RUN when velocity.y < 0:
|
||||||
|
state = State.JUMP
|
||||||
|
State.IDLE when velocity.y < 0:
|
||||||
|
state = State.JUMP
|
||||||
|
State.JUMP when velocity.y > 0:
|
||||||
|
state = State.APEX
|
||||||
|
# from APEX to FALL is handled when apex animation finishes
|
||||||
|
State.FALL when velocity.y == 0:
|
||||||
state = State.IDLE
|
state = State.IDLE
|
||||||
|
|
||||||
func handle_animation():
|
func handle_animation():
|
||||||
match state:
|
match state:
|
||||||
State.IDLE:
|
State.IDLE:
|
||||||
graphic.play("idle")
|
graphic.play("idle")
|
||||||
State.RUNNING:
|
State.RUN:
|
||||||
graphic.play("run")
|
graphic.play("run")
|
||||||
|
State.JUMP:
|
||||||
|
graphic.play("jump")
|
||||||
|
State.APEX:
|
||||||
|
graphic.play("apex")
|
||||||
|
State.FALL:
|
||||||
|
graphic.play("fall")
|
||||||
|
|
||||||
|
func _on_graphic_animation_finished() -> void:
|
||||||
|
# switch state from apex to fall
|
||||||
|
match state:
|
||||||
|
State.APEX:
|
||||||
|
state = State.FALL
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user