Skip to content

Commit b4044ac

Browse files
committed
Merge branch 'game'
2 parents 86d007d + 4d15400 commit b4044ac

File tree

175 files changed

+7533
-1453
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

175 files changed

+7533
-1453
lines changed

Code/.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Normalize EOL for all files that Git considers text files.
2+
* text=auto eol=lf

Code/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Godot 4+ specific ignores
2+
.godot/

Code/End.tscn

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
[gd_scene load_steps=3 format=3 uid="uid://deb7q6h0om8hc"]
2+
3+
[ext_resource type="Texture2D" uid="uid://cbl4hf0ywmhvl" path="res://art/tiles/tiles.png" id="1_rogvg"]
4+
5+
[sub_resource type="RectangleShape2D" id="RectangleShape2D_xu2hy"]
6+
size = Vector2(16, 16)
7+
8+
[node name="Platform" type="Area2D"]
9+
z_index = -1
10+
collision_mask = 2
11+
12+
[node name="Sprite2D" type="Sprite2D" parent="."]
13+
texture = ExtResource("1_rogvg")
14+
hframes = 5
15+
frame = 4
16+
17+
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
18+
shape = SubResource("RectangleShape2D_xu2hy")

Code/GameManager.gd

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
extends Node
2+
3+
@onready var platforms = get_tree().get_nodes_in_group("platforms")
4+
@onready var boxes = get_tree().get_nodes_in_group("boxes")
5+
6+
var all_platforms = []
7+
8+
func _ready():
9+
# Initialize platforms and boxes
10+
_initialize_platforms()
11+
_initialize_boxes()
12+
13+
func _initialize_platforms():
14+
all_platforms.clear()
15+
for platform in platforms:
16+
all_platforms.append({
17+
"platform": platform,
18+
"occupied": false
19+
})
20+
21+
func get_occupied_platforms_count():
22+
var occupied_count = 0
23+
for platform_dict in all_platforms:
24+
if platform_dict["occupied"] == true:
25+
occupied_count += 1
26+
return occupied_count
27+
28+
func _initialize_boxes():
29+
# Ensure boxes are initialized after they are added to the scene
30+
for box in boxes:
31+
box.connect("on_platform_sig", Callable(self, "_on_box_moved_in"))
32+
box.connect("out_platform_sig", Callable(self, "_on_box_moved_out"))
33+
34+
func _on_box_moved_in(platform):
35+
_check_all_platforms_occupied(platform)
36+
37+
func _on_box_moved_out(platform):
38+
for platform_info in all_platforms:
39+
if platform_info["platform"] == platform:
40+
platform_info["occupied"] = false
41+
print("Updated platform state:", platform)
42+
break
43+
44+
func _check_all_platforms_occupied(platform):
45+
for platform_info in all_platforms:
46+
if platform_info["platform"] == platform:
47+
platform_info["occupied"] = true
48+
print("Updated platform state:", platform_info)
49+
break
50+
51+
var all_occupied = true
52+
for platform_info in all_platforms:
53+
if not platform_info["occupied"]:
54+
all_occupied = false
55+
break
56+
57+
func _load_next_level():
58+
print("All platforms are occupied! Loading next level...")
59+
var next_level_path = "res://levels/level_1.tscn"
60+
if ResourceLoader.exists(next_level_path):
61+
get_tree().change_scene_to_file(next_level_path)

Code/GameManager.tscn

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[gd_scene load_steps=2 format=3 uid="uid://5q5c8pt7mew2"]
2+
3+
[ext_resource type="Script" path="res://GameManager.gd" id="1_apusa"]
4+
5+
[node name="GameManager" type="Node"]
6+
script = ExtResource("1_apusa")

Code/TileMap.gd

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
extends TileMap
2+
3+
var GridSize = 16
4+
var Dic = {}
5+
6+
# Called when the node enters the scene tree for the first time.
7+
func _ready():
8+
pass
9+
10+
# Called every frame. 'delta' is the elapsed time since the previous frame.
11+
func _process(_delta):
12+
pass

Code/art/character_base_16x16.png

4.67 KB
Loading
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
[remap]
2+
3+
importer="texture"
4+
type="CompressedTexture2D"
5+
uid="uid://dn2kohmjttj4x"
6+
path="res://.godot/imported/character_base_16x16.png-d0ca1337e67dbc2edda1321d0812f200.ctex"
7+
metadata={
8+
"vram_texture": false
9+
}
10+
11+
[deps]
12+
13+
source_file="res://art/character_base_16x16.png"
14+
dest_files=["res://.godot/imported/character_base_16x16.png-d0ca1337e67dbc2edda1321d0812f200.ctex"]
15+
16+
[params]
17+
18+
compress/mode=0
19+
compress/high_quality=false
20+
compress/lossy_quality=0.7
21+
compress/hdr_compression=1
22+
compress/normal_map=0
23+
compress/channel_pack=0
24+
mipmaps/generate=false
25+
mipmaps/limit=-1
26+
roughness/mode=0
27+
roughness/src_normal=""
28+
process/fix_alpha_border=true
29+
process/premult_alpha=false
30+
process/normal_map_invert_y=false
31+
process/hdr_as_srgb=false
32+
process/hdr_clamp_exposure=false
33+
process/size_limit=0
34+
detect_3d/compress_to=1
1.92 KB
Loading
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
[remap]
2+
3+
importer="texture"
4+
type="CompressedTexture2D"
5+
uid="uid://baficnup6ijqj"
6+
path="res://.godot/imported/guard_white_spritesheet.png-46984e5542eb456a542bba799d88a295.ctex"
7+
metadata={
8+
"vram_texture": false
9+
}
10+
11+
[deps]
12+
13+
source_file="res://art/guard_white_spritesheet.png"
14+
dest_files=["res://.godot/imported/guard_white_spritesheet.png-46984e5542eb456a542bba799d88a295.ctex"]
15+
16+
[params]
17+
18+
compress/mode=0
19+
compress/high_quality=false
20+
compress/lossy_quality=0.7
21+
compress/hdr_compression=1
22+
compress/normal_map=0
23+
compress/channel_pack=0
24+
mipmaps/generate=false
25+
mipmaps/limit=-1
26+
roughness/mode=0
27+
roughness/src_normal=""
28+
process/fix_alpha_border=true
29+
process/premult_alpha=false
30+
process/normal_map_invert_y=false
31+
process/hdr_as_srgb=false
32+
process/hdr_clamp_exposure=false
33+
process/size_limit=0
34+
detect_3d/compress_to=1

0 commit comments

Comments
 (0)