Skip to content

Commit

Permalink
started GameScreen refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
ProfAndreaPollini committed Jul 25, 2022
1 parent d936c8b commit 58fd011
Show file tree
Hide file tree
Showing 53 changed files with 1,150 additions and 53 deletions.
4 changes: 4 additions & 0 deletions GameScreen.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
extends Node



186 changes: 186 additions & 0 deletions GameScreen.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,186 @@
[gd_scene load_steps=16 format=2]

[ext_resource path="res://GameScreen.gd" type="Script" id=1]
[ext_resource path="res://assets/0x72_16x16DungeonTileset.v4.png" type="Texture" id=2]
[ext_resource path="res://entites/King.tscn" type="PackedScene" id=3]
[ext_resource path="res://lib/player/Player.tscn" type="PackedScene" id=4]
[ext_resource path="res://lib/bow/Bow.tscn" type="PackedScene" id=6]

[sub_resource type="ConvexPolygonShape2D" id=11]
points = PoolVector2Array( 16, 16, 0, 16, 0, 16, 16, 16 )

[sub_resource type="ConvexPolygonShape2D" id=12]
points = PoolVector2Array( 16, 16, 0, 16, 0, 0, 16, 0 )

[sub_resource type="ConvexPolygonShape2D" id=13]
points = PoolVector2Array( 16, 16, 0, 16, 0, 0, 16, 0 )

[sub_resource type="ConvexPolygonShape2D" id=14]
points = PoolVector2Array( 16, 16, 0, 16, 0, 0, 16, 0 )

[sub_resource type="ConvexPolygonShape2D" id=15]
points = PoolVector2Array( 16, 16, 0, 16, 0, 0, 16, 0 )

[sub_resource type="ConvexPolygonShape2D" id=16]
points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 )

[sub_resource type="ConvexPolygonShape2D" id=17]
points = PoolVector2Array( 16, 16, 0, 16, 0, 0, 16, 0 )

[sub_resource type="ConvexPolygonShape2D" id=18]
points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 )

[sub_resource type="ConvexPolygonShape2D" id=19]
points = PoolVector2Array( 16, 16, 0, 16, 0, 0, 16, 0 )

[sub_resource type="TileSet" id=20]
0/name = "0x72_16x16DungeonTileset.v4.png 0"
0/texture = ExtResource( 2 )
0/tex_offset = Vector2( 0, 0 )
0/modulate = Color( 1, 1, 1, 1 )
0/region = Rect2( 0, 0, 112, 144 )
0/tile_mode = 2
0/autotile/icon_coordinate = Vector2( 0, 0 )
0/autotile/tile_size = Vector2( 16, 16 )
0/autotile/spacing = 0
0/autotile/occluder_map = [ ]
0/autotile/navpoly_map = [ ]
0/autotile/priority_map = [ ]
0/autotile/z_index_map = [ ]
0/occluder_offset = Vector2( 0, 0 )
0/navigation_offset = Vector2( 0, 0 )
0/shape_offset = Vector2( 0, 0 )
0/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 )
0/shape = SubResource( 11 )
0/shape_one_way = false
0/shape_one_way_margin = 1.0
0/shapes = [ {
"autotile_coord": Vector2( 0, 0 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 11 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 0, 1 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 12 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 1, 1 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 13 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 2, 1 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 14 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 3, 1 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 15 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 3, 1 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 16 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 0, 4 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 17 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 0, 4 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 18 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 1, 4 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 19 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
} ]
0/z_index = 0
1/name = "0x72_16x16DungeonTileset.v4.png 1"
1/texture = ExtResource( 2 )
1/tex_offset = Vector2( 0, 0 )
1/modulate = Color( 1, 1, 1, 1 )
1/region = Rect2( 160, 64, 96, 80 )
1/tile_mode = 2
1/autotile/icon_coordinate = Vector2( 0, 0 )
1/autotile/tile_size = Vector2( 16, 16 )
1/autotile/spacing = 0
1/autotile/occluder_map = [ ]
1/autotile/navpoly_map = [ ]
1/autotile/priority_map = [ ]
1/autotile/z_index_map = [ ]
1/occluder_offset = Vector2( 0, 0 )
1/navigation_offset = Vector2( 0, 0 )
1/shape_offset = Vector2( 0, 0 )
1/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 )
1/shape_one_way = false
1/shape_one_way_margin = 0.0
1/shapes = [ ]
1/z_index = 0
2/name = "0x72_16x16DungeonTileset.v4.png 2"
2/texture = ExtResource( 2 )
2/tex_offset = Vector2( 0, 0 )
2/modulate = Color( 1, 1, 1, 1 )
2/region = Rect2( 128, 112, 32, 32 )
2/tile_mode = 2
2/autotile/icon_coordinate = Vector2( 0, 0 )
2/autotile/tile_size = Vector2( 16, 16 )
2/autotile/spacing = 0
2/autotile/occluder_map = [ ]
2/autotile/navpoly_map = [ ]
2/autotile/priority_map = [ ]
2/autotile/z_index_map = [ ]
2/occluder_offset = Vector2( 0, 0 )
2/navigation_offset = Vector2( 0, 0 )
2/shape_offset = Vector2( 0, 0 )
2/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 )
2/shape_one_way = false
2/shape_one_way_margin = 0.0
2/shapes = [ ]
2/z_index = 0

[node name="GameScreen" type="Node"]
script = ExtResource( 1 )

[node name="Level" type="Node" parent="."]

[node name="Level0" type="Node" parent="Level"]

[node name="TileMap" type="TileMap" parent="Level/Level0"]
tile_set = SubResource( 20 )
cell_size = Vector2( 16, 16 )
collision_layer = 32
collision_mask = 0
format = 1
tile_data = PoolIntArray( 65538, 0, 2, 65539, 0, 2, 65540, 0, 2, 65541, 0, 2, 65542, 0, 2, 65543, 0, 2, 65544, 0, 2, 65545, 0, 2, 65546, 0, 2, 65547, 0, 2, 65548, 0, 2, 65549, 0, 2, 65550, 0, 2, 65551, 0, 2, 65552, 0, 2, 65553, 0, 2, 65554, 0, 2, 65555, 0, 2, 131074, 0, 65536, 131075, 0, 65536, 131076, 1, 3, 131077, 0, 65536, 131078, 0, 262149, 131079, 0, 65536, 131080, 0, 65536, 131081, 0, 65536, 131082, 1, 5, 131083, 0, 65536, 131084, 0, 65536, 131085, 0, 65536, 131086, 0, 65536, 131087, 0, 65539, 131088, 0, 65536, 131089, 0, 65536, 131090, 0, 65536, 131091, 0, 65536, 196610, 0, 65536, 196611, 0, 131072, 196612, 0, 131072, 196613, 0, 131072, 196614, 0, 327685, 196615, 0, 131072, 196616, 0, 131072, 196617, 0, 131072, 196618, 0, 131072, 196619, 0, 131072, 196620, 0, 131072, 196621, 0, 131072, 196622, 0, 131072, 196623, 0, 131075, 196624, 0, 131072, 196625, 0, 131072, 196626, 0, 131072, 196627, 0, 65536, 262146, 0, 65536, 262147, 0, 196610, 262148, 0, 196610, 262149, 0, 196610, 262150, 0, 196610, 262151, 0, 196610, 262152, 0, 196610, 262153, 0, 196610, 262154, 0, 196610, 262155, 0, 196610, 262156, 0, 196610, 262157, 0, 196610, 262158, 0, 196610, 262159, 0, 196610, 262160, 0, 196610, 262161, 0, 196610, 262162, 0, 196610, 262163, 0, 65536, 327682, 0, 65536, 327683, 0, 196610, 327684, 0, 196610, 327685, 0, 196610, 327686, 0, 196610, 327687, 0, 196610, 327688, 0, 196610, 327689, 0, 196610, 327690, 0, 196610, 327691, 0, 196610, 327692, 0, 196610, 327693, 0, 196610, 327694, 0, 196610, 327695, 0, 196610, 327696, 0, 196610, 327697, 0, 196610, 327698, 0, 196610, 327699, 0, 65536, 393218, 0, 65536, 393219, 0, 196610, 393220, 0, 196610, 393221, 0, 196610, 393222, 0, 196610, 393223, 0, 393216, 393224, 0, 393217, 393225, 0, 393217, 393226, 0, 393217, 393227, 0, 393217, 393228, 0, 393219, 393229, 0, 196610, 393230, 0, 196610, 393231, 0, 196610, 393232, 0, 196610, 393233, 0, 196610, 393234, 0, 196610, 393235, 0, 65536, 458754, 0, 65536, 458755, 0, 196610, 458756, 0, 196610, 458757, 0, 196610, 458758, 0, 196610, 458759, 0, 458752, 458760, 0, 458756, 458761, 0, 458756, 458762, 0, 458756, 458763, 0, 458756, 458764, 0, 458755, 458765, 0, 196610, 458766, 0, 196610, 458767, 0, 196610, 458768, 0, 196610, 458769, 0, 196610, 458770, 0, 196610, 458771, 0, 65536, 524290, 0, 65536, 524291, 0, 196610, 524292, 0, 196610, 524293, 0, 196610, 524294, 0, 196610, 524295, 0, 524288, 524296, 0, 524289, 524297, 0, 524289, 524298, 0, 524289, 524299, 0, 524289, 524300, 0, 458755, 524301, 0, 196610, 524302, 0, 196610, 524303, 0, 196610, 524304, 0, 196610, 524305, 0, 196610, 524306, 0, 196610, 524307, 0, 65536, 589826, 0, 65536, 589827, 0, 196610, 589828, 0, 196610, 589829, 0, 196610, 589830, 0, 196610, 589831, 0, 196610, 589832, 0, 196610, 589833, 0, 196610, 589834, 0, 196610, 589835, 0, 196610, 589836, 0, 458755, 589837, 0, 196610, 589838, 0, 196610, 589839, 0, 196610, 589840, 0, 196610, 589841, 0, 196610, 589842, 0, 196610, 589843, 0, 65536, 655362, 0, 65536, 655363, 0, 196610, 655364, 0, 196610, 655365, 0, 196610, 655366, 0, 196610, 655367, 0, 196610, 655368, 0, 196610, 655369, 0, 196610, 655370, 0, 196610, 655371, 0, 196610, 655372, 0, 196610, 655373, 0, 196610, 655374, 0, 196610, 655375, 0, 196610, 655376, 0, 196610, 655377, 0, 196610, 655378, 0, 196610, 655379, 0, 65536, 720898, 0, 65536, 720899, 0, 196610, 720900, 0, 196610, 720901, 0, 196610, 720902, 0, 196610, 720903, 0, 196610, 720904, 0, 196610, 720905, 0, 196610, 720906, 0, 196610, 720907, 0, 196610, 720908, 0, 196610, 720909, 0, 196610, 720910, 0, 196610, 720911, 0, 196610, 720912, 0, 196610, 720913, 0, 196610, 720914, 0, 196610, 720915, 0, 65536, 786434, 0, 65536, 786435, 0, 196610, 786436, 0, 196610, 786437, 0, 196610, 786438, 0, 196610, 786439, 0, 196610, 786440, 0, 196610, 786441, 0, 196610, 786442, 0, 196610, 786443, 0, 196610, 786444, 0, 196610, 786445, 0, 196610, 786446, 0, 196610, 786447, 0, 196610, 786448, 0, 196610, 786449, 0, 196610, 786450, 0, 196610, 786451, 0, 65536, 851970, 0, 65536, 851971, 0, 65536, 851972, 0, 65536, 851973, 0, 65536, 851974, 0, 65536, 851975, 0, 65536, 851976, 0, 65536, 851977, 0, 65536, 851978, 0, 65536, 851979, 0, 65536, 851980, 0, 65536, 851981, 0, 65536, 851982, 0, 65536, 851983, 0, 65536, 851984, 0, 65536, 851985, 0, 65536, 851986, 0, 65536, 851987, 0, 65536 )

[node name="King" parent="Level/Level0" instance=ExtResource( 3 )]
visible = false
position = Vector2( 191, 144 )
collision_mask = 32
offset = Vector2( 10, -8 )

[node name="Player" parent="Level/Level0" instance=ExtResource( 4 )]

[node name="Camera2D" type="Camera2D" parent="Level/Level0/Player"]
position = Vector2( 63, 7 )
current = true
zoom = Vector2( 0.75, 0.75 )

[node name="Bow" parent="Level/Level0" instance=ExtResource( 6 )]

[node name="Overlays" type="Node" parent="."]
36 changes: 36 additions & 0 deletions InventoryLayer.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
extends CanvasLayer


# Declare member variables here. Examples:
# var a = 2
# var b = "text"

onready var slots = [$slot0,$slot1]


# Called when the node enters the scene tree for the first time.
func _ready():
set_process_input(false)
EventBus.connect("open_inventory",self,"on_open_inventory")
EventBus.connect("close_inventory",self,"on_close_inventory")
EventBus.connect("inventory_modified",self, "on_inventory_modified")

func on_inventory_modified(inventory):
print("UI: on_inventory_modified ({0})".format({0:inventory.get_child_count()}))
var pos = 0
for obj in inventory.get_children():
slots[pos].texture = obj.icon_texture
pos += 1


func on_open_inventory():
set_process_input(true)
visible = true

func on_close_inventory():
set_process_input(false)
visible = false


func _on_TextureButton_button_down():
EventBus.emit_signal("close_inventory")
2 changes: 2 additions & 0 deletions MainScreen.gd
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@ func _input(event):
$DialogueLayer.say(["Zetalè noi non siamo boomer, ", "noi apparteniamo alla Generazione X, noi siamo stati i figli degli anni '80: qui sono leon fuxioa sotto luci blu, ", "colori accesi, batterie elettroniche, Magnum PI, Miami Vice e abiti fighissimi!!!"])
if event.scancode == KEY_L:
$DialogueLayer.hide()

func _ready():
EventBus.connect("pick_coin",self, "on_pick_coin")


func on_pick_coin(coin):
print("on pick coin: ",coin)
var notification = Notification.instance()
Expand Down
Loading

0 comments on commit 58fd011

Please sign in to comment.