player death working

This commit is contained in:
OddlyTimbot 2024-08-12 17:43:39 -04:00
parent eebf4c2922
commit 03f366b0e1
43 changed files with 287 additions and 138 deletions

View File

@ -36,4 +36,12 @@ Markdown syntax [here](https://www.markdownguide.org/basic-syntax/)
Export a clean git-free copy of any week:
```git archive -o ../weekX.zip HEAD:weekX``
`git archive -o ../weekX.zip HEAD:weekX`
Set your user name:
`git config --global user.name "Mona Lisa"`
Set your email:
`git config --global user.email "mona@lisa.com"`

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1021 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

View File

@ -172,4 +172,4 @@ Anim={
"zfar": 4000.01,
"znear": 0.05
}
selected_nodes=Array[NodePath]([NodePath("/root/@EditorNode@17140/@Panel@13/@VBoxContainer@14/@HSplitContainer@17/@HSplitContainer@25/@HSplitContainer@33/@VBoxContainer@34/@VSplitContainer@36/@VSplitContainer@62/@VBoxContainer@63/@PanelContainer@110/MainScreen/@CanvasItemEditor@9462/@VSplitContainer@9281/@HSplitContainer@9283/@HSplitContainer@9285/@Control@9286/@SubViewportContainer@9287/@SubViewport@9288/Game/crates/boxtrap")])
selected_nodes=Array[NodePath]([NodePath("/root/@EditorNode@17140/@Panel@13/@VBoxContainer@14/@HSplitContainer@17/@HSplitContainer@25/@HSplitContainer@33/@VBoxContainer@34/@VSplitContainer@36/@VSplitContainer@62/@VBoxContainer@63/@PanelContainer@110/MainScreen/@CanvasItemEditor@9462/@VSplitContainer@9281/@HSplitContainer@9283/@HSplitContainer@9285/@Control@9286/@SubViewportContainer@9287/@SubViewport@9288/CharacterBody2D/AnimatedSprite2D")])

View File

@ -1,5 +1,5 @@
[folding]
node_unfolds=[NodePath("AnimatedSprite2D"), PackedStringArray("Animation")]
node_unfolds=[NodePath("AnimatedSprite2D"), PackedStringArray("Animation", "sprite_frames")]
resource_unfolds=["res://scenes/badguy.tscn::SpriteFrames_oohu0", PackedStringArray(), "res://scenes/badguy.tscn::RectangleShape2D_jipcy", PackedStringArray()]
nodes_folded=[]

View File

@ -172,4 +172,4 @@ Anim={
"zfar": 4000.01,
"znear": 0.05
}
selected_nodes=Array[NodePath]([NodePath("/root/@EditorNode@17140/@Panel@13/@VBoxContainer@14/@HSplitContainer@17/@HSplitContainer@25/@HSplitContainer@33/@VBoxContainer@34/@VSplitContainer@36/@VSplitContainer@62/@VBoxContainer@63/@PanelContainer@110/MainScreen/@CanvasItemEditor@9462/@VSplitContainer@9281/@HSplitContainer@9283/@HSplitContainer@9285/@Control@9286/@SubViewportContainer@9287/@SubViewport@9288/Game/crates/boxtrap")])
selected_nodes=Array[NodePath]([NodePath("/root/@EditorNode@17140/@Panel@13/@VBoxContainer@14/@HSplitContainer@17/@HSplitContainer@25/@HSplitContainer@33/@VBoxContainer@34/@VSplitContainer@36/@VSplitContainer@62/@VBoxContainer@63/@PanelContainer@110/MainScreen/@CanvasItemEditor@9462/@VSplitContainer@9281/@HSplitContainer@9283/@HSplitContainer@9285/@Control@9286/@SubViewportContainer@9287/@SubViewport@9288/CharacterBody2D/AnimatedSprite2D")])

View File

@ -172,4 +172,4 @@ Anim={
"zfar": 4000.01,
"znear": 0.05
}
selected_nodes=Array[NodePath]([NodePath("/root/@EditorNode@17140/@Panel@13/@VBoxContainer@14/@HSplitContainer@17/@HSplitContainer@25/@HSplitContainer@33/@VBoxContainer@34/@VSplitContainer@36/@VSplitContainer@62/@VBoxContainer@63/@PanelContainer@110/MainScreen/@CanvasItemEditor@9462/@VSplitContainer@9281/@HSplitContainer@9283/@HSplitContainer@9285/@Control@9286/@SubViewportContainer@9287/@SubViewport@9288/Game/crates/boxtrap")])
selected_nodes=Array[NodePath]([NodePath("/root/@EditorNode@17140/@Panel@13/@VBoxContainer@14/@HSplitContainer@17/@HSplitContainer@25/@HSplitContainer@33/@VBoxContainer@34/@VSplitContainer@36/@VSplitContainer@62/@VBoxContainer@63/@PanelContainer@110/MainScreen/@CanvasItemEditor@9462/@VSplitContainer@9281/@HSplitContainer@9283/@HSplitContainer@9285/@Control@9286/@SubViewportContainer@9287/@SubViewport@9288/CharacterBody2D/AnimatedSprite2D")])

View File

@ -172,4 +172,4 @@ Anim={
"zfar": 4000.01,
"znear": 0.05
}
selected_nodes=Array[NodePath]([NodePath("/root/@EditorNode@17140/@Panel@13/@VBoxContainer@14/@HSplitContainer@17/@HSplitContainer@25/@HSplitContainer@33/@VBoxContainer@34/@VSplitContainer@36/@VSplitContainer@62/@VBoxContainer@63/@PanelContainer@110/MainScreen/@CanvasItemEditor@9462/@VSplitContainer@9281/@HSplitContainer@9283/@HSplitContainer@9285/@Control@9286/@SubViewportContainer@9287/@SubViewport@9288/Game/crates/boxtrap")])
selected_nodes=Array[NodePath]([NodePath("/root/@EditorNode@17140/@Panel@13/@VBoxContainer@14/@HSplitContainer@17/@HSplitContainer@25/@HSplitContainer@33/@VBoxContainer@34/@VSplitContainer@36/@VSplitContainer@62/@VBoxContainer@63/@PanelContainer@110/MainScreen/@CanvasItemEditor@9462/@VSplitContainer@9281/@HSplitContainer@9283/@HSplitContainer@9285/@Control@9286/@SubViewportContainer@9287/@SubViewport@9288/CharacterBody2D/AnimatedSprite2D")])

View File

@ -1,5 +1,6 @@
Node
RayCast2D
Timer
Node
CollisionShape2D
AnimatedSprite2D
Area2D
@ -11,5 +12,3 @@ ParallaxBackground
AnimationPlayer
AnimatableBody2D
StaticBody2D
Camera2D
TileMap

View File

@ -4,7 +4,7 @@ dock_1_selected_tab_idx=0
dock_2_selected_tab_idx=0
dock_3_selected_tab_idx=0
dock_4_selected_tab_idx=0
dock_5_selected_tab_idx=1
dock_5_selected_tab_idx=0
dock_6_selected_tab_idx=0
dock_7_selected_tab_idx=0
dock_8_selected_tab_idx=0
@ -19,7 +19,7 @@ dock_filesystem_split=0
dock_filesystem_display_mode=0
dock_filesystem_file_sort=0
dock_filesystem_file_list_display_mode=1
dock_filesystem_selected_paths=PackedStringArray("res://scenes/game.tscn")
dock_filesystem_selected_paths=PackedStringArray("res://graphics/Player Death/")
dock_filesystem_uncollapsed_paths=PackedStringArray("Favorites", "res://", "res://scripts/", "res://scenes/", "res://graphics/")
dock_3="Scene,Import"
dock_4="FileSystem"
@ -28,16 +28,16 @@ dock_5="Inspector,Node,History"
[EditorNode]
open_scenes=PackedStringArray("res://scenes/game.tscn", "res://scenes/character.tscn", "res://scenes/bullet.tscn", "res://scenes/crate.tscn", "res://scenes/badguy.tscn")
current_scene="res://scenes/game.tscn"
current_scene="res://scenes/character.tscn"
center_split_offset=-325
selected_default_debugger_tab_idx=0
selected_main_editor_idx=2
selected_bottom_panel_item=1
selected_bottom_panel_item=0
[ScriptEditor]
open_scripts=["res://scripts/badguy.gd", "res://scripts/bullet.gd", "res://scripts/CharacterBody2D.gd", "res://scripts/coin.gd", "res://scripts/gamecontroller.gd", "res://scripts/Trigger.gd"]
selected_script="res://scripts/gamecontroller.gd"
selected_script="res://scripts/CharacterBody2D.gd"
open_help=[]
script_split_offset=70
list_split_offset=0

View File

@ -1,7 +1,7 @@
ea4bc82a6ad023ab7ee23ee620429895
::res://::1723489485
::res://::1723498498
icon.svg::CompressedTexture2D::9114977118871582245::1723471253::1723471253::1::::<><>::
::res://graphics/::1723485469
::res://graphics/::1723498498
coin.png::CompressedTexture2D::7063880403899111552::1723478773::1723478782::1::::<><>::
slime_green.png::CompressedTexture2D::6822447834752212284::1723485459::1723485469::1::::<><>::
Terrain (32x32).png::CompressedTexture2D::8707534964839485024::1723471253::1723471253::1::::<><>::
@ -11,6 +11,8 @@ Additional Water.png::CompressedTexture2D::2205427413754203696::1723471253::1723
BG Image.png::CompressedTexture2D::7982657594202931692::1723471253::1723471253::1::::<><>::
::res://graphics/items/::1723471253
cannister.png::CompressedTexture2D::7418095402531000042::1723471253::1723471253::1::::<><>::
::res://graphics/Player Death/::1723498498
Player Death 64x64.png::CompressedTexture2D::3957659989390306955::1723498475::1723498498::1::::<><>::
::res://graphics/Player Idle/::1723471253
Player Idle 48x48.png::CompressedTexture2D::6544563428604246579::1723471253::1723471253::1::::<><>::
::res://graphics/Player Jump/::1723471253
@ -19,20 +21,20 @@ player jump 48x48.png::CompressedTexture2D::1627608568707791839::1723471253::172
player land 48x48.png::CompressedTexture2D::3499637713582873633::1723471253::1723471253::1::::<><>::
::res://graphics/Player Run/::1723471253
player run 48x48.png::CompressedTexture2D::1502492849971408816::1723471253::1723471253::1::::<><>::
::res://scenes/::1723489409
::res://scenes/::1723498484
area_trigger.tscn::PackedScene::2953141911562060689::1723489409::0::1::::<><>::res://scripts/Trigger.gd
badguy.tscn::PackedScene::6008886082592391168::1723489409::0::1::::<><>::res://scripts/badguy.gd<>uid://c4g3ypigewuuu::::res://graphics/slime_green.png
bullet.tscn::PackedScene::6880909734590904373::1723489409::0::1::::<><>::res://scripts/bullet.gd
character.tscn::PackedScene::451838158579532324::1723489409::0::1::::<><>::res://scripts/CharacterBody2D.gd<>uid://c0iiaebonyhh0::::res://graphics/Player Idle/Player Idle 48x48.png<>uid://xgoqfqmvorcx::::res://graphics/Player Jump/player jump 48x48.png<>uid://vn23qn3f0dvc::::res://graphics/Player Run/player run 48x48.png
badguy.tscn::PackedScene::8923528729538756339::1723498062::0::1::::<><>::res://scripts/badguy.gd<>uid://c4g3ypigewuuu::::res://graphics/slime_green.png
bullet.tscn::PackedScene::6880909734590904373::1723498062::0::1::::<><>::res://scripts/bullet.gd
character.tscn::PackedScene::451838158579532324::1723498062::0::1::::<><>::res://scripts/CharacterBody2D.gd<>uid://c0iiaebonyhh0::::res://graphics/Player Idle/Player Idle 48x48.png<>uid://xgoqfqmvorcx::::res://graphics/Player Jump/player jump 48x48.png<>uid://vn23qn3f0dvc::::res://graphics/Player Run/player run 48x48.png
coin.tscn::PackedScene::61828818800194477::1723489409::0::1::::<><>::uid://c7v2cwn2826lg::::res://graphics/coin.png<>res://scripts/coin.gd
crate.tscn::PackedScene::41931541512830250::1723489409::0::1::::<><>::uid://ddxm7hj323fta::::res://graphics/items/cannister.png
game.tscn::PackedScene::1738196330916037717::1723489409::0::1::::<><>::res://scripts/gamecontroller.gd<>uid://go4yc8hfo1gq::::res://scenes/character.tscn<>uid://dwb83f7uoweuy::::res://graphics/Terrain (32x32).png<>uid://ukuu7p7vhlq::::res://scenes/crate.tscn<>uid://dvd1p6xue0ub2::::res://scenes/platform.tscn<>uid://dly4g7fvvtamm::::res://graphics/background/BG Image.png<>uid://bicr20de8c3jp::::res://scenes/area_trigger.tscn<>uid://cw50mfjp2np08::::res://graphics/background/Additional Sky.png<>uid://6olcj1w1svdg::::res://graphics/background/Additional Water.png<>uid://47kuhu1ukph::::res://scenes/coin.tscn<>uid://cru0qgdvvcc61::::res://scenes/badguy.tscn
crate.tscn::PackedScene::41931541512830250::1723498062::0::1::::<><>::uid://ddxm7hj323fta::::res://graphics/items/cannister.png
game.tscn::PackedScene::1738196330916037717::1723498062::0::1::::<><>::res://scripts/gamecontroller.gd<>uid://go4yc8hfo1gq::::res://scenes/character.tscn<>uid://dwb83f7uoweuy::::res://graphics/Terrain (32x32).png<>uid://ukuu7p7vhlq::::res://scenes/crate.tscn<>uid://dvd1p6xue0ub2::::res://scenes/platform.tscn<>uid://dly4g7fvvtamm::::res://graphics/background/BG Image.png<>uid://bicr20de8c3jp::::res://scenes/area_trigger.tscn<>uid://cw50mfjp2np08::::res://graphics/background/Additional Sky.png<>uid://6olcj1w1svdg::::res://graphics/background/Additional Water.png<>uid://47kuhu1ukph::::res://scenes/coin.tscn<>uid://d0evhj5ayp0ep::::res://scenes/badguy.tscn
menu.tscn::PackedScene::1738029604261438007::1723489409::0::1::::<><>::
platform.tscn::PackedScene::8641027994130079701::1723489409::0::1::::<><>::
::res://scripts/::1723488948
badguy.gd::GDScript::-1::1723486639::0::1::::<>Node2D<>::
::res://scripts/::1723498059
badguy.gd::GDScript::-1::1723497774::0::1::::<>Area2D<>::
bullet.gd::GDScript::-1::1723471253::0::1::::<>Area2D<>::
CharacterBody2D.gd::GDScript::-1::1723471253::0::1::::<>CharacterBody2D<>::
coin.gd::GDScript::-1::1723482986::0::1::::<>Area2D<>::
gamecontroller.gd::GDScript::-1::1723488948::0::1::::<>Node2D<>::
CharacterBody2D.gd::GDScript::-1::1723498059::0::1::::<>CharacterBody2D<>::
coin.gd::GDScript::-1::1723497967::0::1::::<>Area2D<>::
gamecontroller.gd::GDScript::-1::1723497262::0::1::::<>Node<>::
Trigger.gd::GDScript::-1::1723471253::0::1::::<>Area2D<>::

View File

@ -1,8 +1,9 @@
res://scenes/badguy.tscn
res://scenes/game.tscn
res://scripts/badguy.gd
res://scenes/character.tscn
res://scenes/bullet.tscn
res://scenes/crate.tscn
res://scenes/badguy.tscn
res://scripts/gamecontroller.gd
res://scripts/badguy.gd
res://scripts/coin.gd
res://scripts/CharacterBody2D.gd

View File

@ -8,7 +8,7 @@ Anim={
"grid_snap_active": false,
"grid_step": Vector2(8, 8),
"grid_visibility": 1,
"ofs": Vector2(-315.322, -167.563),
"ofs": Vector2(-211.33, -217.599),
"primary_grid_step": Vector2i(8, 8),
"show_edit_locks": true,
"show_guides": true,
@ -32,7 +32,7 @@ Anim={
"snap_rotation_step": 0.261799,
"snap_scale": false,
"snap_scale_step": 0.1,
"zoom": 1.7818
"zoom": 1.41421
}
3D={
"fov": 70.01,
@ -172,4 +172,4 @@ Anim={
"zfar": 4000.01,
"znear": 0.05
}
selected_nodes=Array[NodePath]([NodePath("/root/@EditorNode@17140/@Panel@13/@VBoxContainer@14/@HSplitContainer@17/@HSplitContainer@25/@HSplitContainer@33/@VBoxContainer@34/@VSplitContainer@36/@VSplitContainer@62/@VBoxContainer@63/@PanelContainer@110/MainScreen/@CanvasItemEditor@9462/@VSplitContainer@9281/@HSplitContainer@9283/@HSplitContainer@9285/@Control@9286/@SubViewportContainer@9287/@SubViewport@9288/Game/crates/boxtrap")])
selected_nodes=Array[NodePath]([NodePath("/root/@EditorNode@17140/@Panel@13/@VBoxContainer@14/@HSplitContainer@17/@HSplitContainer@25/@HSplitContainer@33/@VBoxContainer@34/@VSplitContainer@36/@VSplitContainer@62/@VBoxContainer@63/@PanelContainer@110/MainScreen/@CanvasItemEditor@9462/@VSplitContainer@9281/@HSplitContainer@9283/@HSplitContainer@9285/@Control@9286/@SubViewportContainer@9287/@SubViewport@9288/CharacterBody2D/AnimatedSprite2D")])

View File

@ -1,5 +1,5 @@
[folding]
node_unfolds=[NodePath("."), PackedStringArray("Transform"), NodePath("TileMap"), PackedStringArray("layer__array", "tile_set"), NodePath("ParallaxBackground/ParallaxLayer"), PackedStringArray("Motion"), NodePath("ParallaxBackground/ParallaxLayer/Sprite2D"), PackedStringArray("Transform", "texture"), NodePath("level"), PackedStringArray("Transform"), NodePath("Platform"), PackedStringArray("Transform")]
node_unfolds=[NodePath("."), PackedStringArray("Transform"), NodePath("TileMap"), PackedStringArray("layer__array", "tile_set"), NodePath("ParallaxBackground/ParallaxLayer"), PackedStringArray("Motion"), NodePath("ParallaxBackground/ParallaxLayer/Sprite2D"), PackedStringArray("Transform", "texture"), NodePath("Ground"), PackedStringArray("Transform"), NodePath("MovingPlatform"), PackedStringArray("Transform")]
resource_unfolds=["res://scenes/game.tscn::TileSet_47g5u", PackedStringArray("terrain_set_0/terrain__array", "physics_layer__array"), "res://scenes/game.tscn::WorldBoundaryShape2D_xkyim", PackedStringArray(), "res://scenes/game.tscn::CircleShape2D_j8ltg", PackedStringArray()]
nodes_folded=[NodePath("ParallaxBackground/ParallaxLayer"), NodePath("level"), NodePath("CharacterBody2D")]
nodes_folded=[NodePath("ParallaxBackground"), NodePath("ParallaxBackground/ParallaxLayer"), NodePath("Ground"), NodePath("CharacterBody2D"), NodePath("BoxTrapTrigger"), NodePath("crates"), NodePath("MovingPlatform")]

View File

@ -10,11 +10,11 @@ tile_snap_subdiv=4.0
run_live_debug=true
run_reload_scripts=true
run_debug_collisions=true
run_debug_collisions=false
[recent_files]
scenes=["res://scenes/game.tscn", "res://scenes/badguy.tscn", "res://scenes/area_trigger.tscn", "res://scenes/coin.tscn", "res://scenes/menu.tscn", "res://scenes/platform.tscn", "res://scenes/crate.tscn", "res://scenes/bullet.tscn", "res://scenes/character.tscn", "res://scenes/animatedcoin.tscn"]
scenes=["res://scenes/badguy.tscn", "res://scenes/crate.tscn", "res://scenes/bullet.tscn", "res://scenes/character.tscn", "res://scenes/game.tscn", "res://scenes/area_trigger.tscn", "res://scenes/coin.tscn", "res://scenes/menu.tscn", "res://scenes/platform.tscn", "res://scenes/animatedcoin.tscn"]
scripts=["res://scripts/badguy.gd", "res://scripts/coin.gd", "res://scripts/Trigger.gd", "res://scripts/bullet.gd", "res://scripts/CharacterBody2D.gd", "res://scripts/gamecontroller.gd"]
[linked_properties]

View File

@ -1,3 +1,4 @@
res://graphics/Player Death
res://scripts
res://scenes
res://graphics

View File

@ -3,11 +3,11 @@
state={
"bookmarks": PackedInt32Array(),
"breakpoints": PackedInt32Array(),
"column": 43,
"column": 19,
"folded_lines": Array[int]([]),
"h_scroll_position": 0,
"row": 7,
"scroll_position": 1.0,
"row": 27,
"scroll_position": 20.0,
"selection": false,
"syntax_highlighter": "GDScript"
}
@ -17,11 +17,11 @@ state={
state={
"bookmarks": PackedInt32Array(),
"breakpoints": PackedInt32Array(),
"column": 26,
"column": 11,
"folded_lines": Array[int]([]),
"h_scroll_position": 0,
"row": 53,
"scroll_position": 54.0,
"row": 34,
"scroll_position": 26.0,
"selection": false,
"syntax_highlighter": "GDScript"
}
@ -45,10 +45,10 @@ state={
state={
"bookmarks": PackedInt32Array(),
"breakpoints": PackedInt32Array(),
"column": 17,
"column": 14,
"folded_lines": Array[int]([]),
"h_scroll_position": 0,
"row": 2,
"row": 8,
"scroll_position": 0.0,
"selection": false,
"syntax_highlighter": "GDScript"
@ -73,11 +73,11 @@ state={
state={
"bookmarks": PackedInt32Array(),
"breakpoints": PackedInt32Array(),
"column": 17,
"column": 23,
"folded_lines": Array[int]([]),
"h_scroll_position": 0,
"row": 7,
"scroll_position": 0.0,
"row": 27,
"scroll_position": 12.0,
"selection": false,
"syntax_highlighter": "GDScript"
}

View File

@ -0,0 +1,3 @@
source_md5="e5256a9ceb0ab699f4b89ff036b2a902"
dest_md5="9cd9459a73f825afbfd37992d6a40bfb"

View File

@ -0,0 +1,3 @@
source_md5="e5256a9ceb0ab699f4b89ff036b2a902"
dest_md5="9cd9459a73f825afbfd37992d6a40bfb"

View File

@ -0,0 +1,3 @@
source_md5="e5256a9ceb0ab699f4b89ff036b2a902"
dest_md5="9cd9459a73f825afbfd37992d6a40bfb"

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bwnec1thq1btr"
path="res://.godot/imported/Player Death 64x64.png-264389d563a3f9dc55af6fd3aea47ce0.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://graphics/Player Death/Player Death 64x64.png"
dest_files=["res://.godot/imported/Player Death 64x64.png-264389d563a3f9dc55af6fd3aea47ce0.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

View File

@ -40,7 +40,7 @@ animations = [{
}]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_jipcy"]
size = Vector2(17, 14)
size = Vector2(17, 15)
[node name="Area2D" type="Area2D"]
script = ExtResource("1_ees8e")
@ -56,7 +56,15 @@ target_position = Vector2(15, 0)
target_position = Vector2(-16, 0)
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2(-0.5, 5)
position = Vector2(-0.5, 4.5)
shape = SubResource("RectangleShape2D_jipcy")
[node name="CastFloorRight" type="RayCast2D" parent="."]
position = Vector2(10, 1)
target_position = Vector2(0, 14)
[node name="CastFloorLeft" type="RayCast2D" parent="."]
position = Vector2(-11, 0)
target_position = Vector2(0, 14)
[connection signal="body_entered" from="." to="." method="_on_body_entered"]

View File

@ -1,10 +1,39 @@
[gd_scene load_steps=28 format=3 uid="uid://go4yc8hfo1gq"]
[gd_scene load_steps=36 format=3 uid="uid://go4yc8hfo1gq"]
[ext_resource type="Script" path="res://scripts/CharacterBody2D.gd" id="1_x87yo"]
[ext_resource type="Texture2D" uid="uid://c0iiaebonyhh0" path="res://graphics/Player Idle/Player Idle 48x48.png" id="2_hyqch"]
[ext_resource type="Texture2D" uid="uid://bwnec1thq1btr" path="res://graphics/Player Death/Player Death 64x64.png" id="2_pndqh"]
[ext_resource type="Texture2D" uid="uid://xgoqfqmvorcx" path="res://graphics/Player Jump/player jump 48x48.png" id="3_mp84c"]
[ext_resource type="Texture2D" uid="uid://vn23qn3f0dvc" path="res://graphics/Player Run/player run 48x48.png" id="4_bok64"]
[sub_resource type="AtlasTexture" id="AtlasTexture_dlawb"]
atlas = ExtResource("2_pndqh")
region = Rect2(0, 0, 43, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_6goxi"]
atlas = ExtResource("2_pndqh")
region = Rect2(43, 0, 43, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_w5uym"]
atlas = ExtResource("2_pndqh")
region = Rect2(86, 0, 43, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_4d8rt"]
atlas = ExtResource("2_pndqh")
region = Rect2(129, 0, 43, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_5boyf"]
atlas = ExtResource("2_pndqh")
region = Rect2(344, 0, 43, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_bhip8"]
atlas = ExtResource("2_pndqh")
region = Rect2(387, 0, 43, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_si011"]
atlas = ExtResource("2_pndqh")
region = Rect2(430, 0, 43, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_htcu2"]
atlas = ExtResource("2_hyqch")
region = Rect2(0, 0, 48, 48)
@ -93,6 +122,32 @@ region = Rect2(336, 0, 48, 48)
animations = [{
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_dlawb")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_6goxi")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_w5uym")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_4d8rt")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_5boyf")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_bhip8")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_si011")
}],
"loop": false,
"name": &"death",
"speed": 15.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_htcu2")
}, {
"duration": 1.0,
@ -182,7 +237,7 @@ metadata/_edit_group_ = true
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
texture_filter = 1
sprite_frames = SubResource("SpriteFrames_a6t6h")
animation = &"idle"
animation = &"death"
autoplay = "idle"
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]

View File

@ -525,6 +525,8 @@ _data = {
unique_name_in_owner = true
script = ExtResource("1_77wyw")
[node name="Timer" type="Timer" parent="GameManager"]
[node name="TileMap" type="TileMap" parent="."]
tile_set = SubResource("TileSet_47g5u")
format = 2
@ -549,13 +551,13 @@ position = Vector2(150.5, 175.5)
scale = Vector2(11.9687, 4.21875)
texture = ExtResource("9_pi0v8")
[node name="level" type="Node2D" parent="."]
[node name="Ground" type="Node2D" parent="."]
[node name="StaticBody2D" type="StaticBody2D" parent="level"]
[node name="StaticBody2D" type="StaticBody2D" parent="Ground"]
position = Vector2(48, 145)
metadata/_edit_group_ = true
[node name="CollisionShape2D" type="CollisionShape2D" parent="level/StaticBody2D"]
[node name="CollisionShape2D" type="CollisionShape2D" parent="Ground/StaticBody2D"]
shape = SubResource("WorldBoundaryShape2D_xkyim")
[node name="CharacterBody2D" parent="." groups=["player"] instance=ExtResource("2_64ccm")]
@ -564,10 +566,10 @@ PUSH_FORCE = 550
[node name="Camera2D" type="Camera2D" parent="CharacterBody2D"]
[node name="AreaTrigger" parent="." instance=ExtResource("7_i5ol2")]
[node name="BoxTrapTrigger" parent="." instance=ExtResource("7_i5ol2")]
position = Vector2(126, -57)
[node name="CollisionShape2D" type="CollisionShape2D" parent="AreaTrigger"]
[node name="CollisionShape2D" type="CollisionShape2D" parent="BoxTrapTrigger"]
shape = SubResource("CircleShape2D_j8ltg")
debug_color = Color(0.72549, 0.309804, 0.905882, 0.419608)
@ -579,10 +581,10 @@ position = Vector2(-22, -30)
[node name="boxtrap" type="Node2D" parent="crates"]
position = Vector2(131, -175)
[node name="Platform" parent="." instance=ExtResource("6_bcgm6")]
[node name="MovingPlatform" parent="." instance=ExtResource("6_bcgm6")]
position = Vector2(472, -21)
[node name="AnimationPlayer" type="AnimationPlayer" parent="Platform"]
[node name="AnimationPlayer" type="AnimationPlayer" parent="MovingPlatform"]
libraries = {
"": SubResource("AnimationLibrary_36p5o")
}
@ -591,7 +593,17 @@ autoplay = "move"
[node name="coin" parent="." instance=ExtResource("10_mo30d")]
position = Vector2(79, 88)
[node name="Area2D" parent="." instance=ExtResource("11_ghgxt")]
[node name="coin2" parent="." instance=ExtResource("10_mo30d")]
position = Vector2(177, 89)
[node name="coin3" parent="." instance=ExtResource("10_mo30d")]
position = Vector2(330, -39)
[node name="badguy" parent="." instance=ExtResource("11_ghgxt")]
position = Vector2(-28, 84)
[connection signal="areatrigger" from="AreaTrigger" to="GameManager" method="_on_area_2d_areatrigger"]
[node name="Area2D" parent="." instance=ExtResource("11_ghgxt")]
position = Vector2(270, -12)
[connection signal="timeout" from="GameManager/Timer" to="GameManager" method="_on_timer_timeout"]
[connection signal="areatrigger" from="BoxTrapTrigger" to="GameManager" method="_on_area_2d_areatrigger"]

View File

@ -23,79 +23,86 @@ var bullet = preload("res://scenes/bullet.tscn")
# Get the gravity from the project settings to be synced with RigidBody nodes.
var gravity = ProjectSettings.get_setting("physics/2d/default_gravity")
var living = true
func die():
#kill the player
print("kill the player")
living = false
animated_sprite.play("death")
func _physics_process(delta):
# Add the gravity.
if not is_on_floor():
velocity.y += gravity * delta
if living:
if not is_on_floor():
velocity.y += gravity * delta
# Handle jump.
if Input.is_action_just_pressed("ui_accept") and is_on_floor():
velocity.y = JUMP_VELOCITY
# Hand force push (melee attack)
if Input.is_action_just_pressed("push") && pushRightEnabled && faceLeft == false:
pushTarget.apply_central_impulse(Vector2(1,0) * PUSH_FORCE * 5)
pushRightEnabled = false
if Input.is_action_just_pressed("push") && pushLeftEnabled:
pushTarget.apply_central_impulse(Vector2(-1,0) * PUSH_FORCE * 5)
pushLeftEnabled = false
# Handle jump.
if Input.is_action_just_pressed("ui_accept") and is_on_floor():
velocity.y = JUMP_VELOCITY
# Hand force push (melee attack)
if Input.is_action_just_pressed("push") && pushRightEnabled && faceLeft == false:
pushTarget.apply_central_impulse(Vector2(1,0) * PUSH_FORCE * 5)
pushRightEnabled = false
if Input.is_action_just_pressed("push") && pushLeftEnabled:
pushTarget.apply_central_impulse(Vector2(-1,0) * PUSH_FORCE * 5)
pushLeftEnabled = false
if Input.is_action_just_pressed("shoot"):
#make a bullet
var myBullet = bullet.instantiate()
#set bullet speed?
if Input.is_action_just_pressed("shoot"):
#make a bullet
var myBullet = bullet.instantiate()
#set bullet speed?
#put the bullet at the Marker
owner.add_child(myBullet)
#facing left or right?
if not faceLeft:
myBullet.transform = marker_right.global_transform
#put the bullet at the Marker
owner.add_child(myBullet)
#facing left or right?
if not faceLeft:
myBullet.transform = marker_right.global_transform
else:
myBullet.transform = marker_left.global_transform
myBullet.setSpeed(-750)
# Get the input direction and handle the movement/deceleration.
# As good practice, you should replace UI actions with custom gameplay actions.
var direction = Input.get_axis("ui_left", "ui_right")
# In this example we have replaced the faceLeft code to also have
# the character's sprite flip depending what direction they are facing
if direction:
faceLeft = true if direction<0 else false
animated_sprite.flip_h = true if direction < 0 else false
velocity.x = direction * SPEED
else:
myBullet.transform = marker_left.global_transform
myBullet.setSpeed(-750)
# Get the input direction and handle the movement/deceleration.
# As good practice, you should replace UI actions with custom gameplay actions.
var direction = Input.get_axis("ui_left", "ui_right")
# In this example we have replaced the faceLeft code to also have
# the character's sprite flip depending what direction they are facing
if direction:
faceLeft = true if direction<0 else false
animated_sprite.flip_h = true if direction < 0 else false
velocity.x = direction * SPEED
else:
velocity.x = move_toward(velocity.x, 0, SPEED)
if is_on_floor():
if direction==0:
animated_sprite.play("idle")
velocity.x = move_toward(velocity.x, 0, SPEED)
if is_on_floor():
if direction==0:
animated_sprite.play("idle")
else:
animated_sprite.play("run")
else:
animated_sprite.play("run")
else:
animated_sprite.play("jump")
animated_sprite.play("jump")
move_and_slide()
if right_ray.is_colliding():
var collider = right_ray.get_collider()
#what did we hit?
if collider is Node:
if collider.is_in_group("boxes"):
print("This is a pushable box")
pushRightEnabled = true
pushTarget = collider
else:
pushRightEnabled = false
move_and_slide()
if right_ray.is_colliding():
var collider = right_ray.get_collider()
#what did we hit?
if collider is Node:
if collider.is_in_group("boxes"):
pushRightEnabled = true
pushTarget = collider
else:
pushRightEnabled = false
if left_ray.is_colliding():
var collider = left_ray.get_collider()
if collider is Node:
if collider.is_in_group("boxes"):
pushLeftEnabled = true
pushTarget = collider
else:
pushLeftEnabled = false
if left_ray.is_colliding():
var collider = left_ray.get_collider()
if collider is Node:
if collider.is_in_group("boxes"):
pushLeftEnabled = true
pushTarget = collider
else:
pushLeftEnabled = false
#loop through the collisions
for i in get_slide_collision_count():
var c = get_slide_collision(i)
if c.get_collider() is RigidBody2D:
c.get_collider().apply_central_impulse(-c.get_normal()* BUMP_FORCE)
#loop through the collisions
for i in get_slide_collision_count():
var c = get_slide_collision(i)
if c.get_collider() is RigidBody2D:
c.get_collider().apply_central_impulse(-c.get_normal()* BUMP_FORCE)

View File

@ -6,17 +6,26 @@ var direction = 1
@onready var cast_left = $CastLeft
@onready var sprite = $AnimatedSprite2D
@onready var game = %GameManager
@onready var cast_floor_right = $CastFloorRight
@onready var cast_floor_left = $CastFloorLeft
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
if cast_right.is_colliding():
if not cast_right.get_collider().is_in_group("player"):
direction = -1
sprite.flip_h = true
if cast_left.is_colliding():
if not cast_left.get_collider().is_in_group("player"):
direction = 1
sprite.flip_h = false
if not cast_floor_right.is_colliding():
direction = -1
sprite.flip_h = true
if cast_left.is_colliding():
if not cast_floor_left.is_colliding():
direction = 1
sprite.flip_h = false
sprite.flip_h = false
position.x += direction * speed * delta

View File

@ -6,3 +6,4 @@ extends Area2D
func _on_body_entered(body):
if body.is_in_group("player"):
game.coinCollected()
queue_free()

View File

@ -4,7 +4,7 @@ var coinsCollected = 0
var crate = preload("res://scenes/crate.tscn")
@onready var boxtrap = $"../crates/boxtrap"
@onready var timer = $Timer
@onready var player = $"../CharacterBody2D"
func _on_area_2d_areatrigger(effect, body):
@ -26,5 +26,8 @@ func coinCollected():
print("coins collected "+str(coinsCollected) )
func playerDeath():
print("kill the player")
player.die()
timer.start()
func _on_timer_timeout():
get_tree().reload_current_scene()