multi levels, timer, health, coins

This commit is contained in:
OddlyTimbot 2024-12-23 21:27:45 -05:00
parent a5f092f125
commit c4af95fa6b
11 changed files with 687 additions and 28 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://c8v2hylsdn8bd"
path="res://.godot/imported/Toy-gun.jpg-e9336d368085e0ef705756a6f3a625b7.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/graphics/pickups/Toy-gun.jpg"
dest_files=["res://.godot/imported/Toy-gun.jpg-e9336d368085e0ef705756a6f3a625b7.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

@ -1,4 +1,4 @@
[gd_scene load_steps=44 format=3 uid="uid://cjqhmd3158nb7"] [gd_scene load_steps=45 format=3 uid="uid://cjqhmd3158nb7"]
[ext_resource type="Script" path="res://scripts/dudecontroller.gd" id="1_u27sl"] [ext_resource type="Script" path="res://scripts/dudecontroller.gd" id="1_u27sl"]
[ext_resource type="Texture2D" uid="uid://1h4aupwklktd" path="res://assets/graphics/player/death/Player Death 64x64.png" id="2_puyd6"] [ext_resource type="Texture2D" uid="uid://1h4aupwklktd" path="res://assets/graphics/player/death/Player Death 64x64.png" id="2_puyd6"]
@ -6,6 +6,7 @@
[ext_resource type="Texture2D" uid="uid://chrp31s6hw6fp" path="res://assets/graphics/player/hurt/Player Hurt 48x48.png" id="2_t63lx"] [ext_resource type="Texture2D" uid="uid://chrp31s6hw6fp" path="res://assets/graphics/player/hurt/Player Hurt 48x48.png" id="2_t63lx"]
[ext_resource type="Texture2D" uid="uid://b82ecqnclroum" path="res://assets/graphics/player/jump/player jump 48x48.png" id="3_5pc3d"] [ext_resource type="Texture2D" uid="uid://b82ecqnclroum" path="res://assets/graphics/player/jump/player jump 48x48.png" id="3_5pc3d"]
[ext_resource type="Texture2D" uid="uid://bddwju2m8xvbj" path="res://assets/graphics/player/run/player run 48x48.png" id="3_pvg6g"] [ext_resource type="Texture2D" uid="uid://bddwju2m8xvbj" path="res://assets/graphics/player/run/player run 48x48.png" id="3_pvg6g"]
[ext_resource type="Texture2D" uid="uid://c8v2hylsdn8bd" path="res://assets/graphics/pickups/Toy-gun.jpg" id="7_mx582"]
[sub_resource type="CircleShape2D" id="CircleShape2D_pg3nc"] [sub_resource type="CircleShape2D" id="CircleShape2D_pg3nc"]
radius = 18.1108 radius = 18.1108
@ -285,7 +286,6 @@ animations = [{
[node name="CharacterBody2D" type="CharacterBody2D" groups=["player"]] [node name="CharacterBody2D" type="CharacterBody2D" groups=["player"]]
script = ExtResource("1_u27sl") script = ExtResource("1_u27sl")
metadata/_edit_group_ = true
[node name="CollisionShape2D" type="CollisionShape2D" parent="."] [node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2(0, 2) position = Vector2(0, 2)
@ -308,13 +308,16 @@ position = Vector2(-18, -5)
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."] [node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
texture_filter = 1 texture_filter = 1
sprite_frames = SubResource("SpriteFrames_p5ykk") sprite_frames = SubResource("SpriteFrames_p5ykk")
animation = &"death" animation = &"idle"
autoplay = "run" autoplay = "run"
frame = 9
frame_progress = 1.0
[node name="Camera2D" type="Camera2D" parent="."] [node name="Camera2D" type="Camera2D" parent="."]
position = Vector2(-1, 0) position = Vector2(-1, 0)
offset = Vector2(0, -40) offset = Vector2(0, -40)
[node name="Gun" type="Sprite2D" parent="."]
position = Vector2(22, 1)
scale = Vector2(0.016357, 0.0194301)
texture = ExtResource("7_mx582")
[connection signal="animation_finished" from="AnimatedSprite2D" to="." method="_on_animation_finished"] [connection signal="animation_finished" from="AnimatedSprite2D" to="." method="_on_animation_finished"]

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=16 format=4 uid="uid://cmh68gsfunmwa"] [gd_scene load_steps=17 format=4 uid="uid://cmh68gsfunmwa"]
[ext_resource type="Texture2D" uid="uid://vwe7rit3r0ho" path="res://assets/graphics/environment/background/forestbackground.png" id="1_6g8gi"] [ext_resource type="Texture2D" uid="uid://vwe7rit3r0ho" path="res://assets/graphics/environment/background/forestbackground.png" id="1_6g8gi"]
[ext_resource type="Texture2D" uid="uid://bvbxh8nxgekny" path="res://assets/graphics/environment/terrain/Terrain (32x32).png" id="1_n0y6d"] [ext_resource type="Texture2D" uid="uid://bvbxh8nxgekny" path="res://assets/graphics/environment/terrain/Terrain (32x32).png" id="1_n0y6d"]
@ -10,6 +10,7 @@
[ext_resource type="PackedScene" uid="uid://dm71h7adhhf8u" path="res://scenes/box.tscn" id="3_pi0u1"] [ext_resource type="PackedScene" uid="uid://dm71h7adhhf8u" path="res://scenes/box.tscn" id="3_pi0u1"]
[ext_resource type="PackedScene" uid="uid://0e20afji7t11" path="res://scenes/coin.tscn" id="9_6tlsy"] [ext_resource type="PackedScene" uid="uid://0e20afji7t11" path="res://scenes/coin.tscn" id="9_6tlsy"]
[ext_resource type="PackedScene" uid="uid://do41rhebtm7vw" path="res://scenes/badguy.tscn" id="10_rpj3s"] [ext_resource type="PackedScene" uid="uid://do41rhebtm7vw" path="res://scenes/badguy.tscn" id="10_rpj3s"]
[ext_resource type="PackedScene" uid="uid://ccepucdoyfi3d" path="res://scenes/ui.tscn" id="11_rtn2l"]
[sub_resource type="TileMapPattern" id="TileMapPattern_mkieg"] [sub_resource type="TileMapPattern" id="TileMapPattern_mkieg"]
tile_data = PackedInt32Array(0, 262144, 0, 65536, 262144, 1, 131072, 262144, 1, 196608, 262144, 2) tile_data = PackedInt32Array(0, 262144, 0, 65536, 262144, 1, 131072, 262144, 1, 196608, 262144, 2)
@ -416,13 +417,13 @@ script = ExtResource("1_obwxw")
[node name="CharacterBody2D" parent="." instance=ExtResource("1_p32ky")] [node name="CharacterBody2D" parent="." instance=ExtResource("1_p32ky")]
position = Vector2(161, 92) position = Vector2(161, 92)
[node name="Area2D" type="Area2D" parent="."] [node name="GunTrigger" type="Area2D" parent="."]
position = Vector2(519, 464) position = Vector2(351, -12)
scale = Vector2(10.92, 1) scale = Vector2(2.56, 1)
script = ExtResource("2_tsnf5") script = ExtResource("2_tsnf5")
metadata/_edit_group_ = true metadata/_edit_group_ = true
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"] [node name="CollisionShape2D" type="CollisionShape2D" parent="GunTrigger"]
shape = SubResource("RectangleShape2D_supj4") shape = SubResource("RectangleShape2D_supj4")
debug_color = Color(0.793021, 0.25626, 0.844091, 0.42) debug_color = Color(0.793021, 0.25626, 0.844091, 0.42)
@ -460,4 +461,8 @@ position = Vector2(422, 58)
position = Vector2(386, 51) position = Vector2(386, 51)
metadata/_edit_group_ = true metadata/_edit_group_ = true
[connection signal="body_entered" from="Area2D" to="Area2D" method="_on_body_entered"] [node name="CanvasLayer" type="CanvasLayer" parent="."]
[node name="Control" parent="CanvasLayer" instance=ExtResource("11_rtn2l")]
[connection signal="body_entered" from="GunTrigger" to="GunTrigger" method="_on_body_entered"]

View File

@ -0,0 +1,475 @@
[gd_scene load_steps=17 format=4 uid="uid://brobnglfmxk70"]
[ext_resource type="Texture2D" uid="uid://vwe7rit3r0ho" path="res://assets/graphics/environment/background/forestbackground.png" id="1_r2qtu"]
[ext_resource type="Texture2D" uid="uid://cvdu6wo2vq2ka" path="res://assets/graphics/environment/background/stratosphere.png" id="2_r2om4"]
[ext_resource type="Texture2D" uid="uid://ceoscwflxdsej" path="res://assets/graphics/environment/background/midground.png" id="3_p46t2"]
[ext_resource type="Texture2D" uid="uid://bvbxh8nxgekny" path="res://assets/graphics/environment/terrain/Terrain (32x32).png" id="4_yoprk"]
[ext_resource type="Script" path="res://scripts/scene_manager.gd" id="5_x4qhp"]
[ext_resource type="PackedScene" uid="uid://cjqhmd3158nb7" path="res://scenes/character.tscn" id="6_fn0pc"]
[ext_resource type="Script" path="res://scripts/trigger.gd" id="7_sy3hv"]
[ext_resource type="PackedScene" uid="uid://dm71h7adhhf8u" path="res://scenes/box.tscn" id="8_sia32"]
[ext_resource type="PackedScene" uid="uid://0e20afji7t11" path="res://scenes/coin.tscn" id="9_c3eax"]
[ext_resource type="PackedScene" uid="uid://do41rhebtm7vw" path="res://scenes/badguy.tscn" id="10_iodg5"]
[ext_resource type="PackedScene" uid="uid://ccepucdoyfi3d" path="res://scenes/ui.tscn" id="11_ufug8"]
[sub_resource type="TileMapPattern" id="TileMapPattern_mkieg"]
tile_data = PackedInt32Array(0, 262144, 0, 65536, 262144, 1, 131072, 262144, 1, 196608, 262144, 2)
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_ih8kf"]
texture = ExtResource("4_yoprk")
texture_region_size = Vector2i(32, 32)
0:0/0 = 0
0:0/0/terrain_set = 0
0:0/0/terrain = 0
0:0/0/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, 16, -16, 16, 16, -16, 16)
0:0/0/terrains_peering_bit/right_side = 0
0:0/0/terrains_peering_bit/bottom_right_corner = 0
0:0/0/terrains_peering_bit/bottom_side = 0
1:0/0 = 0
1:0/0/terrain_set = 0
1:0/0/terrain = 0
1:0/0/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, 16, -16, 16, 16, -16, 16)
1:0/0/terrains_peering_bit/right_side = 0
1:0/0/terrains_peering_bit/bottom_right_corner = 0
1:0/0/terrains_peering_bit/bottom_side = 0
1:0/0/terrains_peering_bit/bottom_left_corner = 0
1:0/0/terrains_peering_bit/left_side = 0
2:0/0 = 0
2:0/0/terrain_set = 0
2:0/0/terrain = 0
2:0/0/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, 16, -16, 16, 16, -16, 16)
2:0/0/terrains_peering_bit/bottom_side = 0
2:0/0/terrains_peering_bit/bottom_left_corner = 0
2:0/0/terrains_peering_bit/left_side = 0
4:0/0 = 0
4:0/0/terrain_set = 0
4:0/0/terrain = 0
4:0/0/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, 16, -16, 16, 16, -16, 16)
4:0/0/terrains_peering_bit/bottom_side = 0
6:0/0 = 0
6:0/0/terrain_set = 0
6:0/0/terrain = 0
6:0/0/terrains_peering_bit/right_side = 0
6:0/0/terrains_peering_bit/bottom_side = 0
6:0/0/terrains_peering_bit/bottom_left_corner = 0
6:0/0/terrains_peering_bit/left_side = 0
6:0/0/terrains_peering_bit/top_left_corner = 0
6:0/0/terrains_peering_bit/top_side = 0
6:0/0/terrains_peering_bit/top_right_corner = 0
7:0/0 = 0
7:0/0/terrain_set = 0
7:0/0/terrain = 0
7:0/0/terrains_peering_bit/right_side = 0
7:0/0/terrains_peering_bit/bottom_right_corner = 0
7:0/0/terrains_peering_bit/bottom_side = 0
7:0/0/terrains_peering_bit/left_side = 0
7:0/0/terrains_peering_bit/top_left_corner = 0
7:0/0/terrains_peering_bit/top_side = 0
7:0/0/terrains_peering_bit/top_right_corner = 0
9:0/0 = 0
9:0/0/terrain_set = 0
9:0/0/terrain = 0
9:0/0/terrains_peering_bit/right_side = 0
9:0/0/terrains_peering_bit/bottom_right_corner = 0
9:0/0/terrains_peering_bit/bottom_side = 0
9:0/0/terrains_peering_bit/bottom_left_corner = 0
9:0/0/terrains_peering_bit/left_side = 0
9:0/0/terrains_peering_bit/top_side = 0
10:0/0 = 0
10:0/0/terrain_set = 0
10:0/0/terrain = 0
10:0/0/terrains_peering_bit/right_side = 0
10:0/0/terrains_peering_bit/bottom_side = 0
10:0/0/terrains_peering_bit/bottom_left_corner = 0
10:0/0/terrains_peering_bit/left_side = 0
10:0/0/terrains_peering_bit/top_left_corner = 0
10:0/0/terrains_peering_bit/top_side = 0
12:0/0 = 0
12:0/0/terrain_set = 0
12:0/0/terrain = 0
12:0/0/terrains_peering_bit/bottom_right_corner = 0
12:0/0/terrains_peering_bit/bottom_side = 0
12:0/0/terrains_peering_bit/top_side = 0
13:0/0 = 0
13:0/0/terrain_set = 0
13:0/0/terrain = 0
13:0/0/terrains_peering_bit/bottom_side = 0
13:0/0/terrains_peering_bit/bottom_left_corner = 0
13:0/0/terrains_peering_bit/top_side = 0
15:0/0 = 0
15:0/0/terrain_set = 0
15:0/0/terrain = 0
15:0/0/terrains_peering_bit/right_side = 0
15:0/0/terrains_peering_bit/bottom_side = 0
15:0/0/terrains_peering_bit/top_side = 0
0:1/0 = 0
0:1/0/terrain_set = 0
0:1/0/terrain = 0
0:1/0/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, 16, -16, 16, 16, -16, 16)
0:1/0/terrains_peering_bit/right_side = 0
0:1/0/terrains_peering_bit/bottom_right_corner = 0
0:1/0/terrains_peering_bit/bottom_side = 0
0:1/0/terrains_peering_bit/top_side = 0
0:1/0/terrains_peering_bit/top_right_corner = 0
1:1/0 = 0
1:1/0/terrain_set = 0
1:1/0/terrains_peering_bit/right_side = 0
1:1/0/terrains_peering_bit/bottom_right_corner = 0
1:1/0/terrains_peering_bit/bottom_side = 0
1:1/0/terrains_peering_bit/bottom_left_corner = 0
1:1/0/terrains_peering_bit/left_side = 0
1:1/0/terrains_peering_bit/top_left_corner = 0
1:1/0/terrains_peering_bit/top_side = 0
1:1/0/terrains_peering_bit/top_right_corner = 0
2:1/0 = 0
2:1/0/terrain_set = 0
2:1/0/terrain = 0
2:1/0/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, 16, -16, 16, 16, -16, 16)
2:1/0/terrains_peering_bit/bottom_side = 0
2:1/0/terrains_peering_bit/bottom_left_corner = 0
2:1/0/terrains_peering_bit/left_side = 0
2:1/0/terrains_peering_bit/top_left_corner = 0
2:1/0/terrains_peering_bit/top_side = 0
4:1/0 = 0
4:1/0/terrain_set = 0
4:1/0/terrain = 0
4:1/0/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, 16, -16, 16, 16, -16, 16)
4:1/0/terrains_peering_bit/bottom_side = 0
4:1/0/terrains_peering_bit/top_side = 0
6:1/0 = 0
6:1/0/terrain_set = 0
6:1/0/terrain = 0
6:1/0/terrains_peering_bit/bottom_right_corner = 0
6:1/0/terrains_peering_bit/bottom_side = 0
6:1/0/terrains_peering_bit/bottom_left_corner = 0
6:1/0/terrains_peering_bit/left_side = 0
6:1/0/terrains_peering_bit/top_left_corner = 0
6:1/0/terrains_peering_bit/top_side = 0
7:1/0 = 0
7:1/0/terrain_set = 0
7:1/0/terrain = 0
7:1/0/terrains_peering_bit/right_side = 0
7:1/0/terrains_peering_bit/bottom_right_corner = 0
7:1/0/terrains_peering_bit/bottom_side = 0
7:1/0/terrains_peering_bit/bottom_left_corner = 0
7:1/0/terrains_peering_bit/top_side = 0
7:1/0/terrains_peering_bit/top_right_corner = 0
9:1/0 = 0
9:1/0/terrain_set = 0
9:1/0/terrain = 0
9:1/0/terrains_peering_bit/right_side = 0
9:1/0/terrains_peering_bit/bottom_right_corner = 0
9:1/0/terrains_peering_bit/bottom_side = 0
9:1/0/terrains_peering_bit/top_side = 0
9:1/0/terrains_peering_bit/top_right_corner = 0
10:1/0 = 0
10:1/0/terrain_set = 0
10:1/0/terrain = 0
10:1/0/terrains_peering_bit/right_side = 0
10:1/0/terrains_peering_bit/bottom_side = 0
10:1/0/terrains_peering_bit/left_side = 0
10:1/0/terrains_peering_bit/top_left_corner = 0
10:1/0/terrains_peering_bit/top_side = 0
10:1/0/terrains_peering_bit/top_right_corner = 0
12:1/0 = 0
12:1/0/terrain_set = 0
12:1/0/terrain = 0
12:1/0/terrains_peering_bit/right_side = 0
12:1/0/terrains_peering_bit/bottom_side = 0
12:1/0/terrains_peering_bit/top_side = 0
12:1/0/terrains_peering_bit/top_right_corner = 0
13:1/0 = 0
13:1/0/terrain_set = 0
13:1/0/terrain = 0
13:1/0/terrains_peering_bit/bottom_side = 0
13:1/0/terrains_peering_bit/left_side = 0
13:1/0/terrains_peering_bit/top_left_corner = 0
13:1/0/terrains_peering_bit/top_side = 0
15:1/0 = 0
15:1/0/terrain_set = 0
15:1/0/terrain = 0
15:1/0/terrains_peering_bit/right_side = 0
15:1/0/terrains_peering_bit/bottom_side = 0
15:1/0/terrains_peering_bit/bottom_left_corner = 0
15:1/0/terrains_peering_bit/top_side = 0
15:1/0/terrains_peering_bit/top_right_corner = 0
16:1/0 = 0
16:1/0/terrain_set = 0
16:1/0/terrain = 0
16:1/0/terrains_peering_bit/bottom_right_corner = 0
16:1/0/terrains_peering_bit/bottom_side = 0
16:1/0/terrains_peering_bit/left_side = 0
16:1/0/terrains_peering_bit/top_left_corner = 0
16:1/0/terrains_peering_bit/top_side = 0
0:2/0 = 0
0:2/0/terrain_set = 0
0:2/0/terrain = 0
0:2/0/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, 16, -16, 16, 16, -16, 16)
0:2/0/terrains_peering_bit/right_side = 0
0:2/0/terrains_peering_bit/top_side = 0
0:2/0/terrains_peering_bit/top_right_corner = 0
1:2/0 = 0
1:2/0/terrain_set = 0
1:2/0/terrain = 0
1:2/0/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, 16, -16, 16, 16, -16, 16)
1:2/0/terrains_peering_bit/right_side = 0
1:2/0/terrains_peering_bit/left_side = 0
1:2/0/terrains_peering_bit/top_left_corner = 0
1:2/0/terrains_peering_bit/top_side = 0
1:2/0/terrains_peering_bit/top_right_corner = 0
2:2/0 = 0
2:2/0/terrain_set = 0
2:2/0/terrain = 0
2:2/0/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, 16, -16, 16, 16, -16, 16)
2:2/0/terrains_peering_bit/left_side = 0
2:2/0/terrains_peering_bit/top_left_corner = 0
2:2/0/terrains_peering_bit/top_side = 0
4:2/0 = 0
4:2/0/terrain_set = 0
4:2/0/terrain = 0
4:2/0/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, 16, -16, 16, 16, -16, 16)
4:2/0/terrains_peering_bit/top_side = 0
6:3/0 = 0
6:3/0/terrain_set = 0
6:3/0/terrain = 0
6:3/0/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, 0, -16, 0, 16, -16, 16)
6:3/0/terrains_peering_bit/right_side = 0
6:3/0/terrains_peering_bit/bottom_side = 0
6:3/0/terrains_peering_bit/top_side = 0
6:3/0/terrains_peering_bit/top_right_corner = 0
7:3/0 = 0
7:3/0/terrain_set = 0
7:3/0/terrain = 0
7:3/0/physics_layer_0/polygon_0/points = PackedVector2Array(2.75, -16, 16, -16, 16, 16, 3, 16)
7:3/0/terrains_peering_bit/bottom_side = 0
7:3/0/terrains_peering_bit/left_side = 0
7:3/0/terrains_peering_bit/top_left_corner = 0
7:3/0/terrains_peering_bit/top_side = 0
9:3/0 = 0
9:3/0/terrain_set = 0
9:3/0/terrain = 0
9:3/0/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, 16, -16, 16, -0.25, -16, -0.5)
9:3/0/terrains_peering_bit/right_side = 0
9:3/0/terrains_peering_bit/bottom_side = 0
9:3/0/terrains_peering_bit/bottom_left_corner = 0
9:3/0/terrains_peering_bit/left_side = 0
10:3/0 = 0
10:3/0/terrain_set = 0
10:3/0/terrain = 0
10:3/0/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, 16, -16, 16, -0.25, -16, -0.5)
10:3/0/terrains_peering_bit/right_side = 0
10:3/0/terrains_peering_bit/bottom_right_corner = 0
10:3/0/terrains_peering_bit/bottom_side = 0
10:3/0/terrains_peering_bit/left_side = 0
12:3/0 = 0
12:3/0/terrain_set = 0
12:3/0/terrain = 0
12:3/0/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, -0.25, -16, -0.25, 16, -16, 16)
12:3/0/terrains_peering_bit/right_side = 0
12:3/0/terrains_peering_bit/bottom_side = 0
12:3/0/terrains_peering_bit/top_side = 0
13:3/0 = 0
13:3/0/terrain_set = 0
13:3/0/terrain = 0
13:3/0/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, 16, -16, 16, -0.5, -16, -0.75)
13:3/0/terrains_peering_bit/right_side = 0
13:3/0/terrains_peering_bit/bottom_side = 0
13:3/0/terrains_peering_bit/left_side = 0
15:3/0 = 0
15:3/0/terrain_set = 0
15:3/0/terrain = 0
15:3/0/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, 16, -16, 16, 16, -16, 16)
15:3/0/terrains_peering_bit/right_side = 0
15:3/0/terrains_peering_bit/bottom_side = 0
16:3/0 = 0
16:3/0/terrain_set = 0
16:3/0/terrain = 0
16:3/0/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, 16, -16, 16, 16, -16, 16)
16:3/0/terrains_peering_bit/bottom_side = 0
16:3/0/terrains_peering_bit/left_side = 0
0:4/0 = 0
0:4/0/terrain_set = 0
0:4/0/terrain = 0
0:4/0/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, 16, -16, 16, 16, -16, 16)
0:4/0/terrains_peering_bit/right_side = 0
1:4/0 = 0
1:4/0/terrain_set = 0
1:4/0/terrain = 0
1:4/0/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, 16, -16, 16, 16, -16, 16)
1:4/0/terrains_peering_bit/right_side = 0
1:4/0/terrains_peering_bit/left_side = 0
2:4/0 = 0
2:4/0/terrain_set = 0
2:4/0/terrain = 0
2:4/0/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, 16, -16, 16, 16, -16, 16)
2:4/0/terrains_peering_bit/left_side = 0
4:4/0 = 0
4:4/0/terrain_set = 0
4:4/0/terrain = 0
4:4/0/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, 16, -16, 16, 16, -16, 16)
6:4/0 = 0
6:4/0/terrain_set = 0
6:4/0/terrain = 0
6:4/0/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, 1.25, -16, 1.25, 16, -16, 16)
6:4/0/terrains_peering_bit/right_side = 0
6:4/0/terrains_peering_bit/bottom_right_corner = 0
6:4/0/terrains_peering_bit/bottom_side = 0
6:4/0/terrains_peering_bit/top_side = 0
7:4/0 = 0
7:4/0/terrain_set = 0
7:4/0/terrain = 0
7:4/0/physics_layer_0/polygon_0/points = PackedVector2Array(2.75, -16, 16, -16, 16, 16, 3, 16)
7:4/0/terrains_peering_bit/bottom_side = 0
7:4/0/terrains_peering_bit/bottom_left_corner = 0
7:4/0/terrains_peering_bit/left_side = 0
7:4/0/terrains_peering_bit/top_side = 0
9:4/0 = 0
9:4/0/terrain_set = 0
9:4/0/terrain = 0
9:4/0/physics_layer_0/polygon_0/points = PackedVector2Array(-16, 1.5, 16, 1.25, 16, 16, -16, 16)
9:4/0/terrains_peering_bit/right_side = 0
9:4/0/terrains_peering_bit/left_side = 0
9:4/0/terrains_peering_bit/top_left_corner = 0
9:4/0/terrains_peering_bit/top_side = 0
10:4/0 = 0
10:4/0/terrain_set = 0
10:4/0/terrain = 0
10:4/0/physics_layer_0/polygon_0/points = PackedVector2Array(-16, 1.5, 16, 1.25, 16, 16, -16, 16)
10:4/0/terrains_peering_bit/right_side = 0
10:4/0/terrains_peering_bit/left_side = 0
10:4/0/terrains_peering_bit/top_side = 0
10:4/0/terrains_peering_bit/top_right_corner = 0
12:4/0 = 0
12:4/0/terrain_set = 0
12:4/0/terrain = 0
12:4/0/physics_layer_0/polygon_0/points = PackedVector2Array(-16, 1.5, 16, 1.25, 16, 16, -16, 16)
12:4/0/terrains_peering_bit/right_side = 0
12:4/0/terrains_peering_bit/left_side = 0
12:4/0/terrains_peering_bit/top_side = 0
13:4/0 = 0
13:4/0/terrain_set = 0
13:4/0/terrain = 0
13:4/0/physics_layer_0/polygon_0/points = PackedVector2Array(1.75, -16, 16, -16, 16, 16, -16, 16, -16, 1, 1.25, 0.5)
13:4/0/terrains_peering_bit/bottom_side = 0
13:4/0/terrains_peering_bit/left_side = 0
13:4/0/terrains_peering_bit/top_side = 0
15:4/0 = 0
15:4/0/terrain_set = 0
15:4/0/terrain = 0
15:4/0/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, 16, -16, 16, 16, -16, 16)
15:4/0/terrains_peering_bit/right_side = 0
15:4/0/terrains_peering_bit/top_side = 0
16:4/0 = 0
16:4/0/terrain_set = 0
16:4/0/terrain = 0
16:4/0/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, 16, -16, 16, 16, -16, 16)
16:4/0/terrains_peering_bit/left_side = 0
16:4/0/terrains_peering_bit/top_side = 0
[sub_resource type="TileSet" id="TileSet_wyq3g"]
tile_size = Vector2i(32, 32)
physics_layer_0/collision_layer = 1
terrain_set_0/mode = 0
terrain_set_0/terrain_0/name = "Ground"
terrain_set_0/terrain_0/color = Color(0.5, 0.34375, 0.25, 1)
terrain_set_1/mode = 0
terrain_set_1/terrain_0/name = "Sky"
terrain_set_1/terrain_0/color = Color(0.348943, 0.362533, 0.56576, 1)
sources/0 = SubResource("TileSetAtlasSource_ih8kf")
pattern_0 = SubResource("TileMapPattern_mkieg")
[sub_resource type="RectangleShape2D" id="RectangleShape2D_supj4"]
[sub_resource type="WorldBoundaryShape2D" id="WorldBoundaryShape2D_c5gsu"]
[node name="Game" type="Node2D"]
[node name="Background" type="Parallax2D" parent="."]
scroll_scale = Vector2(0.5, 1)
repeat_size = Vector2(320, 0)
[node name="forest" type="Sprite2D" parent="Background"]
texture_filter = 1
position = Vector2(160, 90)
texture = ExtResource("1_r2qtu")
[node name="Sprite2D" type="Sprite2D" parent="Background"]
position = Vector2(160, -182)
scale = Vector2(1, 13.1333)
texture = ExtResource("2_r2om4")
[node name="Midground" type="Parallax2D" parent="."]
repeat_size = Vector2(320, 0)
[node name="Sprite2D" type="Sprite2D" parent="Midground"]
texture_filter = 1
position = Vector2(160, 90)
texture = ExtResource("3_p46t2")
[node name="TileMapLayer" type="TileMapLayer" parent="."]
tile_map_data = PackedByteArray("AAAAAAUAAAAAAAQAAAABAAUAAAABAAQAAAACAAUAAAABAAQAAAADAAUAAAABAAQAAAAEAAUAAAABAAQAAAAFAAUAAAABAAQAAAAGAAUAAAABAAQAAAAHAAUAAAABAAQAAAAIAAUAAAABAAQAAAAJAAUAAAABAAQAAAAKAAUAAAABAAQAAAALAAUAAAABAAQAAAAMAAUAAAABAAQAAAANAAUAAAABAAQAAAAOAAUAAAABAAQAAAAPAAUAAAABAAQAAAAQAAUAAAABAAQAAAARAAUAAAABAAQAAAASAAUAAAABAAQAAAATAAUAAAABAAQAAAAUAAUAAAABAAQAAAAVAAUAAAACAAQAAAAGAAMAAAAEAAQAAAAIAAIAAAAEAAQAAAAMAAIAAAAAAAAAAAANAAIAAAABAAAAAAAOAAIAAAAHAAQAAAAOAAMAAAACAAIAAAANAAMAAAABAAIAAAAMAAMAAAAAAAIAAAAKAAAAAAAAAAQAAAALAAAAAAACAAQAAAAOAP7/AAAEAAQAAAAOAAEAAAAEAAAAAAAFAAAAAAAAAAQAAAAGAAAAAAACAAQAAAA=")
tile_set = SubResource("TileSet_wyq3g")
[node name="SceneManager" type="Node" parent="."]
unique_name_in_owner = true
script = ExtResource("5_x4qhp")
[node name="CharacterBody2D" parent="." instance=ExtResource("6_fn0pc")]
position = Vector2(161, 92)
[node name="Area2D" type="Area2D" parent="."]
position = Vector2(519, 464)
scale = Vector2(10.92, 1)
script = ExtResource("7_sy3hv")
metadata/_edit_group_ = true
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"]
shape = SubResource("RectangleShape2D_supj4")
debug_color = Color(0.793021, 0.25626, 0.844091, 0.42)
[node name="RigidBody2D" parent="." instance=ExtResource("8_sia32")]
position = Vector2(344, -26)
[node name="RigidBody2D2" parent="." instance=ExtResource("8_sia32")]
position = Vector2(97, 119)
[node name="RigidBody2D3" parent="." instance=ExtResource("8_sia32")]
position = Vector2(237, 85)
rotation = 1.16823
[node name="StaticBody2D" type="StaticBody2D" parent="."]
position = Vector2(486, 164)
metadata/_edit_group_ = true
[node name="CollisionShape2D" type="CollisionShape2D" parent="StaticBody2D"]
shape = SubResource("WorldBoundaryShape2D_c5gsu")
[node name="coins" type="Node" parent="."]
[node name="Coin" parent="coins" instance=ExtResource("9_c3eax")]
position = Vector2(208, 90)
[node name="Coin2" parent="coins" instance=ExtResource("9_c3eax")]
position = Vector2(273, 58)
[node name="Coin4" parent="coins" instance=ExtResource("9_c3eax")]
position = Vector2(345, -7)
[node name="Coin3" parent="coins" instance=ExtResource("9_c3eax")]
position = Vector2(422, 58)
[node name="enemies" type="Node" parent="."]
[node name="Area2D2" parent="enemies" instance=ExtResource("10_iodg5")]
position = Vector2(386, 51)
metadata/_edit_group_ = true
[node name="Area2D3" parent="enemies" instance=ExtResource("10_iodg5")]
position = Vector2(366, -12)
metadata/_edit_group_ = true
[node name="CanvasLayer" type="CanvasLayer" parent="."]
[node name="Control" parent="CanvasLayer" instance=ExtResource("11_ufug8")]
[connection signal="body_entered" from="Area2D" to="Area2D" method="_on_body_entered"]

View File

@ -0,0 +1,44 @@
[gd_scene load_steps=2 format=3 uid="uid://ccepucdoyfi3d"]
[ext_resource type="Script" path="res://scripts/ui.gd" id="1_qku42"]
[node name="Control" type="Control"]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_qku42")
[node name="VBoxContainer" type="VBoxContainer" parent="."]
layout_mode = 1
anchors_preset = 10
anchor_right = 1.0
grow_horizontal = 2
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer"]
layout_mode = 2
[node name="MarginContainer" type="MarginContainer" parent="VBoxContainer/HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 3
[node name="health" type="Label" parent="VBoxContainer/HBoxContainer/MarginContainer"]
layout_mode = 2
text = "Health : 100"
[node name="MarginContainer3" type="MarginContainer" parent="VBoxContainer/HBoxContainer"]
layout_mode = 2
[node name="timer" type="Label" parent="VBoxContainer/HBoxContainer/MarginContainer3"]
layout_mode = 2
[node name="MarginContainer2" type="MarginContainer" parent="VBoxContainer/HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 3
[node name="coins" type="Label" parent="VBoxContainer/HBoxContainer/MarginContainer2"]
layout_mode = 2
text = "Coins : 0"
horizontal_alignment = 2

View File

@ -9,6 +9,7 @@ const PUSHFORCE = 750
@onready var right_ray: RayCast2D = $RightRay @onready var right_ray: RayCast2D = $RightRay
@onready var left_ray: RayCast2D = $LeftRay @onready var left_ray: RayCast2D = $LeftRay
@onready var playerSprite: AnimatedSprite2D = $AnimatedSprite2D @onready var playerSprite: AnimatedSprite2D = $AnimatedSprite2D
@onready var gun: Sprite2D = $Gun
var faceLeft = false var faceLeft = false
@ -26,7 +27,6 @@ signal playerDead
@onready var left_target: Node2D = $LeftTarget @onready var left_target: Node2D = $LeftTarget
func hurtPlayer(amt): func hurtPlayer(amt):
print("Character knows it should be hurt")
animPlaying = "hurt" animPlaying = "hurt"
playerSprite.play("hurt") playerSprite.play("hurt")
@ -35,6 +35,12 @@ func killPlayer():
living = false living = false
animPlaying = "death" animPlaying = "death"
playerSprite.play(animPlaying) playerSprite.play(animPlaying)
func gunCollected():
print("Player knows to show gun")
gun.visible = true
func gunDrop():
gun.visible = false
func _physics_process(delta: float) -> void: func _physics_process(delta: float) -> void:
if living and not animPlaying =="hurt": if living and not animPlaying =="hurt":
@ -50,7 +56,6 @@ func _physics_process(delta: float) -> void:
# As good practice, you should replace UI actions with custom gameplay actions. # As good practice, you should replace UI actions with custom gameplay actions.
var direction := Input.get_axis("ui_left", "ui_right") var direction := Input.get_axis("ui_left", "ui_right")
if Input.is_action_just_pressed("shove") && pushRightEnabled && faceLeft == false: if Input.is_action_just_pressed("shove") && pushRightEnabled && faceLeft == false:
print("Shove a box")
pushTarget.apply_central_impulse(Vector2(1,0) * PUSHFORCE * 2 ) pushTarget.apply_central_impulse(Vector2(1,0) * PUSHFORCE * 2 )
pushRightEnabled = false pushRightEnabled = false
@ -59,7 +64,6 @@ func _physics_process(delta: float) -> void:
pushLeftEnabled = false pushLeftEnabled = false
if Input.is_action_just_pressed("shoot"): if Input.is_action_just_pressed("shoot"):
print("Shoot a bullet")
var myBullet = %SceneManager.bulletFactory() var myBullet = %SceneManager.bulletFactory()
if not faceLeft: if not faceLeft:
myBullet.transform = right_target.global_transform myBullet.transform = right_target.global_transform
@ -96,7 +100,6 @@ func _physics_process(delta: float) -> void:
move_and_slide() move_and_slide()
if right_ray.is_colliding(): if right_ray.is_colliding():
print("Something is on my right")
if not faceLeft: if not faceLeft:
var collider = right_ray.get_collider() var collider = right_ray.get_collider()
if collider is Node: if collider is Node:

View File

@ -2,22 +2,49 @@ extends Node
var coinsCollected:int = 0 var coinsCollected:int = 0
var player:Resource var player:Resource
var totalCoinsLevel = 0
var levels = ["res://scenes/game.tscn","res://scenes/game_level2.tscn"]
var timers = [5, 30]
var currentLevel = 0
var gameSeconds = 0
var gotGun = false
signal playerHurt(amt) signal playerHurt(amt)
signal playerDeath() signal playerDeath()
signal coinsUpdate(amt, total)
signal levelComplete(level)
signal tick(seconds)
signal playerOptions(gun)
# Called when the node enters the scene tree for the first time. # Called when the node enters the scene tree for the first time.
func _ready() -> void: func _ready() -> void:
player = load("res://scripts/res/playerstats.tres") player = load("res://scripts/res/playerstats.tres")
func setTotalCoins(amt):
totalCoinsLevel = amt
print(str(coinsCollected)+" "+str(totalCoinsLevel) )
coinsUpdate.emit(coinsCollected, totalCoinsLevel)
# Called every frame. 'delta' is the elapsed time since the previous frame. # Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void: func _process(delta: float) -> void:
pass pass
func gunCollected():
gotGun = true
func coinCollected(): func coinCollected():
coinsCollected +=1 coinsCollected +=1
print("Total coins collected "+str(coinsCollected) ) coinsUpdate.emit(coinsCollected, totalCoinsLevel)
#did you complete the level
if coinsCollected >= totalCoinsLevel:
#level complete
currentLevel +=1
if currentLevel < levels.size():
levelComplete.emit(levels[currentLevel])
else:
currentLevel = 0
levelComplete.emit(levels[currentLevel])
func playerDamage(): func playerDamage():
if player.health > 0: if player.health > 0:
@ -27,8 +54,19 @@ func playerDamage():
playerDeath.emit() playerDeath.emit()
else: else:
## damage him ## damage him
playerHurt.emit(20) playerHurt.emit(player.health)
func reset(): func reset():
gameSeconds = 0
player.health = player.max_health player.health = player.max_health
coinsCollected = 0 coinsCollected = 0
func timeOut():
gameSeconds +=1
if gameSeconds >= timers[currentLevel]:
playerDeath.emit()
tick.emit(timers[currentLevel] - gameSeconds)
func sendOptions():
playerOptions.emit(gotGun)

View File

@ -3,29 +3,57 @@ extends Node
var bulletsFiredTotal :=0 var bulletsFiredTotal :=0
var bulletsMadeTotal :=0 var bulletsMadeTotal :=0
var bulletArray:Array = [] var bulletArray:Array = []
var timer:= Timer.new()
@onready var coins: Node = $"../coins" @onready var coins: Node = $"../coins"
@onready var enemies: Node = $"../enemies" @onready var enemies: Node = $"../enemies"
@onready var player: CharacterBody2D = $"../CharacterBody2D" @onready var player: CharacterBody2D = $"../CharacterBody2D"
@onready var ui: Control = $"../CanvasLayer/Control"
@onready var gun_trigger: Area2D = $"../GunTrigger"
var bullet = preload("res://scenes/bullet.tscn") var bullet = preload("res://scenes/bullet.tscn")
func _ready() -> void: func _ready() -> void:
add_child(timer)
timer.wait_time = 1
timer.one_shot = false
timer.connect("timeout", GameController.timeOut)
timer.start()
var totalCoins = 0
var totalEnemies = 0
### coins loop ### coins loop
for n in coins.get_children(): for n in coins.get_children():
print("coin found") totalCoins +=1
n.coinCollected.connect(GameController.coinCollected) n.coinCollected.connect(GameController.coinCollected)
### enemies loop ### enemies loop
for n in enemies.get_children(): for n in enemies.get_children():
print("enemy found") totalEnemies +=1
n.playerDamage.connect(GameController.playerDamage) n.playerDamage.connect(GameController.playerDamage)
## wire up GameController signals to Player ## wire up GameController signals to Player
GameController.playerHurt.connect(hurtPlayer) GameController.playerHurt.connect(hurtPlayer)
GameController.playerHurt.connect(ui.healthUpdate)
GameController.playerDeath.connect(killPlayer) GameController.playerDeath.connect(killPlayer)
GameController.levelComplete.connect(changeLevel)
GameController.tick.connect(ui.timerUpdate)
GameController.playerOptions.connect(showGun)
gun_trigger.gunCollect.connect(GameController.gunCollected)
gun_trigger.gunCollect.connect(player.gunCollected)
player.playerDead.connect(deadPlayer) player.playerDead.connect(deadPlayer)
GameController.coinsUpdate.connect(ui.coinsUpdate)
GameController.setTotalCoins(totalCoins)
GameController.sendOptions()
func bulletFactory(): func bulletFactory():
print("Make a bullet at the factory") print("Make a bullet at the factory")
var mybullet var mybullet
@ -59,3 +87,15 @@ func deadPlayer():
GameController.reset() GameController.reset()
get_tree().reload_current_scene() get_tree().reload_current_scene()
func showGun(gun):
print("Show the gun? "+str(gun) )
if gun:
player.gunCollected()
else:
player.gunDrop()
func changeLevel(level):
print("Scene Manager should change level")
GameController.reset()
get_tree().change_scene_to_file(level)

View File

@ -1,6 +1,6 @@
extends Area2D extends Area2D
var BoxCount = 0
var MaxBoxes = 3 signal gunCollect
# Called when the node enters the scene tree for the first time. # Called when the node enters the scene tree for the first time.
func _ready() -> void: func _ready() -> void:
@ -14,9 +14,7 @@ func _process(delta: float) -> void:
func _on_body_entered(body: Node2D) -> void: func _on_body_entered(body: Node2D) -> void:
print("Trigger saw a thing") print("Trigger saw a thing")
if body.is_in_group("box"): if body.is_in_group("player"):
print("box hit the trigger") print("player entered area")
BoxCount +=1 gunCollect.emit()
if BoxCount >= MaxBoxes:
print("YU WUN")

View File

@ -0,0 +1,19 @@
extends Control
@onready var health: Label = $VBoxContainer/HBoxContainer/MarginContainer/health
@onready var coins: Label = $VBoxContainer/HBoxContainer/MarginContainer2/coins
@onready var timer: Label = $VBoxContainer/HBoxContainer/MarginContainer3/timer
var tempCoinCount = 0
var tempCoinTotal = 0
func timerUpdate(amt):
timer.text = "Seconds : "+str(amt)
func healthUpdate(amt):
health.text=("Health : "+str(amt) )
func coinsUpdate(amt, total):
tempCoinCount = amt
tempCoinTotal = total
if coins:
coins.text = ("Coins : "+str(amt)+" of "+str(total) )
func _ready() -> void:
coins.text = ("Coins : "+str(tempCoinCount)+" of "+str(tempCoinTotal) )