diff --git a/ASSETS/sounds/giorno1.wav b/ASSETS/sounds/giorno1.wav new file mode 100644 index 0000000..080d5ba Binary files /dev/null and b/ASSETS/sounds/giorno1.wav differ diff --git a/ASSETS/sounds/giorno1.wav.import b/ASSETS/sounds/giorno1.wav.import new file mode 100644 index 0000000..99f517a --- /dev/null +++ b/ASSETS/sounds/giorno1.wav.import @@ -0,0 +1,23 @@ +[remap] + +importer="wav" +type="AudioStreamSample" +path="res://.import/giorno1.wav-af2d65e89a0aca6e7fe0c4bed3de1c9c.sample" + +[deps] + +source_file="res://ASSETS/sounds/giorno1.wav" +dest_files=[ "res://.import/giorno1.wav-af2d65e89a0aca6e7fe0c4bed3de1c9c.sample" ] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=0 diff --git a/ASSETS/sounds/notte1.wav b/ASSETS/sounds/notte1.wav new file mode 100644 index 0000000..da5cf4a Binary files /dev/null and b/ASSETS/sounds/notte1.wav differ diff --git a/ASSETS/sounds/notte1.wav.import b/ASSETS/sounds/notte1.wav.import new file mode 100644 index 0000000..53a3e1a --- /dev/null +++ b/ASSETS/sounds/notte1.wav.import @@ -0,0 +1,23 @@ +[remap] + +importer="wav" +type="AudioStreamSample" +path="res://.import/notte1.wav-7be469264486ef6a51780eaef9e682b9.sample" + +[deps] + +source_file="res://ASSETS/sounds/notte1.wav" +dest_files=[ "res://.import/notte1.wav-7be469264486ef6a51780eaef9e682b9.sample" ] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=0 diff --git a/ASSETS/sounds/salto1.wav b/ASSETS/sounds/salto1.wav new file mode 100644 index 0000000..2f42c3a Binary files /dev/null and b/ASSETS/sounds/salto1.wav differ diff --git a/ASSETS/sounds/salto1.wav.import b/ASSETS/sounds/salto1.wav.import new file mode 100644 index 0000000..0d3aeb3 --- /dev/null +++ b/ASSETS/sounds/salto1.wav.import @@ -0,0 +1,23 @@ +[remap] + +importer="wav" +type="AudioStreamSample" +path="res://.import/salto1.wav-0c07c6a37f8b13e72cb42ae01912a767.sample" + +[deps] + +source_file="res://ASSETS/sounds/salto1.wav" +dest_files=[ "res://.import/salto1.wav-0c07c6a37f8b13e72cb42ae01912a767.sample" ] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=0 diff --git a/ASSETS/sounds/suoneria_giorno.wav b/ASSETS/sounds/suoneria_giorno.wav new file mode 100644 index 0000000..168d2ee Binary files /dev/null and b/ASSETS/sounds/suoneria_giorno.wav differ diff --git a/ASSETS/sounds/suoneria_giorno.wav.import b/ASSETS/sounds/suoneria_giorno.wav.import new file mode 100644 index 0000000..378d184 --- /dev/null +++ b/ASSETS/sounds/suoneria_giorno.wav.import @@ -0,0 +1,23 @@ +[remap] + +importer="wav" +type="AudioStreamSample" +path="res://.import/suoneria_giorno.wav-3195d8672c362f61f290ec34b89e22e6.sample" + +[deps] + +source_file="res://ASSETS/sounds/suoneria_giorno.wav" +dest_files=[ "res://.import/suoneria_giorno.wav-3195d8672c362f61f290ec34b89e22e6.sample" ] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=0 diff --git a/ASSETS/sounds/suoneria_notte.wav b/ASSETS/sounds/suoneria_notte.wav new file mode 100644 index 0000000..79d3c0c Binary files /dev/null and b/ASSETS/sounds/suoneria_notte.wav differ diff --git a/ASSETS/sounds/suoneria_notte.wav.import b/ASSETS/sounds/suoneria_notte.wav.import new file mode 100644 index 0000000..e2c10c2 --- /dev/null +++ b/ASSETS/sounds/suoneria_notte.wav.import @@ -0,0 +1,23 @@ +[remap] + +importer="wav" +type="AudioStreamSample" +path="res://.import/suoneria_notte.wav-42c1544d119772f35296b74f19e27183.sample" + +[deps] + +source_file="res://ASSETS/sounds/suoneria_notte.wav" +dest_files=[ "res://.import/suoneria_notte.wav-42c1544d119772f35296b74f19e27183.sample" ] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=0 diff --git a/Level1.tscn b/Level1.tscn index 993c47e..cc1d187 100644 --- a/Level1.tscn +++ b/Level1.tscn @@ -1,7 +1,7 @@ [gd_scene load_steps=12 format=2] [ext_resource path="res://light.tscn" type="PackedScene" id=1] -[ext_resource path="res://Giovanna.tscn" type="PackedScene" id=2] +[ext_resource path="res://Player.tscn" type="PackedScene" id=2] [ext_resource path="res://brick_tileset.tres" type="TileSet" id=3] [ext_resource path="res://ASSETS/Background/Layer 7.png" type="Texture" id=4] [ext_resource path="res://ASSETS/Background/Skyline2.png" type="Texture" id=5] @@ -9,7 +9,7 @@ [ext_resource path="res://ASSETS/Background/Sun total.png" type="Texture" id=7] [sub_resource type="GDScript" id=3] -script/source = "extends Control +script/source = "extends Node2D func _input(event): if Input.is_action_just_pressed(\"quit\"): @@ -39,29 +39,9 @@ func _process(delta): [sub_resource type="RectangleShape2D" id=4] extents = Vector2( 212, 31 ) -[node name="Level1" type="Control"] -anchor_right = 1.0 -anchor_bottom = 1.0 +[node name="Level1" type="Node2D"] script = SubResource( 3 ) -[node name="Giovanna" parent="." instance=ExtResource( 2 )] -position = Vector2( 161, -24 ) - -[node name="Camera2D" type="Camera2D" parent="Giovanna"] -offset = Vector2( 0, -50 ) -current = true -limit_bottom = 390 -drag_margin_h_enabled = true - -[node name="TileMap" type="TileMap" parent="."] -tile_set = ExtResource( 3 ) -cell_size = Vector2( 16, 16 ) -format = 1 -tile_data = PoolIntArray( -262117, 0, 0, 131074, 20, 0, 262148, 20, 0, 393241, 1, 0, 393242, 2, 0, 393243, 17, 0, 393245, 1, 0, 393246, 15, 0, 393247, 15, 0, 393248, 15, 0, 393249, 15, 0, 393250, 15, 0, 393251, 15, 0, 393252, 17, 0, 458777, 4, 0, 458778, 7, 0, 458779, 8, 0, 458781, 4, 0, 458782, 10, 0, 458783, 9, 0, 458784, 10, 0, 458785, 9, 0, 458786, 10, 0, 458787, 9, 0, 458788, 16, 0, 458789, 17, 0, 524291, 20, 0, 524309, 1, 0, 524310, 2, 0, 524311, 3, 0, 524317, 19, 0, 524319, 19, 0, 524321, 19, 0, 524323, 4, 0, 524324, 10, 0, 524325, 16, 0, 524326, 17, 0, 589845, 6, 0, 589846, 7, 0, 589847, 8, 0, 589853, 19, 0, 589855, 19, 0, 589857, 19, 0, 589859, 19, 0, 589861, 13, 0, 589862, 16, 0, 589863, 17, 0, 655360, 3, 0, 655378, 1, 0, 655379, 3, 0, 655389, 19, 0, 655391, 19, 0, 655393, 19, 0, 655395, 19, 0, 655397, 4, 0, 655398, 10, 0, 655399, 16, 0, 655400, 17, 0, 720896, 12, 0, 720897, 20, 0, 720914, 6, 0, 720915, 8, 0, 720925, 19, 0, 720927, 19, 0, 720929, 19, 0, 720931, 19, 0, 720933, 19, 0, 720935, 13, 0, 720936, 10, 0, 720937, 17, 0, 720941, 25, 0, 720942, 2, 0, 720943, 24, 0, 786432, 12, 0, 786436, 20, 0, 786442, 18, 0, 786443, 1, 0, 786444, 2, 0, 786445, 2, 0, 786446, 2, 0, 786447, 2, 0, 786448, 3, 0, 786461, 19, 0, 786463, 19, 0, 786465, 19, 0, 786467, 19, 0, 786469, 19, 0, 786471, 19, 0, 786473, 19, 0, 786478, 19, 0, 851968, 12, 0, 851977, 18, 0, 851978, 16, 0, 851979, 6, 0, 851980, 7, 0, 851981, 7, 0, 851982, 7, 0, 851983, 7, 0, 851984, 8, 0, 851997, 19, 0, 851999, 19, 0, 852001, 19, 0, 852003, 19, 0, 852005, 19, 0, 852007, 19, 0, 852009, 19, 0, 852014, 19, 0, 983030, 20, 0, 917504, 12, 0, 917506, 20, 0, 917512, 18, 0, 917513, 16, 0, 917514, 0, 0, 917515, 5, 0, 917533, 19, 0, 917535, 19, 0, 917537, 19, 0, 917539, 19, 0, 917541, 19, 0, 917543, 19, 0, 917545, 19, 0, 917550, 19, 0, 983040, 12, 0, 983047, 18, 0, 983048, 16, 0, 983049, 0, 0, 983050, 0, 0, 983051, 5, 0, 983069, 19, 0, 983071, 19, 0, 983073, 19, 0, 983075, 19, 0, 983077, 19, 0, 983079, 19, 0, 983081, 19, 0, 983086, 19, 0, 1048576, 14, 0, 1048577, 2, 0, 1048578, 2, 0, 1048579, 2, 0, 1048580, 2, 0, 1048581, 2, 0, 1048582, 2, 0, 1048583, 2, 0, 1048584, 2, 0, 1048585, 2, 0, 1048586, 2, 0, 1048587, 2, 0, 1048588, 2, 0, 1048589, 2, 0, 1048590, 2, 0, 1048591, 2, 0, 1048592, 2, 0, 1048593, 2, 0, 1048594, 2, 0, 1048595, 2, 0, 1048596, 2, 0, 1048597, 2, 0, 1048598, 2, 0, 1048599, 2, 0, 1048600, 2, 0, 1048601, 2, 0, 1048602, 2, 0, 1048603, 2, 0, 1048604, 2, 0, 1048605, 5, 0, 1048607, 19, 0, 1048609, 19, 0, 1048611, 19, 0, 1048613, 19, 0, 1048615, 19, 0, 1048617, 19, 0, 1048622, 19, 0, 1048623, 23, 0, 1048624, 23, 0, 1048625, 23, 0, 1048626, 23, 0, 1048627, 23, 0, 1048628, 23, 0, 1048629, 23, 0, 1048630, 23, 0, 1048631, 23, 0, 1048632, 23, 0, 1048633, 23, 0, 1048634, 23, 0, 1048635, 23, 0, 1048636, 23, 0, 1048637, 23, 0, 1048638, 23, 0, 1048639, 23, 0, 1048640, 23, 0, 1048641, 23, 0, 1048642, 23, 0, 1048643, 23, 0, 1048644, 23, 0, 1048645, 23, 0, 1048646, 23, 0, 1048647, 23, 0, 1048648, 23, 0, 1048649, 23, 0, 1048650, 23, 0, 1048651, 23, 0, 1048652, 23, 0, 1048653, 23, 0, 1048654, 23, 0, 1048655, 23, 0, 1048656, 23, 0, 1048657, 23, 0, 1048658, 23, 0, 1048659, 23, 0, 1048660, 23, 0, 1048661, 23, 0, 1048662, 23, 0, 1048663, 23, 0, 1048664, 23, 0, 1048665, 23, 0, 1048666, 23, 0, 1048667, 23, 0, 1048668, 23, 0, 1048669, 23, 0, 1048670, 23, 0, 1048671, 23, 0, 1048672, 23, 0, 1048673, 23, 0, 1048674, 23, 0, 1048675, 23, 0, 1048676, 23, 0, 1048677, 23, 0, 1048678, 23, 0, 1048679, 23, 0, 1048680, 23, 0, 1048681, 23, 0, 1048682, 23, 0, 1048683, 23, 0, 1048684, 23, 0, 1048685, 23, 0, 1048686, 23, 0, 1048687, 23, 0, 1048688, 23, 0, 1048689, 23, 0, 1048690, 23, 0, 1048691, 23, 0, 1048692, 23, 0, 1048693, 23, 0, 1048694, 23, 0, 1048695, 23, 0, 1048696, 23, 0, 1048697, 23, 0, 1048698, 23, 0, 1048699, 23, 0, 1048700, 23, 0, 1048701, 23, 0, 1048702, 23, 0, 1048703, 23, 0, 1048704, 23, 0, 1048705, 23, 0, 1048706, 23, 0, 1048707, 23, 0, 1048708, 23, 0, 1048709, 23, 0, 1048710, 23, 0, 1048711, 23, 0, 1048712, 23, 0, 1048713, 23, 0, 1048714, 23, 0, 1048715, 23, 0, 1048716, 23, 0, 1048717, 23, 0, 1048718, 23, 0, 1048719, 23, 0, 1048720, 23, 0, 1048721, 23, 0, 1048722, 23, 0, 1048723, 23, 0, 1048724, 23, 0, 1048725, 23, 0, 1048726, 23, 0, 1048727, 23, 0, 1048728, 23, 0, 1048729, 23, 0, 1048730, 23, 0, 1048731, 23, 0, 1048732, 23, 0, 1048733, 23, 0, 1048734, 23, 0, 1048735, 23, 0, 1048736, 23, 0, 1048737, 23, 0, 1048738, 23, 0, 1048739, 23, 0, 1048740, 23, 0, 1048741, 23, 0, 1048742, 23, 0, 1048743, 23, 0, 1048744, 23, 0, 1048745, 23, 0, 1048746, 23, 0, 1048747, 23, 0, 1048748, 23, 0, 1048749, 23, 0, 1048750, 23, 0, 1048751, 23, 0, 1048752, 23, 0, 1048753, 23, 0, 1048754, 23, 0, 1048755, 23, 0, 1048756, 23, 0, 1048757, 23, 0, 1048758, 23, 0, 1048759, 23, 0, 1048760, 23, 0, 1048761, 23, 0, 1048762, 23, 0, 1048763, 23, 0, 1048764, 23, 0, 1048765, 23, 0, 1048766, 23, 0, 1048767, 23, 0, 1048768, 23, 0, 1048769, 23, 0, 1048770, 23, 0, 1048771, 23, 0, 1048772, 23, 0, 1048773, 23, 0, 1048774, 23, 0, 1048775, 23, 0, 1048776, 23, 0, 1048777, 23, 0, 1048778, 23, 0, 1048779, 23, 0, 1048780, 23, 0, 1048781, 23, 0, 1048782, 23, 0, 1048783, 23, 0, 1048784, 23, 0, 1048785, 23, 0, 1048786, 23, 0, 1048787, 23, 0, 1048788, 23, 0, 1048789, 23, 0, 1048790, 23, 0, 1048791, 23, 0, 1048792, 23, 0, 1048793, 23, 0, 1048794, 23, 0, 1048795, 23, 0, 1048796, 23, 0, 1048797, 23, 0, 1048798, 23, 0, 1048799, 23, 0, 1048800, 23, 0, 1048801, 23, 0, 1048802, 23, 0, 1048803, 23, 0, 1048804, 23, 0, 1048805, 23, 0, 1048806, 23, 0, 1048807, 23, 0, 1048808, 23, 0, 1048809, 23, 0, 1048810, 23, 0, 1048811, 23, 0, 1048812, 23, 0, 1048813, 23, 0, 1048814, 23, 0, 1048815, 23, 0, 1048816, 23, 0, 1048817, 23, 0, 1048818, 23, 0, 1048819, 23, 0, 1048820, 23, 0, 1048821, 23, 0, 1048822, 23, 0, 1048823, 23, 0, 1048824, 23, 0, 1048825, 23, 0, 1048826, 23, 0, 1048827, 23, 0, 1048828, 23, 0, 1048829, 23, 0, 1114140, 6, 0, 1114141, 7, 0, 1114142, 23, 0, 1114143, 10, 0, 1114144, 23, 0, 1114145, 10, 0, 1114146, 23, 0, 1114147, 10, 0, 1114148, 23, 0, 1114149, 10, 0, 1114150, 23, 0, 1114151, 10, 0, 1114152, 23, 0, 1114153, 8, 0, 1114158, 19, 0 ) - -[node name="light" parent="." instance=ExtResource( 1 )] -position = Vector2( 213, 172 ) - [node name="ParallaxBackground" type="ParallaxBackground" parent="."] [node name="ParallaxLayer2" type="ParallaxLayer" parent="ParallaxBackground"] @@ -93,6 +73,19 @@ motion_mirroring = Vector2( 1920, 0 ) [node name="Sprite" type="Sprite" parent="ParallaxBackground/ParallaxLayer"] texture = ExtResource( 5 ) +[node name="TileMap" type="TileMap" parent="."] +tile_set = ExtResource( 3 ) +cell_size = Vector2( 16, 16 ) +format = 1 +tile_data = PoolIntArray( -262117, 0, 0, 131074, 20, 0, 262148, 20, 0, 393241, 1, 0, 393242, 2, 0, 393243, 17, 0, 393245, 1, 0, 393246, 15, 0, 393247, 15, 0, 393248, 15, 0, 393249, 15, 0, 393250, 15, 0, 393251, 15, 0, 393252, 17, 0, 458777, 4, 0, 458778, 7, 0, 458779, 8, 0, 458781, 4, 0, 458782, 10, 0, 458783, 9, 0, 458784, 10, 0, 458785, 9, 0, 458786, 10, 0, 458787, 9, 0, 458788, 16, 0, 458789, 17, 0, 524291, 20, 0, 524309, 1, 0, 524310, 2, 0, 524311, 3, 0, 524317, 19, 0, 524319, 19, 0, 524321, 19, 0, 524323, 4, 0, 524324, 10, 0, 524325, 16, 0, 524326, 17, 0, 589845, 6, 0, 589846, 7, 0, 589847, 8, 0, 589853, 19, 0, 589855, 19, 0, 589857, 19, 0, 589859, 19, 0, 589861, 13, 0, 589862, 16, 0, 589863, 17, 0, 655360, 3, 0, 655378, 1, 0, 655379, 3, 0, 655389, 19, 0, 655391, 19, 0, 655393, 19, 0, 655395, 19, 0, 655397, 4, 0, 655398, 10, 0, 655399, 16, 0, 655400, 17, 0, 720896, 12, 0, 720897, 20, 0, 720914, 6, 0, 720915, 8, 0, 720925, 19, 0, 720927, 19, 0, 720929, 19, 0, 720931, 19, 0, 720933, 19, 0, 720935, 13, 0, 720936, 10, 0, 720937, 17, 0, 720941, 25, 0, 720942, 2, 0, 720943, 24, 0, 786432, 12, 0, 786436, 20, 0, 786442, 18, 0, 786443, 1, 0, 786444, 2, 0, 786445, 2, 0, 786446, 2, 0, 786447, 2, 0, 786448, 3, 0, 786461, 19, 0, 786463, 19, 0, 786465, 19, 0, 786467, 19, 0, 786469, 19, 0, 786471, 19, 0, 786473, 19, 0, 786478, 19, 0, 851968, 12, 0, 851977, 18, 0, 851978, 16, 0, 851979, 6, 0, 851980, 7, 0, 851981, 7, 0, 851982, 7, 0, 851983, 7, 0, 851984, 8, 0, 851997, 19, 0, 851999, 19, 0, 852001, 19, 0, 852003, 19, 0, 852005, 19, 0, 852007, 19, 0, 852009, 19, 0, 852014, 19, 0, 983030, 20, 0, 917504, 12, 0, 917506, 20, 0, 917512, 18, 0, 917513, 16, 0, 917514, 0, 0, 917515, 5, 0, 917533, 19, 0, 917535, 19, 0, 917537, 19, 0, 917539, 19, 0, 917541, 19, 0, 917543, 19, 0, 917545, 19, 0, 917550, 19, 0, 983040, 12, 0, 983047, 18, 0, 983048, 16, 0, 983049, 0, 0, 983050, 0, 0, 983051, 5, 0, 983069, 19, 0, 983071, 19, 0, 983073, 19, 0, 983075, 19, 0, 983077, 19, 0, 983079, 19, 0, 983081, 19, 0, 983086, 19, 0, 1048576, 14, 0, 1048577, 2, 0, 1048578, 2, 0, 1048579, 2, 0, 1048580, 2, 0, 1048581, 2, 0, 1048582, 2, 0, 1048583, 2, 0, 1048584, 2, 0, 1048585, 2, 0, 1048586, 2, 0, 1048587, 2, 0, 1048588, 2, 0, 1048589, 2, 0, 1048590, 2, 0, 1048591, 2, 0, 1048592, 2, 0, 1048593, 2, 0, 1048594, 2, 0, 1048595, 2, 0, 1048596, 2, 0, 1048597, 2, 0, 1048598, 2, 0, 1048599, 2, 0, 1048600, 2, 0, 1048601, 2, 0, 1048602, 2, 0, 1048603, 2, 0, 1048604, 2, 0, 1048605, 5, 0, 1048607, 19, 0, 1048609, 19, 0, 1048611, 19, 0, 1048613, 19, 0, 1048615, 19, 0, 1048617, 19, 0, 1048622, 19, 0, 1048623, 23, 0, 1048624, 23, 0, 1048625, 23, 0, 1048626, 23, 0, 1048627, 23, 0, 1048628, 23, 0, 1048629, 23, 0, 1048630, 23, 0, 1048631, 23, 0, 1048632, 23, 0, 1048633, 23, 0, 1048634, 23, 0, 1048635, 23, 0, 1048636, 23, 0, 1048637, 23, 0, 1048638, 23, 0, 1048639, 23, 0, 1048640, 23, 0, 1048641, 23, 0, 1048642, 23, 0, 1048643, 23, 0, 1048644, 23, 0, 1048645, 23, 0, 1048646, 23, 0, 1048647, 23, 0, 1048648, 23, 0, 1048649, 23, 0, 1048650, 23, 0, 1048651, 23, 0, 1048652, 23, 0, 1048653, 23, 0, 1048654, 23, 0, 1048655, 23, 0, 1048656, 23, 0, 1048657, 23, 0, 1048658, 23, 0, 1048659, 23, 0, 1048660, 23, 0, 1048661, 23, 0, 1048662, 23, 0, 1048663, 23, 0, 1048664, 23, 0, 1048665, 23, 0, 1048666, 23, 0, 1048667, 23, 0, 1048668, 23, 0, 1048669, 23, 0, 1048670, 23, 0, 1048671, 23, 0, 1048672, 23, 0, 1048673, 23, 0, 1048674, 23, 0, 1048675, 23, 0, 1048676, 23, 0, 1048677, 23, 0, 1048678, 23, 0, 1048679, 23, 0, 1048680, 23, 0, 1048681, 23, 0, 1048682, 23, 0, 1048683, 23, 0, 1048684, 23, 0, 1048685, 23, 0, 1048686, 23, 0, 1048687, 23, 0, 1048688, 23, 0, 1048689, 23, 0, 1048690, 23, 0, 1048691, 23, 0, 1048692, 23, 0, 1048693, 23, 0, 1048694, 23, 0, 1048695, 23, 0, 1048696, 23, 0, 1048697, 23, 0, 1048698, 23, 0, 1048699, 23, 0, 1048700, 23, 0, 1048701, 23, 0, 1048702, 23, 0, 1048703, 23, 0, 1048704, 23, 0, 1048705, 23, 0, 1048706, 23, 0, 1048707, 23, 0, 1048708, 23, 0, 1048709, 23, 0, 1048710, 23, 0, 1048711, 23, 0, 1048712, 23, 0, 1048713, 23, 0, 1048714, 23, 0, 1048715, 23, 0, 1048716, 23, 0, 1048717, 23, 0, 1048718, 23, 0, 1048719, 23, 0, 1048720, 23, 0, 1048721, 23, 0, 1048722, 23, 0, 1048723, 23, 0, 1048724, 23, 0, 1048725, 23, 0, 1048726, 23, 0, 1048727, 23, 0, 1048728, 23, 0, 1048729, 23, 0, 1048730, 23, 0, 1048731, 23, 0, 1048732, 23, 0, 1048733, 23, 0, 1048734, 23, 0, 1048735, 23, 0, 1048736, 23, 0, 1048737, 23, 0, 1048738, 23, 0, 1048739, 23, 0, 1048740, 23, 0, 1048741, 23, 0, 1048742, 23, 0, 1048743, 23, 0, 1048744, 23, 0, 1048745, 23, 0, 1048746, 23, 0, 1048747, 23, 0, 1048748, 23, 0, 1048749, 23, 0, 1048750, 23, 0, 1048751, 23, 0, 1048752, 23, 0, 1048753, 23, 0, 1048754, 23, 0, 1048755, 23, 0, 1048756, 23, 0, 1048757, 23, 0, 1048758, 23, 0, 1048759, 23, 0, 1048760, 23, 0, 1048761, 23, 0, 1048762, 23, 0, 1048763, 23, 0, 1048764, 23, 0, 1048765, 23, 0, 1048766, 23, 0, 1048767, 23, 0, 1048768, 23, 0, 1048769, 23, 0, 1048770, 23, 0, 1048771, 23, 0, 1048772, 23, 0, 1048773, 23, 0, 1048774, 23, 0, 1048775, 23, 0, 1048776, 23, 0, 1048777, 23, 0, 1048778, 23, 0, 1048779, 23, 0, 1048780, 23, 0, 1048781, 23, 0, 1048782, 23, 0, 1048783, 23, 0, 1048784, 23, 0, 1048785, 23, 0, 1048786, 23, 0, 1048787, 23, 0, 1048788, 23, 0, 1048789, 23, 0, 1048790, 23, 0, 1048791, 23, 0, 1048792, 23, 0, 1048793, 23, 0, 1048794, 23, 0, 1048795, 23, 0, 1048796, 23, 0, 1048797, 23, 0, 1048798, 23, 0, 1048799, 23, 0, 1048800, 23, 0, 1048801, 23, 0, 1048802, 23, 0, 1048803, 23, 0, 1048804, 23, 0, 1048805, 23, 0, 1048806, 23, 0, 1048807, 23, 0, 1048808, 23, 0, 1048809, 23, 0, 1048810, 23, 0, 1048811, 23, 0, 1048812, 23, 0, 1048813, 23, 0, 1048814, 23, 0, 1048815, 23, 0, 1048816, 23, 0, 1048817, 23, 0, 1048818, 23, 0, 1048819, 23, 0, 1048820, 23, 0, 1048821, 23, 0, 1048822, 23, 0, 1048823, 23, 0, 1048824, 23, 0, 1048825, 23, 0, 1048826, 23, 0, 1048827, 23, 0, 1048828, 23, 0, 1048829, 23, 0, 1114140, 6, 0, 1114141, 7, 0, 1114142, 23, 0, 1114143, 10, 0, 1114144, 23, 0, 1114145, 10, 0, 1114146, 23, 0, 1114147, 10, 0, 1114148, 23, 0, 1114149, 10, 0, 1114150, 23, 0, 1114151, 10, 0, 1114152, 23, 0, 1114153, 8, 0, 1114158, 19, 0 ) + +[node name="light" parent="." instance=ExtResource( 1 )] +position = Vector2( 213, 172 ) +__meta__ = { +"_edit_group_": true, +"_edit_horizontal_guides_": [ ] +} + [node name="DeathZone" type="Area2D" parent="."] position = Vector2( 1, 328 ) script = SubResource( 5 ) @@ -102,3 +95,8 @@ __meta__ = { [node name="CollisionShape2D" type="CollisionShape2D" parent="DeathZone"] shape = SubResource( 4 ) + +[node name="Player" parent="." instance=ExtResource( 2 )] +position = Vector2( 73, 39 ) +max_jump_height = 64 +max_acceleration = 1500 diff --git a/Player.tscn b/Player.tscn new file mode 100644 index 0000000..e2ceaa0 --- /dev/null +++ b/Player.tscn @@ -0,0 +1,96 @@ +[gd_scene load_steps=7 format=2] + +[ext_resource path="res://platformer_controller/platformer_controller.gd" type="Script" id=1] +[ext_resource path="res://Giovanna.tres" type="SpriteFrames" id=2] +[ext_resource path="res://assets/sounds/salto1.wav" type="AudioStream" id=3] + +[sub_resource type="RectangleShape2D" id=4] +extents = Vector2( 7, 15 ) + +[sub_resource type="GDScript" id=14] +script/source = "extends Node2D + +onready var ded_timer = $DedTimer + +var health := 100.0 +var is_night := false +var in_light := false + +func _ready(): + print(\"In light: %s\" % in_light) + + +func _process(delta): + pass + if is_night: + if not in_light and ded_timer.is_stopped(): + ded_timer.start(0.4) + +func _on_LightCheck_entered(area): + in_light = true +# print(\"In light: %s\" % in_light) + + +func _on_LightCheck_exited(area): + in_light = false +# print(\"In light: %s\" % in_light) + + +func _on_cycle_started(i_n): + is_night = i_n + + +func _on_DedTimer_timeout(): + get_tree().reload_current_scene() +" + +[sub_resource type="RectangleShape2D" id=16] +extents = Vector2( 9, 15 ) + +[node name="PlatformerController2D" type="KinematicBody2D"] +script = ExtResource( 1 ) + +[node name="AnimatedSprite" type="AnimatedSprite" parent="."] +frames = ExtResource( 2 ) +animation = "air" + +[node name="CollisionShape2D" type="CollisionShape2D" parent="."] +shape = SubResource( 4 ) + +[node name="Jump_AudioStreamPlayer" type="AudioStreamPlayer" parent="."] +stream = ExtResource( 3 ) +volume_db = -28.614 + +[node name="Camera2D" type="Camera2D" parent="."] +offset = Vector2( 0, -48 ) +current = true +limit_left = -129 +limit_top = -217 +limit_right = 1123 +limit_bottom = 669 +limit_smoothed = true +smoothing_enabled = true +editor_draw_limits = true + +[node name="PlayerStatus" type="Node2D" parent="."] +script = SubResource( 14 ) +__meta__ = { +"_edit_group_": true +} + +[node name="LightCheck" type="Area2D" parent="PlayerStatus"] +collision_mask = 2 + +[node name="CollisionShape2D" type="CollisionShape2D" parent="PlayerStatus/LightCheck"] +shape = SubResource( 4 ) + +[node name="DedTimer" type="Timer" parent="PlayerStatus"] + +[node name="WallJump_Area2D" type="Area2D" parent="."] + +[node name="CollisionShape2D" type="CollisionShape2D" parent="WallJump_Area2D"] +shape = SubResource( 16 ) + +[connection signal="area_entered" from="PlayerStatus/LightCheck" to="PlayerStatus" method="_on_LightCheck_entered"] +[connection signal="area_exited" from="PlayerStatus/LightCheck" to="PlayerStatus" method="_on_LightCheck_exited"] +[connection signal="timeout" from="PlayerStatus/DedTimer" to="PlayerStatus" method="_on_DedTimer_timeout"] diff --git a/platformer_controller/platformer_controller.gd b/platformer_controller/platformer_controller.gd new file mode 100644 index 0000000..08f0763 --- /dev/null +++ b/platformer_controller/platformer_controller.gd @@ -0,0 +1,262 @@ +extends KinematicBody2D + +class_name PlatformerController2D + +# Set these to the name of your action (in the Input Map) +export var input_left : String = "left" +export var input_right : String = "right" +export var input_jump : String = "jump" + +# The max jump height in pixels (holding jump) +export var max_jump_height = 64 setget set_max_jump_height +# The minimum jump height (tapping jump) +export var min_jump_height = 40 setget set_min_jump_height +# The height of your jump in the air +export var double_jump_height = 100 setget set_double_jump_height +# How long it takes to get to the peak of the jump in seconds +export var jump_duration = 0.3 setget set_jump_duration +# Multiplies the gravity by this while falling +export var falling_gravity_multiplier = 1.3 +# Set to 2 for double jump +export var max_jump_amount = 1 +export var max_acceleration = 1500 +export var friction = 8 +export var can_hold_jump : bool = false +# You can still jump this many seconds after falling off a ledge +export var coyote_time : float = 0.1 +# Only neccessary when can_hold_jump is off +# Pressing jump this many seconds before hitting the ground will still make you jump +export var jump_buffer : float = 0.1 + + +# Nodes +onready var jump_asp = $Jump_AudioStreamPlayer +onready var walljump_area2d = $WallJump_Area2D +onready var camera: Camera2D = $Camera2D +onready var bg: Node2D = $BG + + +# not used +var max_speed = 100 +var acceleration_time = 10 + + +# These will be calcualted automatically +var default_gravity : float +var jump_velocity : float +var double_jump_velocity : float +# Multiplies the gravity by this when we release jump +var release_gravity_multiplier : float + + +var jumps_left : int +var holding_jump := false + +var vel = Vector2() +var acc = Vector2() + +onready var coyote_timer = Timer.new() +onready var jump_buffer_timer = Timer.new() +onready var wall_jump_mouse_disable_timer = Timer.new() + +var last_wall_normal: Vector2 = Vector2.ZERO + + +func _init(): + default_gravity = calculate_gravity(max_jump_height, jump_duration) + jump_velocity = calculate_jump_velocity(max_jump_height, jump_duration) + double_jump_velocity = calculate_jump_velocity2(double_jump_height, default_gravity) + release_gravity_multiplier = calculate_release_gravity_multiplier( + jump_velocity, min_jump_height, default_gravity) + + +func _ready(): + add_child(coyote_timer) + coyote_timer.wait_time = coyote_time + coyote_timer.one_shot = true + + add_child(jump_buffer_timer) + jump_buffer_timer.wait_time = jump_buffer + jump_buffer_timer.one_shot = true + + add_child(wall_jump_mouse_disable_timer) + wall_jump_mouse_disable_timer.wait_time = 0.1 + wall_jump_mouse_disable_timer.one_shot = true + + owner.set_meta("player", self) + + +func _physics_process(delta): + acc.x = 0 + + if Input.is_action_pressed("right"): + $AnimatedSprite.play("walk") + $AnimatedSprite.flip_h = true + elif Input.is_action_pressed("left"): + $AnimatedSprite.play("walk") + $AnimatedSprite.flip_h = false + else: + $AnimatedSprite.play("idle") + + if not is_on_floor(): + $AnimatedSprite.play("air") + + if is_on_floor(): + coyote_timer.start() + if is_on_wall(): + coyote_timer.start() + vel.x = 0 + if not coyote_timer.is_stopped(): + jumps_left = max_jump_amount + + + if wall_jump_mouse_disable_timer.is_stopped() or is_on_wall(): + if Input.is_action_pressed(input_left): + acc.x = -max_acceleration + if Input.is_action_pressed(input_right): + acc.x = max_acceleration + else: + if not is_on_wall() and not is_on_floor(): + if Input.is_action_pressed(input_left) or Input.is_action_pressed(input_right): + acc.x = last_wall_normal.x * max_acceleration + + + # Check for ground jumps when we can hold jump + if can_hold_jump: + if Input.is_action_pressed(input_jump): + # Dont use double jump when holding down + if is_on_floor(): + jump() + + # Check for ground jumps when we cannot hold jump + if not can_hold_jump: + if not jump_buffer_timer.is_stopped() and is_on_floor(): + jump() + + # Check for jumps in the air + if Input.is_action_just_pressed(input_jump): + holding_jump = true + jump_buffer_timer.start() + + # Only jump in the air when press the button down, code above already jumps when we are grounded + if not is_on_floor(): + jump() + + + if Input.is_action_just_released(input_jump): + holding_jump = false + + + var gravity = default_gravity + + if vel.y > 0: # If we are falling + gravity *= falling_gravity_multiplier + + if not holding_jump and vel.y < 0: # if we released jump and are still rising + if not jumps_left < max_jump_amount - 1: # Always jump to max height when we are using a double jump + gravity *= release_gravity_multiplier # multiply the gravity so we have a lower jump + + if is_on_wall() and vel.y > 0: + acc.y = -gravity/5 + vel.y = clamp(vel.y, 0, 500) + else: + acc.y = -gravity + vel.x *= 1 / (1 + (delta * friction)) + + # Wall jump off wall + if Input.is_action_just_pressed("jump") and is_on_wall() and not is_on_floor(): + var zero_collision = get_slide_collision(0) + if zero_collision: + last_wall_normal = zero_collision.normal + vel.x += zero_collision.normal.x * 250 + wall_jump_mouse_disable_timer.start() + + vel += acc * delta + + vel = move_and_slide(vel, Vector2.UP) + + +func jump(): + if jumps_left == max_jump_amount and coyote_timer.is_stopped(): + # Your first jump must be used when on the ground + # If you fall off the ground and then jump you will be using you second jump + jumps_left -= 1 + + if jumps_left > 0: + if jumps_left < max_jump_amount: # If we are double jumping + vel.y = -double_jump_velocity + else: + vel.y = -jump_velocity + jumps_left -= 1 + jump_asp.play() + + coyote_timer.stop() + + +func calculate_gravity(p_max_jump_height, p_jump_duration): + # Calculates the desired gravity by looking at our jump height and jump duration + # Formula is from this video https://www.youtube.com/watch?v=hG9SzQxaCm8 + return (-2 *p_max_jump_height) / pow(p_jump_duration, 2) + + +func calculate_jump_velocity(p_max_jump_height, p_jump_duration): + # Calculates the desired jump velocity by lookihg at our jump height and jump duration + return (2 * p_max_jump_height) / (p_jump_duration) + + +func calculate_jump_velocity2(p_max_jump_height, p_gravity): + # Calculates jump velocity from jump height and gravity + # formula from + # https://sciencing.com/acceleration-velocity-distance-7779124.html#:~:text=in%20every%20step.-,Starting%20from%3A,-v%5E2%3Du + return sqrt(-2 * p_gravity * p_max_jump_height) + + +func calculate_release_gravity_multiplier(p_jump_velocity, p_min_jump_height, p_gravity): + # Calculates the gravity when the key is released based on the minimum jump height and jump velocity + # Formula is from this website https://sciencing.com/acceleration-velocity-distance-7779124.html + var release_gravity = 0 - pow(p_jump_velocity, 2) / (2 * p_min_jump_height) + return release_gravity / p_gravity + + +func calculate_friction(time_to_max): + # Formula from https://www.reddit.com/r/gamedev/comments/bdbery/comment/ekxw9g4/?utm_source=share&utm_medium=web2x&context=3 + # this friction will hit 90% of max speed after the accel time + return 1 - (2.30259 / time_to_max) + + +func calculate_speed(p_max_speed, p_friction): + # Formula from https://www.reddit.com/r/gamedev/comments/bdbery/comment/ekxw9g4/?utm_source=share&utm_medium=web2x&context=3 + return (p_max_speed / p_friction) - p_max_speed + + +func set_max_jump_height(value): + max_jump_height = value + + default_gravity = calculate_gravity(max_jump_height, jump_duration) + jump_velocity = calculate_jump_velocity(max_jump_height, jump_duration) + double_jump_velocity = calculate_jump_velocity2(double_jump_height, default_gravity) + release_gravity_multiplier = calculate_release_gravity_multiplier( + jump_velocity, min_jump_height, default_gravity) + + +func set_jump_duration(value): + jump_duration = value + + default_gravity = calculate_gravity(max_jump_height, jump_duration) + jump_velocity = calculate_jump_velocity(max_jump_height, jump_duration) + double_jump_velocity = calculate_jump_velocity2(double_jump_height, default_gravity) + release_gravity_multiplier = calculate_release_gravity_multiplier( + jump_velocity, min_jump_height, default_gravity) + + +func set_min_jump_height(value): + min_jump_height = value + release_gravity_multiplier = calculate_release_gravity_multiplier( + jump_velocity, min_jump_height, default_gravity) + + +func set_double_jump_height(value): + double_jump_height = value + double_jump_velocity = calculate_jump_velocity2(double_jump_height, default_gravity) + + diff --git a/project.godot b/project.godot index eff4267..bc56e18 100644 --- a/project.godot +++ b/project.godot @@ -18,10 +18,16 @@ _global_script_classes=[ { "class": "Giovanna", "language": "GDScript", "path": "res://Giovanna.gd" +}, { +"base": "KinematicBody2D", +"class": "PlatformerController2D", +"language": "GDScript", +"path": "res://platformer_controller/platformer_controller.gd" } ] _global_script_class_icons={ "Enemy": "", -"Giovanna": "" +"Giovanna": "", +"PlatformerController2D": "" } [application] @@ -34,7 +40,6 @@ config/icon="res://icon.png" window/size/width=480 window/size/height=270 -window/size/resizable=false window/size/test_width=960 window/size/test_height=540 window/stretch/mode="viewport"