From d02d369c13e776ebe4ef03f879210406e8aec9d8 Mon Sep 17 00:00:00 2001 From: D L Date: Fri, 27 Jan 2023 17:56:15 -0800 Subject: [PATCH] hold x midair for tricks --- Scenes/DownhillAutoscroller.tscn | 4 +- Scripts/Constants.gd | 4 ++ Scripts/GameScene.gd | 2 + Scripts/StageEnvironment.gd | 2 + Scripts/Unit.gd | 4 ++ Scripts/Units/DownhillAutoscrollerPlayer.gd | 54 +++++++++++++++++++-- Scripts/Units/Player.gd | 4 ++ 7 files changed, 69 insertions(+), 5 deletions(-) diff --git a/Scenes/DownhillAutoscroller.tscn b/Scenes/DownhillAutoscroller.tscn index ce50d6f..0b4a6e3 100644 --- a/Scenes/DownhillAutoscroller.tscn +++ b/Scenes/DownhillAutoscroller.tscn @@ -12,14 +12,14 @@ __meta__ = { tile_set_name = "TestTileSet" camera_h_offset = 2.5 spawning = { -Vector2( 48, -9 ): "NPC" +Vector2( 1, 1 ): "NPC" } [node name="Stage" type="TileMap" parent="."] tile_set = ExtResource( 1 ) cell_size = Vector2( 20, 20 ) format = 1 -tile_data = PoolIntArray( -196611, 4, 0, -196610, 4, 0, -196609, 5, 0, -131075, 4, 0, -131074, 4, 0, -131073, 5, 0, -65539, 4, 0, -65538, 4, 0, -65537, 5, 0, -3, 4, 0, -2, 4, 0, -1, 5, 0, 65533, 4, 0, 65534, 4, 0, 65535, 4, 0, 0, 1, 0, 1, 1, 0, 2, 1, 0, 3, 1, 0, 4, 1, 0, 5, 1, 0, 6, 13, 0, 7, 12, 0, 131069, 4, 0, 131070, 4, 0, 131071, 4, 0, 65536, 4, 0, 65537, 4, 0, 65538, 4, 0, 65539, 4, 0, 65540, 4, 0, 65541, 4, 0, 65542, 4, 0, 65543, 4, 0, 65544, 18, 0, 196605, 4, 0, 196606, 4, 0, 196607, 4, 0, 131072, 4, 0, 131073, 4, 0, 131074, 4, 0, 131075, 4, 0, 131076, 4, 0, 131077, 4, 0, 131078, 4, 0, 131079, 4, 0, 131080, 4, 0, 131081, 18, 0, 262141, 4, 0, 262142, 4, 0, 262143, 4, 0, 196608, 4, 0, 196609, 4, 0, 196610, 4, 0, 196611, 4, 0, 196612, 4, 0, 196613, 4, 0, 196614, 4, 0, 196615, 4, 0, 196616, 4, 0, 196617, 4, 0, 196618, 18, 0, 327677, 4, 0, 327678, 4, 0, 327679, 4, 0, 262144, 4, 0, 262145, 4, 0, 262146, 4, 0, 262147, 4, 0, 262148, 4, 0, 262149, 4, 0, 262150, 4, 0, 262151, 4, 0, 262152, 4, 0, 262153, 4, 0, 262154, 4, 0, 262155, 13, 0, 262156, 12, 0, 393213, 4, 0, 393214, 4, 0, 393215, 4, 0, 327680, 4, 0, 327681, 4, 0, 327682, 4, 0, 327683, 4, 0, 327684, 4, 0, 327685, 4, 0, 327686, 4, 0, 327687, 4, 0, 327688, 4, 0, 327689, 4, 0, 327690, 4, 0, 327691, 4, 0, 327692, 4, 0, 327693, 2, 0, 458749, 4, 0, 458750, 4, 0, 458751, 4, 0, 393216, 4, 0, 393217, 4, 0, 393218, 4, 0, 393219, 4, 0, 393220, 4, 0, 393221, 4, 0, 393222, 4, 0, 393223, 4, 0, 393224, 4, 0, 393225, 4, 0, 393226, 4, 0, 393227, 4, 0, 393228, 4, 0, 393229, 5, 0, 393236, 9, 0, 393237, 10, 0, 393238, 13, 0, 393239, 12, 0, 524285, 4, 0, 524286, 4, 0, 524287, 4, 0, 458752, 4, 0, 458753, 4, 0, 458754, 4, 0, 458755, 4, 0, 458756, 4, 0, 458757, 4, 0, 458758, 4, 0, 458759, 4, 0, 458760, 4, 0, 458761, 4, 0, 458762, 4, 0, 458763, 4, 0, 458764, 4, 0, 458765, 4, 0, 458766, 1, 0, 458767, 1, 0, 458768, 1, 0, 458769, 1, 0, 458770, 1, 0, 458771, 1, 0, 458772, 4, 0, 458773, 4, 0, 458774, 4, 0, 458775, 4, 0, 458776, 13, 0, 458777, 12, 0, 524296, 4, 0, 524297, 4, 0, 524298, 4, 0, 524299, 4, 0, 524300, 4, 0, 524301, 4, 0, 524302, 4, 0, 524303, 4, 0, 524304, 4, 0, 524305, 4, 0, 524306, 4, 0, 524307, 4, 0, 524308, 4, 0, 524309, 4, 0, 524310, 4, 0, 524311, 4, 0, 524312, 4, 0, 524313, 4, 0, 524314, 18, 0, 589833, 4, 0, 589834, 4, 0, 589835, 4, 0, 589836, 4, 0, 589837, 4, 0, 589838, 4, 0, 589839, 4, 0, 589840, 4, 0, 589841, 4, 0, 589842, 4, 0, 589843, 4, 0, 589844, 4, 0, 589845, 4, 0, 589846, 4, 0, 589847, 4, 0, 589848, 4, 0, 589849, 4, 0, 589850, 4, 0, 589851, 18, 0, 655370, 4, 0, 655371, 4, 0, 655372, 4, 0, 655373, 4, 0, 655374, 4, 0, 655375, 4, 0, 655376, 4, 0, 655377, 4, 0, 655378, 4, 0, 655379, 4, 0, 655380, 4, 0, 655381, 4, 0, 655382, 4, 0, 655383, 4, 0, 655384, 4, 0, 655385, 4, 0, 655386, 4, 0, 655387, 4, 0, 655388, 18, 0, 720908, 4, 0, 720909, 4, 0, 720910, 4, 0, 720911, 4, 0, 720912, 4, 0, 720913, 4, 0, 720914, 4, 0, 720915, 4, 0, 720916, 4, 0, 720917, 4, 0, 720918, 4, 0, 720919, 4, 0, 720920, 4, 0, 720921, 4, 0, 720922, 4, 0, 720923, 4, 0, 720924, 4, 0, 720925, 18, 0, 720937, 0, 0, 720938, 1, 0, 720939, 1, 0, 720940, 1, 0, 720941, 1, 0, 720942, 1, 0, 720943, 1, 0, 720944, 1, 0, 720945, 1, 0, 720946, 1, 0, 720947, 1, 0, 720948, 1, 0, 720949, 1, 0, 720950, 1, 0, 720951, 1, 0, 720952, 1, 0, 720953, 1, 0, 720954, 1, 0, 786445, 4, 0, 786446, 4, 0, 786447, 4, 0, 786448, 4, 0, 786449, 4, 0, 786450, 4, 0, 786451, 4, 0, 786452, 4, 0, 786453, 4, 0, 786454, 4, 0, 786455, 4, 0, 786456, 4, 0, 786457, 4, 0, 786458, 4, 0, 786459, 4, 0, 786460, 4, 0, 786461, 4, 0, 786462, 18, 0, 786468, 16, 0, 786473, 3, 0, 786474, 4, 0, 786475, 4, 0, 786476, 4, 0, 786477, 4, 0, 786478, 4, 0, 786479, 4, 0, 786480, 4, 0, 786481, 4, 0, 786482, 4, 0, 786483, 4, 0, 786484, 4, 0, 786485, 4, 0, 786486, 4, 0, 786487, 4, 0, 786488, 4, 0, 786489, 4, 0, 786490, 4, 0, 851982, 4, 0, 851983, 4, 0, 851984, 4, 0, 851985, 4, 0, 851986, 4, 0, 851987, 4, 0, 851988, 4, 0, 851989, 4, 0, 851990, 4, 0, 851991, 4, 0, 851992, 4, 0, 851993, 4, 0, 851994, 4, 0, 851995, 4, 0, 851996, 4, 0, 851997, 4, 0, 851998, 4, 0, 851999, 13, 0, 852000, 12, 0, 852002, 9, 0, 852003, 10, 0, 852004, 5, 0, 852009, 3, 0, 852010, 4, 0, 852011, 4, 0, 852012, 4, 0, 852013, 4, 0, 852014, 4, 0, 852015, 4, 0, 852016, 4, 0, 852017, 4, 0, 852018, 4, 0, 852019, 4, 0, 852020, 4, 0, 852021, 4, 0, 852022, 4, 0, 852023, 4, 0, 852024, 4, 0, 852025, 4, 0, 852026, 4, 0, 917519, 4, 0, 917520, 4, 0, 917521, 4, 0, 917522, 4, 0, 917523, 4, 0, 917524, 4, 0, 917525, 4, 0, 917526, 4, 0, 917527, 4, 0, 917528, 4, 0, 917529, 4, 0, 917530, 4, 0, 917531, 4, 0, 917532, 4, 0, 917533, 4, 0, 917534, 4, 0, 917535, 4, 0, 917536, 4, 0, 917537, 1, 0, 917538, 4, 0, 917539, 4, 0, 917540, 5, 0, 917545, 3, 0, 917546, 4, 0, 917547, 4, 0, 917548, 4, 0, 917549, 4, 0, 917550, 4, 0, 917551, 4, 0, 917552, 4, 0, 917553, 4, 0, 917554, 4, 0, 917555, 4, 0, 917556, 4, 0, 917557, 4, 0, 917558, 4, 0, 917559, 4, 0, 917560, 4, 0, 917561, 4, 0, 917562, 4, 0, 983061, 4, 0, 983062, 4, 0, 983063, 4, 0, 983064, 4, 0, 983065, 4, 0, 983066, 4, 0, 983067, 4, 0, 983068, 4, 0, 983069, 4, 0, 983070, 4, 0, 983071, 4, 0, 983072, 4, 0, 983073, 4, 0, 983074, 4, 0, 983075, 4, 0, 983076, 5, 0, 983081, 3, 0, 983082, 4, 0, 983083, 4, 0, 983084, 4, 0, 983085, 4, 0, 983086, 4, 0, 983087, 4, 0, 983088, 4, 0, 983089, 4, 0, 983090, 4, 0, 983091, 4, 0, 983092, 4, 0, 983093, 4, 0, 983094, 4, 0, 983095, 4, 0, 983096, 4, 0, 983097, 4, 0, 983098, 4, 0, 1048599, 4, 0, 1048600, 4, 0, 1048601, 4, 0, 1048602, 4, 0, 1048603, 4, 0, 1048604, 4, 0, 1048605, 4, 0, 1048606, 4, 0, 1048607, 4, 0, 1048608, 4, 0, 1048609, 4, 0, 1048610, 4, 0, 1048611, 4, 0, 1048612, 5, 0, 1048617, 3, 0, 1048618, 4, 0, 1048619, 4, 0, 1048620, 4, 0, 1048621, 4, 0, 1048622, 4, 0, 1048623, 4, 0, 1048624, 4, 0, 1048625, 4, 0, 1048626, 4, 0, 1048627, 4, 0, 1048628, 4, 0, 1048629, 4, 0, 1048630, 4, 0, 1048631, 4, 0, 1048632, 4, 0, 1048633, 4, 0, 1048634, 4, 0, 1114136, 4, 0, 1114137, 4, 0, 1114138, 4, 0, 1114139, 4, 0, 1114140, 4, 0, 1114141, 4, 0, 1114142, 4, 0, 1114143, 4, 0, 1114144, 4, 0, 1114145, 4, 0, 1114146, 4, 0, 1114147, 4, 0, 1114148, 5, 0, 1114153, 3, 0, 1114154, 4, 0, 1114155, 4, 0, 1114156, 4, 0, 1114157, 4, 0, 1114158, 4, 0, 1114159, 4, 0, 1114160, 4, 0, 1114161, 4, 0, 1114162, 4, 0, 1114163, 4, 0, 1114164, 4, 0, 1114165, 4, 0, 1114166, 4, 0, 1114167, 4, 0, 1114168, 4, 0, 1114169, 4, 0, 1114170, 4, 0, 1179675, 4, 0, 1179676, 4, 0, 1179677, 4, 0, 1179678, 4, 0, 1179679, 4, 0, 1179680, 4, 0, 1179681, 4, 0, 1179682, 4, 0, 1179683, 4, 0, 1179684, 5, 0, 1245214, 4, 0, 1245215, 4, 0, 1245216, 4, 0, 1245217, 4, 0, 1245218, 4, 0, 1245219, 4, 0, 1245220, 5, 0 ) +tile_data = PoolIntArray( -196611, 4, 0, -196610, 4, 0, -196609, 5, 0, -131075, 4, 0, -131074, 4, 0, -131073, 5, 0, -65539, 4, 0, -65538, 4, 0, -65537, 5, 0, -3, 4, 0, -2, 4, 0, -1, 5, 0, 65533, 4, 0, 65534, 4, 0, 65535, 4, 0, 0, 1, 0, 1, 1, 0, 2, 1, 0, 3, 1, 0, 4, 1, 0, 5, 1, 0, 6, 13, 0, 7, 12, 0, 131069, 4, 0, 131070, 4, 0, 131071, 4, 0, 65536, 4, 0, 65537, 4, 0, 65538, 4, 0, 65539, 4, 0, 65540, 4, 0, 65541, 4, 0, 65542, 4, 0, 65543, 4, 0, 65544, 18, 0, 196605, 4, 0, 196606, 4, 0, 196607, 4, 0, 131072, 4, 0, 131073, 4, 0, 131074, 4, 0, 131075, 4, 0, 131076, 4, 0, 131077, 4, 0, 131078, 4, 0, 131079, 4, 0, 131080, 4, 0, 131081, 18, 0, 262141, 4, 0, 262142, 4, 0, 262143, 4, 0, 196608, 4, 0, 196609, 4, 0, 196610, 4, 0, 196611, 4, 0, 196612, 4, 0, 196613, 4, 0, 196614, 4, 0, 196615, 4, 0, 196616, 4, 0, 196617, 4, 0, 196618, 18, 0, 327677, 4, 0, 327678, 4, 0, 327679, 4, 0, 262144, 4, 0, 262145, 4, 0, 262146, 4, 0, 262147, 4, 0, 262148, 4, 0, 262149, 4, 0, 262150, 4, 0, 262151, 4, 0, 262152, 4, 0, 262153, 4, 0, 262154, 4, 0, 262155, 13, 0, 262156, 12, 0, 393213, 4, 0, 393214, 4, 0, 393215, 4, 0, 327680, 4, 0, 327681, 4, 0, 327682, 4, 0, 327683, 4, 0, 327684, 4, 0, 327685, 4, 0, 327686, 4, 0, 327687, 4, 0, 327688, 4, 0, 327689, 4, 0, 327690, 4, 0, 327691, 4, 0, 327692, 4, 0, 327693, 2, 0, 458749, 4, 0, 458750, 4, 0, 458751, 4, 0, 393216, 4, 0, 393217, 4, 0, 393218, 4, 0, 393219, 4, 0, 393220, 4, 0, 393221, 4, 0, 393222, 4, 0, 393223, 4, 0, 393224, 4, 0, 393225, 4, 0, 393226, 4, 0, 393227, 4, 0, 393228, 4, 0, 393229, 5, 0, 393236, 9, 0, 393237, 10, 0, 393238, 13, 0, 393239, 12, 0, 524285, 4, 0, 524286, 4, 0, 524287, 4, 0, 458752, 4, 0, 458753, 4, 0, 458754, 4, 0, 458755, 4, 0, 458756, 4, 0, 458757, 4, 0, 458758, 4, 0, 458759, 4, 0, 458760, 4, 0, 458761, 4, 0, 458762, 4, 0, 458763, 4, 0, 458764, 4, 0, 458765, 4, 0, 458766, 1, 0, 458767, 1, 0, 458768, 1, 0, 458769, 1, 0, 458770, 1, 0, 458771, 1, 0, 458772, 4, 0, 458773, 4, 0, 458774, 4, 0, 458775, 4, 0, 458776, 13, 0, 458777, 12, 0, 524296, 4, 0, 524297, 4, 0, 524298, 4, 0, 524299, 4, 0, 524300, 4, 0, 524301, 4, 0, 524302, 4, 0, 524303, 4, 0, 524304, 4, 0, 524305, 4, 0, 524306, 4, 0, 524307, 4, 0, 524308, 4, 0, 524309, 4, 0, 524310, 4, 0, 524311, 4, 0, 524312, 4, 0, 524313, 4, 0, 524314, 18, 0, 589833, 4, 0, 589834, 4, 0, 589835, 4, 0, 589836, 4, 0, 589837, 4, 0, 589838, 4, 0, 589839, 4, 0, 589840, 4, 0, 589841, 4, 0, 589842, 4, 0, 589843, 4, 0, 589844, 4, 0, 589845, 4, 0, 589846, 4, 0, 589847, 4, 0, 589848, 4, 0, 589849, 4, 0, 589850, 4, 0, 589851, 18, 0, 655370, 4, 0, 655371, 4, 0, 655372, 4, 0, 655373, 4, 0, 655374, 4, 0, 655375, 4, 0, 655376, 4, 0, 655377, 4, 0, 655378, 4, 0, 655379, 4, 0, 655380, 4, 0, 655381, 4, 0, 655382, 4, 0, 655383, 4, 0, 655384, 4, 0, 655385, 4, 0, 655386, 4, 0, 655387, 4, 0, 655388, 18, 0, 720908, 4, 0, 720909, 4, 0, 720910, 4, 0, 720911, 4, 0, 720912, 4, 0, 720913, 4, 0, 720914, 4, 0, 720915, 4, 0, 720916, 4, 0, 720917, 4, 0, 720918, 4, 0, 720919, 4, 0, 720920, 4, 0, 720921, 4, 0, 720922, 4, 0, 720923, 4, 0, 720924, 4, 0, 720925, 18, 0, 720937, 0, 0, 720938, 1, 0, 720939, 1, 0, 720940, 1, 0, 720941, 1, 0, 720942, 1, 0, 720943, 1, 0, 720944, 1, 0, 720945, 1, 0, 720946, 1, 0, 720947, 1, 0, 720948, 1, 0, 720949, 1, 0, 720950, 1, 0, 720951, 1, 0, 720952, 1, 0, 720953, 1, 0, 720954, 1, 0, 720955, 1, 0, 720956, 1, 0, 720957, 1, 0, 720958, 1, 0, 720959, 1, 0, 720960, 1, 0, 720961, 1, 0, 720962, 1, 0, 720963, 1, 0, 720964, 1, 0, 720965, 1, 0, 720966, 1, 0, 720967, 1, 0, 720968, 1, 0, 720969, 1, 0, 720970, 1, 0, 720971, 1, 0, 786445, 4, 0, 786446, 4, 0, 786447, 4, 0, 786448, 4, 0, 786449, 4, 0, 786450, 4, 0, 786451, 4, 0, 786452, 4, 0, 786453, 4, 0, 786454, 4, 0, 786455, 4, 0, 786456, 4, 0, 786457, 4, 0, 786458, 4, 0, 786459, 4, 0, 786460, 4, 0, 786461, 4, 0, 786462, 18, 0, 786468, 16, 0, 786473, 3, 0, 786474, 4, 0, 786475, 4, 0, 786476, 4, 0, 786477, 4, 0, 786478, 4, 0, 786479, 4, 0, 786480, 4, 0, 786481, 4, 0, 786482, 4, 0, 786483, 4, 0, 786484, 4, 0, 786485, 4, 0, 786486, 4, 0, 786487, 4, 0, 786488, 4, 0, 786489, 4, 0, 786490, 4, 0, 786491, 4, 0, 786492, 4, 0, 786493, 4, 0, 786494, 4, 0, 786495, 4, 0, 786496, 4, 0, 786497, 4, 0, 786498, 4, 0, 786499, 4, 0, 786500, 4, 0, 786501, 4, 0, 786502, 4, 0, 786503, 4, 0, 786504, 4, 0, 786505, 4, 0, 786506, 4, 0, 786507, 4, 0, 851982, 4, 0, 851983, 4, 0, 851984, 4, 0, 851985, 4, 0, 851986, 4, 0, 851987, 4, 0, 851988, 4, 0, 851989, 4, 0, 851990, 4, 0, 851991, 4, 0, 851992, 4, 0, 851993, 4, 0, 851994, 4, 0, 851995, 4, 0, 851996, 4, 0, 851997, 4, 0, 851998, 4, 0, 851999, 13, 0, 852000, 12, 0, 852002, 9, 0, 852003, 10, 0, 852004, 5, 0, 852009, 3, 0, 852010, 4, 0, 852011, 4, 0, 852012, 4, 0, 852013, 4, 0, 852014, 4, 0, 852015, 4, 0, 852016, 4, 0, 852017, 4, 0, 852018, 4, 0, 852019, 4, 0, 852020, 4, 0, 852021, 4, 0, 852022, 4, 0, 852023, 4, 0, 852024, 4, 0, 852025, 4, 0, 852026, 4, 0, 852027, 4, 0, 852028, 4, 0, 852029, 4, 0, 852030, 4, 0, 852031, 4, 0, 852032, 4, 0, 852033, 4, 0, 852034, 4, 0, 852035, 4, 0, 852036, 4, 0, 852037, 4, 0, 852038, 4, 0, 852039, 4, 0, 852040, 4, 0, 852041, 4, 0, 852042, 4, 0, 852043, 4, 0, 917519, 4, 0, 917520, 4, 0, 917521, 4, 0, 917522, 4, 0, 917523, 4, 0, 917524, 4, 0, 917525, 4, 0, 917526, 4, 0, 917527, 4, 0, 917528, 4, 0, 917529, 4, 0, 917530, 4, 0, 917531, 4, 0, 917532, 4, 0, 917533, 4, 0, 917534, 4, 0, 917535, 4, 0, 917536, 4, 0, 917537, 1, 0, 917538, 4, 0, 917539, 4, 0, 917540, 5, 0, 917545, 3, 0, 917546, 4, 0, 917547, 4, 0, 917548, 4, 0, 917549, 4, 0, 917550, 4, 0, 917551, 4, 0, 917552, 4, 0, 917553, 4, 0, 917554, 4, 0, 917555, 4, 0, 917556, 4, 0, 917557, 4, 0, 917558, 4, 0, 917559, 4, 0, 917560, 4, 0, 917561, 4, 0, 917562, 4, 0, 917563, 4, 0, 917564, 4, 0, 917565, 4, 0, 917566, 4, 0, 917567, 4, 0, 917568, 4, 0, 917569, 4, 0, 917570, 4, 0, 917571, 4, 0, 917572, 4, 0, 917573, 4, 0, 917574, 4, 0, 917575, 4, 0, 917576, 4, 0, 917577, 4, 0, 917578, 4, 0, 917579, 4, 0, 983061, 4, 0, 983062, 4, 0, 983063, 4, 0, 983064, 4, 0, 983065, 4, 0, 983066, 4, 0, 983067, 4, 0, 983068, 4, 0, 983069, 4, 0, 983070, 4, 0, 983071, 4, 0, 983072, 4, 0, 983073, 4, 0, 983074, 4, 0, 983075, 4, 0, 983076, 5, 0, 983081, 3, 0, 983082, 4, 0, 983083, 4, 0, 983084, 4, 0, 983085, 4, 0, 983086, 4, 0, 983087, 4, 0, 983088, 4, 0, 983089, 4, 0, 983090, 4, 0, 983091, 4, 0, 983092, 4, 0, 983093, 4, 0, 983094, 4, 0, 983095, 4, 0, 983096, 4, 0, 983097, 4, 0, 983098, 4, 0, 983099, 4, 0, 983100, 4, 0, 983101, 4, 0, 983102, 4, 0, 983103, 4, 0, 983104, 4, 0, 983105, 4, 0, 983106, 4, 0, 983107, 4, 0, 983108, 4, 0, 983109, 4, 0, 983110, 4, 0, 983111, 4, 0, 983112, 4, 0, 983113, 4, 0, 983114, 4, 0, 983115, 4, 0, 1048599, 4, 0, 1048600, 4, 0, 1048601, 4, 0, 1048602, 4, 0, 1048603, 4, 0, 1048604, 4, 0, 1048605, 4, 0, 1048606, 4, 0, 1048607, 4, 0, 1048608, 4, 0, 1048609, 4, 0, 1048610, 4, 0, 1048611, 4, 0, 1048612, 5, 0, 1048617, 3, 0, 1048618, 4, 0, 1048619, 4, 0, 1048620, 4, 0, 1048621, 4, 0, 1048622, 4, 0, 1048623, 4, 0, 1048624, 4, 0, 1048625, 4, 0, 1048626, 4, 0, 1048627, 4, 0, 1048628, 4, 0, 1048629, 4, 0, 1048630, 4, 0, 1048631, 4, 0, 1048632, 4, 0, 1048633, 4, 0, 1048634, 4, 0, 1048635, 4, 0, 1048636, 4, 0, 1048637, 4, 0, 1048638, 4, 0, 1048639, 4, 0, 1048640, 4, 0, 1048641, 4, 0, 1048642, 4, 0, 1048643, 4, 0, 1048644, 4, 0, 1048645, 4, 0, 1048646, 4, 0, 1048647, 4, 0, 1048648, 4, 0, 1048649, 4, 0, 1048650, 4, 0, 1048651, 4, 0, 1114136, 4, 0, 1114137, 4, 0, 1114138, 4, 0, 1114139, 4, 0, 1114140, 4, 0, 1114141, 4, 0, 1114142, 4, 0, 1114143, 4, 0, 1114144, 4, 0, 1114145, 4, 0, 1114146, 4, 0, 1114147, 4, 0, 1114148, 5, 0, 1114153, 3, 0, 1114154, 4, 0, 1114155, 4, 0, 1114156, 4, 0, 1114157, 4, 0, 1114158, 4, 0, 1114159, 4, 0, 1114160, 4, 0, 1114161, 4, 0, 1114162, 4, 0, 1114163, 4, 0, 1114164, 4, 0, 1114165, 4, 0, 1114166, 4, 0, 1114167, 4, 0, 1114168, 4, 0, 1114169, 4, 0, 1114170, 4, 0, 1114171, 4, 0, 1114172, 4, 0, 1114173, 4, 0, 1114174, 4, 0, 1114175, 4, 0, 1114176, 4, 0, 1114177, 4, 0, 1114178, 4, 0, 1114179, 4, 0, 1114180, 4, 0, 1114181, 4, 0, 1114182, 4, 0, 1114183, 4, 0, 1114184, 4, 0, 1114185, 4, 0, 1114186, 4, 0, 1114187, 4, 0, 1179675, 4, 0, 1179676, 4, 0, 1179677, 4, 0, 1179678, 4, 0, 1179679, 4, 0, 1179680, 4, 0, 1179681, 4, 0, 1179682, 4, 0, 1179683, 4, 0, 1179684, 5, 0, 1245214, 4, 0, 1245215, 4, 0, 1245216, 4, 0, 1245217, 4, 0, 1245218, 4, 0, 1245219, 4, 0, 1245220, 5, 0 ) [node name="Player" parent="." instance=ExtResource( 2 )] position = Vector2( 10, -150 ) diff --git a/Scripts/Constants.gd b/Scripts/Constants.gd index d8562d9..9785e14 100644 --- a/Scripts/Constants.gd +++ b/Scripts/Constants.gd @@ -7,6 +7,7 @@ enum ActionType { JUMP, MOVE, RECOIL, + SPIN, } enum UnitCondition { @@ -20,6 +21,7 @@ enum UnitCurrentAction { IDLE, JUMPING, RECOILING, + SPINNING, } enum UnitMovingStatus { @@ -68,6 +70,7 @@ const UNIT_TYPE_ACTIONS = { ActionType.JUMP, ActionType.MOVE, ActionType.RECOIL, + ActionType.SPIN, ], UnitType.NPC: [ ActionType.MOVE, @@ -79,6 +82,7 @@ const UNIT_TYPE_CURRENT_ACTIONS = { UnitCurrentAction.IDLE, UnitCurrentAction.JUMPING, UnitCurrentAction.RECOILING, + UnitCurrentAction.SPINNING, ], UnitType.NPC: [ UnitCurrentAction.IDLE, diff --git a/Scripts/GameScene.gd b/Scripts/GameScene.gd index 4173779..6ec7b21 100644 --- a/Scripts/GameScene.gd +++ b/Scripts/GameScene.gd @@ -162,3 +162,5 @@ func handle_player_input(): and player.unit_conditions[Constants.UnitCondition.IS_ON_GROUND] and input_table[Constants.PlayerInput.GBA_A][I_T_JUST_PRESSED])): player.set_action(Constants.ActionType.JUMP) + + player.custom_inputs() diff --git a/Scripts/StageEnvironment.gd b/Scripts/StageEnvironment.gd index f25e60b..ef05c03 100644 --- a/Scripts/StageEnvironment.gd +++ b/Scripts/StageEnvironment.gd @@ -260,7 +260,9 @@ func check_collision(unit : Unit, collider, collision_into_directions, delta): unit.set_unit_condition(Constants.UnitCondition.IS_ON_GROUND, true) # landed on ground, horizontal component to become magnitude unit.v_speed = 0 + unit.landed() reangle_move(unit, collider, false) + # slope acceleration for DownhillAutoscroller: # set the player's last_contacted_map_elem_type field diff --git a/Scripts/Unit.gd b/Scripts/Unit.gd index 7899dae..c676827 100644 --- a/Scripts/Unit.gd +++ b/Scripts/Unit.gd @@ -280,3 +280,7 @@ func start_flash(): func invincibility_ended(): # implemented in subclass pass + +func landed(): + # implemented in subclass + pass diff --git a/Scripts/Units/DownhillAutoscrollerPlayer.gd b/Scripts/Units/DownhillAutoscrollerPlayer.gd index cc5ef80..8609896 100644 --- a/Scripts/Units/DownhillAutoscrollerPlayer.gd +++ b/Scripts/Units/DownhillAutoscrollerPlayer.gd @@ -5,9 +5,42 @@ class_name DownhillAutoscrollerPlayer export var min_speed : float = 3 export var max_speed : float = 16 export var player_initiated_acceleration : float = 8 +export var boost_per_second : float = 10 var last_contacted_map_elem_type : int = Constants.MapElemType.SQUARE +var boost : float = 0 # to movement speed + +func execute_actions(delta): + .execute_actions(delta) + for action_num in Constants.UNIT_TYPE_ACTIONS[Constants.UnitType.PLAYER]: + if !actions[action_num]: + continue + match action_num: + # handle custom actions + Constants.ActionType.SPIN: + spin(delta) + _: + pass + +func spin(delta): + set_current_action(Constants.UnitCurrentAction.SPINNING) + boost += boost_per_second * delta + +func reset_current_action(): + .reset_current_action() + if get_current_action() == Constants.UnitCurrentAction.SPINNING: + if not actions[Constants.ActionType.SPIN]: + set_current_action(Constants.UnitCurrentAction.IDLE) + +func custom_inputs(): + if scene.input_table[Constants.PlayerInput.GBA_B][scene.I_T_JUST_PRESSED]: + if not get_condition(Constants.UnitCondition.IS_ON_GROUND, true): + set_action(Constants.ActionType.SPIN) + if (get_current_action() == Constants.UnitCurrentAction.SPINNING + and scene.input_table[Constants.PlayerInput.GBA_B][scene.I_T_PRESSED]): + set_action(Constants.ActionType.SPIN) + func process_unit(delta, time_elapsed : float): # always be movin' facing = Constants.Direction.RIGHT @@ -27,6 +60,8 @@ func process_unit(delta, time_elapsed : float): if (target_move_speed < Constants.UNIT_TYPE_MOVE_SPEEDS[unit_type] and scene.input_table[Constants.PlayerInput.RIGHT][scene.I_T_PRESSED]): target_move_speed = move_toward(target_move_speed, Constants.UNIT_TYPE_MOVE_SPEEDS[unit_type], player_initiated_acceleration * delta) + if target_move_speed > max_speed: + target_move_speed = move_toward(target_move_speed, max_speed, player_initiated_acceleration * delta) else: # shallow slope: arctan(.5) = 27 degrees, sin(27) = 0.45 # steep slope: sin(45) = 0.71 @@ -50,9 +85,9 @@ func process_unit(delta, time_elapsed : float): if ground_influenced_acceleration == 0: # flat ground if scene.input_table[Constants.PlayerInput.RIGHT][scene.I_T_PRESSED]: - end_speed = max(target_move_speed, Constants.UNIT_TYPE_MOVE_SPEEDS[unit_type]) + end_speed = max(min(target_move_speed, max_speed), Constants.UNIT_TYPE_MOVE_SPEEDS[unit_type]) else: - end_speed = target_move_speed + end_speed = min(target_move_speed, max_speed) else: # incline if scene.input_table[Constants.PlayerInput.RIGHT][scene.I_T_PRESSED]: @@ -62,13 +97,18 @@ func process_unit(delta, time_elapsed : float): if target_move_speed < end_speed: target_move_speed = move_toward(target_move_speed, end_speed, player_initiated_acceleration * delta) else: - target_move_speed = move_toward(target_move_speed, end_speed, ground_influenced_acceleration * delta) + if ground_influenced_acceleration > 0: + target_move_speed = move_toward(target_move_speed, end_speed, ground_influenced_acceleration * delta) + else: + target_move_speed = move_toward(target_move_speed, end_speed, player_initiated_acceleration * delta) else: var acceleration = ground_influenced_acceleration if scene.input_table[Constants.PlayerInput.RIGHT][scene.I_T_PRESSED]: acceleration = max(acceleration, player_initiated_acceleration) if target_move_speed < max_speed: target_move_speed = move_toward(target_move_speed, max_speed, acceleration * delta) + else: + target_move_speed = move_toward(target_move_speed, max_speed, player_initiated_acceleration * delta) .process_unit(delta, time_elapsed) @@ -92,3 +132,11 @@ func handle_recoil(): hit_queued = false # skip recoil pushback logic, since target_move_speed is already # set to min_speed + +func landed(): + if get_current_action() == Constants.UnitCurrentAction.SPINNING: + hit(Constants.Direction.RIGHT) + boost = 0 + return + target_move_speed += boost + boost = 0 diff --git a/Scripts/Units/Player.gd b/Scripts/Units/Player.gd index 19bcc62..2ea8f27 100644 --- a/Scripts/Units/Player.gd +++ b/Scripts/Units/Player.gd @@ -90,3 +90,7 @@ func handle_recoil(): else: h_speed -= RECOIL_PUSHBACK facing = hit_dir + +func custom_inputs(): + # implemented in subclass + pass