diff --git a/blobby1.ico b/blobby1.ico index a099ee1..d0207b2 100644 Binary files a/blobby1.ico and b/blobby1.ico differ diff --git a/blobby1.png b/blobby1.png new file mode 100644 index 0000000..29f7d73 Binary files /dev/null and b/blobby1.png differ diff --git a/icon.png.import b/blobby1.png.import similarity index 63% rename from icon.png.import rename to blobby1.png.import index a4c02e6..43a9a01 100644 --- a/icon.png.import +++ b/blobby1.png.import @@ -2,15 +2,15 @@ importer="texture" type="StreamTexture" -path="res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex" +path="res://.import/blobby1.png-02080f0b57c8ccaa15e26b1a3859acb0.stex" metadata={ "vram_texture": false } [deps] -source_file="res://icon.png" -dest_files=[ "res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex" ] +source_file="res://blobby1.png" +dest_files=[ "res://.import/blobby1.png-02080f0b57c8ccaa15e26b1a3859acb0.stex" ] [params] @@ -20,16 +20,16 @@ compress/hdr_mode=0 compress/bptc_ldr=0 compress/normal_map=0 flags/repeat=0 -flags/filter=true +flags/filter=false flags/mipmaps=false flags/anisotropic=false flags/srgb=2 -process/fix_alpha_border=true +process/fix_alpha_border=false process/premult_alpha=false process/HDR_as_SRGB=false process/invert_color=false process/normal_map_invert_y=false stream=false size_limit=0 -detect_3d=true +detect_3d=false svg/scale=1.0 diff --git a/icon.png b/icon.png deleted file mode 100644 index 2e42096..0000000 Binary files a/icon.png and /dev/null differ diff --git a/project.godot b/project.godot index e654080..9e7513e 100644 --- a/project.godot +++ b/project.godot @@ -171,6 +171,14 @@ interact={ , Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":0,"physical_scancode":16777221,"unicode":0,"echo":false,"script":null) ] } +up={ +"deadzone": 0.5, +"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":0,"physical_scancode":87,"unicode":0,"echo":false,"script":null) +, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":0,"physical_scancode":16777232,"unicode":0,"echo":false,"script":null) +, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":1,"axis_value":-1.0,"script":null) +, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":12,"pressure":0.0,"pressed":false,"script":null) + ] +} [layer_names] @@ -187,7 +195,7 @@ interact={ [physics] common/physics_fps=120 -2d/thread_model=2 +2d/thread_model=0 2d/cell_size=100 common/enable_object_picking=false diff --git a/src/Actors/Blobby/Blobby.tscn b/src/Actors/Blobby/Blobby.tscn index 12a259c..df02e98 100644 --- a/src/Actors/Blobby/Blobby.tscn +++ b/src/Actors/Blobby/Blobby.tscn @@ -4764,6 +4764,5 @@ one_shot = true [connection signal="body_entered" from="BlobbySkin" to="." method="_on_BlobbySkin_body_entered"] [connection signal="got_grounded" from="BlobbyStateMachine" to="." method="_on_Blobby_got_grounded"] [connection signal="timeout" from="BlobbyStateMachine/JumpBufferTimer" to="BlobbyStateMachine" method="_on_JumpBufferTimer_timeout"] -[connection signal="timeout" from="BlobbyStateMachine/CoyoteTimer" to="BlobbyStateMachine" method="_on_CoyoteTimer_timeout"] [connection signal="timeout" from="InvincibilityTimer" to="." method="_on_InvincibilityTimer_timeout"] [connection signal="timeout" from="PitfallTimer" to="." method="_on_PitfallTimer_timeout"] diff --git a/src/Actors/BlobbyCam.gd b/src/Actors/BlobbyCam.gd index 66cdf00..f2d5e5e 100644 --- a/src/Actors/BlobbyCam.gd +++ b/src/Actors/BlobbyCam.gd @@ -22,22 +22,28 @@ onready var signalManager := $"%SignalManager" onready var shiftLeft = $CameraAnimationPlayer.get_animation("shiftingLeft") onready var shiftRight = $CameraAnimationPlayer.get_animation("shiftingRight") onready var shiftCenter = $CameraAnimationPlayer.get_animation("shiftingCenter") -onready var anim_player = $CameraAnimationPlayer -onready var original_x_zoom = zoom.x -onready var original_y_zoom = zoom.y -onready var blobby = get_node("%Blobby") -onready var screen_rect = Vector2(ProjectSettings.get_setting("display/window/size/width") * zoom.x, ProjectSettings.get_setting("display/window/size/height") * zoom.y ) +onready var anim_player := $CameraAnimationPlayer +onready var horizontal_tween := $HorizontalShiftTween +onready var original_x_zoom := zoom.x +onready var original_y_zoom := zoom.y +onready var blobby := get_node("%Blobby") var image = Image.new() var texture = ImageTexture.new() var prev_pos: Vector2 +var camera_state := "centered" + +var screen_rect = Vector2(ProjectSettings.get_setting("display/window/size/width") * zoom.x, ProjectSettings.get_setting("display/window/size/height") * zoom.y ) +var screen_center = Vector2() +var screen_bottom = Vector2() +var screen_top = Vector2() +var screen_left = Vector2() +var screen_right = Vector2() # Gets the camera limits from the tilemap of the level # Requires "TileMap" to be a sibling of blobby func _ready(): - _set_boundaries() - print(screen_rect) self.position = blobby.global_position image.create(128, 2, false, Image.FORMAT_RGBAH) # TODO Test Performance @@ -49,7 +55,18 @@ func _ready(): func _on_SignalManager_terminal_activated(): get_node("LightAnimationPlayer").play("Pulsing") -func _physics_process(delta: float) -> void: +func _draw(): + draw_line(Vector2((limit_left - position.x), screen_center.y), screen_left, Color(255, 0, 0), 1) + +func _process(delta: float) -> void: + update() + screen_center = (get_camera_screen_center() - position) + screen_bottom = screen_center + Vector2(0, screen_rect.y/2) + screen_top = screen_center - Vector2(0, screen_rect.y/2) + screen_left = screen_center - Vector2(screen_rect.x/2, 0) + screen_right = screen_center + Vector2(screen_rect.x/2, 0) + _adjust_horizontal_offset(delta) + if(anim_player.is_playing()): position = blobby.position prev_pos = position @@ -72,8 +89,10 @@ func _physics_process(delta: float) -> void: slow_time += delta left_move_time = max(0, left_move_time - delta) right_move_time = max(0, right_move_time - delta) - + _adapt_to_movement(player_vel) + if camera_state == "centered": + _adapt_to_input(player_vel) position = blobby.position prev_pos = position _update_lighting_shader() @@ -114,36 +133,25 @@ func _adapt_to_movement(velocity: Vector2) -> void: if(left_move_time >= offset_adapt_seconds && !anim_player.is_playing()): left_move_time = 0 target_offset.x = -camera_horizontal_shift - if(offset == target_offset || - left_edge_pos + target_offset.x - 24 < limit_left || - right_edge_pos + target_offset.x + 24 > limit_right ): + if(offset == target_offset): return offset_track = shiftLeft.find_track(".:offset") shiftLeft.track_set_key_value(offset_track, 0, offset) shiftLeft.track_set_key_value(offset_track, 1, target_offset) - # limit_left = original_limit_left + camera_horizontal_shift - var limit_left_track = shiftLeft.find_track(".:limit_left") - var new_limit_left = original_limit_left + camera_horizontal_shift - shiftLeft.track_set_key_value(limit_left_track, 0, limit_left) - shiftLeft.track_set_key_value(limit_left_track, 1, new_limit_left) + camera_state = "shiftedLeft" anim_player.play("shiftingLeft") elif(right_move_time >= offset_adapt_seconds && !anim_player.is_playing()): right_move_time = 0 target_offset.x = camera_horizontal_shift - if(offset == target_offset || - left_edge_pos + target_offset.x - 24 < limit_left || - right_edge_pos + target_offset.x + 24 > limit_right ): + if(offset == target_offset): return offset_track = shiftRight.find_track(".:offset") shiftRight.track_set_key_value(offset_track, 0, offset) shiftRight.track_set_key_value(offset_track, 1, target_offset) - # limit_right = original_limit_right - camera_horizontal_shift - var limit_right_track = shiftRight.find_track(".:limit_right") - var new_limit_right = original_limit_right - camera_horizontal_shift - shiftRight.track_set_key_value(limit_right_track, 0, limit_right) - shiftRight.track_set_key_value(limit_right_track, 1, new_limit_right) + camera_state = "shiftedRight" anim_player.play("shiftingRight") - elif(slow_time >= offset_reset_seconds): + elif(slow_time >= offset_reset_seconds && + !(Input.is_action_pressed("up") || Input.is_action_pressed("duck"))): slow_time = 0 target_offset.x = 0 if(offset == target_offset): @@ -152,21 +160,32 @@ func _adapt_to_movement(velocity: Vector2) -> void: offset_track = shiftCenter.find_track(".:offset") shiftCenter.track_set_key_value(offset_track, 0, offset) shiftCenter.track_set_key_value(offset_track, 1, target_offset) - var limit_left_track = shiftCenter.find_track(".:limit_left") - var limit_right_track = shiftCenter.find_track(".:limit_right") - var limit_top_track = shiftCenter.find_track(".:limit_top") - var limit_bottom_track = shiftCenter.find_track(".:limit_bottom") - shiftCenter.track_set_key_value(limit_left_track, 0, limit_left) - shiftCenter.track_set_key_value(limit_right_track, 0, limit_right) - shiftCenter.track_set_key_value(limit_top_track, 0, limit_top) - shiftCenter.track_set_key_value(limit_bottom_track, 0, limit_bottom) - shiftCenter.track_set_key_value(limit_left_track, 1, original_limit_left) - shiftCenter.track_set_key_value(limit_right_track, 1,original_limit_right) - shiftCenter.track_set_key_value(limit_top_track, 1, original_limit_top) - shiftCenter.track_set_key_value(limit_bottom_track, 1, original_limit_bottom) + camera_state = "centered" anim_player.play("shiftingCenter") return +func _adapt_to_input(velocity: Vector2) -> void: + # TODO Den bug dass man damit durch die map gucken kann wenn man sich weiter bewegt + # lasse ich erstmal drin + if Input.is_action_pressed("duck"): + if(original_limit_bottom - position.y - 2 > screen_bottom.y && offset.y < 48): + offset.y += 1 + elif Input.is_action_pressed("up"): + if(original_limit_top - position.y + 2 < screen_top.y && offset.y > -48): + offset.y -= 1 + +func _adjust_horizontal_offset(delta: float) -> void: + if (limit_left - position.x - screen_left.x > 0.00001): + print(limit_left - position.x - screen_left.x) + if (anim_player.is_playing()): + anim_player.stop(false) + offset.x += (limit_left - position.x - screen_left.x)/3 + if (limit_right - position.x - screen_right.x < 0.00001): + print(limit_right - position.x - screen_right.x) + if (anim_player.is_playing()): + anim_player.stop(false) + offset.x += (limit_right - position.x - screen_right.x)/3 + func reset_limits() -> void: limit_left = original_limit_left limit_right = original_limit_right diff --git a/src/Actors/BlobbyCam.tscn b/src/Actors/BlobbyCam.tscn index ef2ae6a..959d642 100644 --- a/src/Actors/BlobbyCam.tscn +++ b/src/Actors/BlobbyCam.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=52 format=2] +[gd_scene load_steps=53 format=2] [ext_resource path="res://src/Actors/BlobbyCam.gd" type="Script" id=1] [ext_resource path="res://assets/environment/background/Asteroids-Near.png" type="Texture" id=2] @@ -577,7 +577,7 @@ tracks/1/path = NodePath(".:limit_left") tracks/1/interp = 1 tracks/1/loop_wrap = true tracks/1/imported = false -tracks/1/enabled = true +tracks/1/enabled = false tracks/1/keys = { "times": PoolRealArray( 0, 0.6 ), "transitions": PoolRealArray( 1, 1 ), @@ -589,7 +589,7 @@ tracks/2/path = NodePath(".:limit_top") tracks/2/interp = 1 tracks/2/loop_wrap = true tracks/2/imported = false -tracks/2/enabled = true +tracks/2/enabled = false tracks/2/keys = { "times": PoolRealArray( 0, 0.6 ), "transitions": PoolRealArray( 1, 1 ), @@ -601,7 +601,7 @@ tracks/3/path = NodePath(".:limit_right") tracks/3/interp = 1 tracks/3/loop_wrap = true tracks/3/imported = false -tracks/3/enabled = true +tracks/3/enabled = false tracks/3/keys = { "times": PoolRealArray( 0, 0.6 ), "transitions": PoolRealArray( 1, 1 ), @@ -613,7 +613,7 @@ tracks/4/path = NodePath(".:limit_bottom") tracks/4/interp = 1 tracks/4/loop_wrap = true tracks/4/imported = false -tracks/4/enabled = true +tracks/4/enabled = false tracks/4/keys = { "times": PoolRealArray( 0, 0.6 ), "transitions": PoolRealArray( 1, 1 ), @@ -665,7 +665,7 @@ tracks/1/path = NodePath(".:limit_left") tracks/1/interp = 1 tracks/1/loop_wrap = true tracks/1/imported = false -tracks/1/enabled = true +tracks/1/enabled = false tracks/1/keys = { "times": PoolRealArray( 0, 0.6 ), "transitions": PoolRealArray( 1, 1 ), @@ -705,7 +705,47 @@ tracks/1/path = NodePath(".:limit_right") tracks/1/interp = 1 tracks/1/loop_wrap = true tracks/1/imported = false -tracks/1/enabled = true +tracks/1/enabled = false +tracks/1/keys = { +"times": PoolRealArray( 0, 0.6 ), +"transitions": PoolRealArray( 1, 1 ), +"update": 0, +"values": [ 10000000, 10000000 ] +} +tracks/2/type = "value" +tracks/2/path = NodePath(".:drag_margin_right") +tracks/2/interp = 1 +tracks/2/loop_wrap = true +tracks/2/imported = false +tracks/2/enabled = false +tracks/2/keys = { +"times": PoolRealArray( 0, 0.6 ), +"transitions": PoolRealArray( 1, 1 ), +"update": 0, +"values": [ 0.2, 0.05 ] +} + +[sub_resource type="Animation" id=16] +resource_name = "shiftingUp" +length = 0.6 +tracks/0/type = "value" +tracks/0/path = NodePath(".:offset") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/keys = { +"times": PoolRealArray( 0, 0.6 ), +"transitions": PoolRealArray( 1, 1 ), +"update": 0, +"values": [ Vector2( 0, 0 ), Vector2( 0, 0 ) ] +} +tracks/1/type = "value" +tracks/1/path = NodePath(".:limit_right") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/imported = false +tracks/1/enabled = false tracks/1/keys = { "times": PoolRealArray( 0, 0.6 ), "transitions": PoolRealArray( 1, 1 ), @@ -830,9 +870,7 @@ current = true zoom = Vector2( 0.75, 0.75 ) drag_margin_h_enabled = true drag_margin_v_enabled = true -drag_margin_left = 0.1 drag_margin_top = 0.0 -drag_margin_right = 0.1 drag_margin_bottom = 0.25 editor_draw_drag_margin = true script = ExtResource( 1 ) @@ -845,6 +883,7 @@ anims/deathCamLateRotation = SubResource( 14 ) anims/shiftingCenter = SubResource( 11 ) anims/shiftingLeft = SubResource( 12 ) anims/shiftingRight = SubResource( 13 ) +anims/shiftingUp = SubResource( 16 ) [node name="LightAnimationPlayer" type="AnimationPlayer" parent="."] root_node = NodePath("../ParallaxBackground/ParallaxLayer4") @@ -939,10 +978,10 @@ texture = ExtResource( 8 ) [node name="AnimatedSprite" type="AnimatedSprite" parent="ParallaxBackground/ParallaxLayer5"] visible = false frames = SubResource( 7 ) -frame = 7 +frame = 13 playing = true [node name="AnimatedSprite2" type="AnimatedSprite" parent="ParallaxBackground/ParallaxLayer5"] frames = SubResource( 8 ) -frame = 12 +frame = 4 playing = true diff --git a/src/Actors/Enemies/Beings/Flyer.tscn b/src/Actors/Enemies/Beings/Flyer.tscn index fc4aa5c..cd9e70f 100644 --- a/src/Actors/Enemies/Beings/Flyer.tscn +++ b/src/Actors/Enemies/Beings/Flyer.tscn @@ -199,7 +199,8 @@ script = ExtResource( 1 ) vision_distance = 8.0 loose_target_seconds = 5.0 patrolling = true -acceleration = 80 +acceleration = 70 +max_speed = 80 weight = 0.3 [node name="Statemachine" type="Node2D" parent="."] diff --git a/src/Actors/Enemies/Beings/WhatAreFrog.gd b/src/Actors/Enemies/Beings/WhatAreFrog.gd index 86ad5be..1bb1a1c 100644 --- a/src/Actors/Enemies/Beings/WhatAreFrog.gd +++ b/src/Actors/Enemies/Beings/WhatAreFrog.gd @@ -72,8 +72,9 @@ func _on_StompDetector_body_entered(body: Node) -> void: if !body.is_in_group("player"): return var incoming_vel_vector: Vector2 = body.velocity.normalized() + # TODO This is not the right angle somehow print(rad2deg(abs(incoming_vel_vector.angle_to(Vector2.DOWN.rotated(rotation))))) - if abs(incoming_vel_vector.angle_to(Vector2.DOWN.rotated(rotation))) > deg2rad(50): + if abs(incoming_vel_vector.angle_to(Vector2.DOWN.rotated(rotation))) > deg2rad(60): print("too shallow entry") return signalManager.emit_signal("got_stomped") diff --git a/src/Levels/Level 1.tscn b/src/Levels/Level 1.tscn index 519662b..8bc3f8b 100644 --- a/src/Levels/Level 1.tscn +++ b/src/Levels/Level 1.tscn @@ -36,10 +36,10 @@ unique_name_in_owner = true drag_margin_bottom = 0.3 [node name="AnimatedSprite" parent="BlobbyCam/ParallaxBackground/ParallaxLayer5" index="4"] -frame = 10 +frame = 8 [node name="AnimatedSprite2" parent="BlobbyCam/ParallaxBackground/ParallaxLayer5" index="5"] -frame = 10 +frame = 8 [node name="Blobby" parent="." instance=ExtResource( 8 )] unique_name_in_owner = true diff --git a/src/Levels/Level 2.tscn b/src/Levels/Level 2.tscn index 86f5a30..b248e96 100644 --- a/src/Levels/Level 2.tscn +++ b/src/Levels/Level 2.tscn @@ -44,14 +44,14 @@ unique_name_in_owner = true drag_margin_bottom = 0.3 [node name="AnimatedSprite" parent="BlobbyCam/ParallaxBackground/ParallaxLayer5" index="4"] -frame = 11 +frame = 3 [node name="AnimatedSprite2" parent="BlobbyCam/ParallaxBackground/ParallaxLayer5" index="5"] -frame = 11 +frame = 3 [node name="Blobby" parent="." instance=ExtResource( 9 )] unique_name_in_owner = true -position = Vector2( 2385, -81 ) +position = Vector2( 0, -3 ) [node name="AnimationTree" parent="Blobby/BlobbySprite" index="0"] parameters/playback = SubResource( 4 ) diff --git a/src/UserInterface/Screens/MainScreen.tscn b/src/UserInterface/Screens/MainScreen.tscn index 5f026a2..fb1eecd 100644 --- a/src/UserInterface/Screens/MainScreen.tscn +++ b/src/UserInterface/Screens/MainScreen.tscn @@ -60,7 +60,7 @@ size_flags_horizontal = 3 [node name="PlayButton" parent="MenuContainer/Buttons" instance=ExtResource( 3 )] margin_right = 296.0 margin_bottom = 48.0 -next_scene_path = "res://src/Levels/01 Level.tscn" +next_scene_path = "res://src/Levels/Level 1.tscn" [node name="QuitButton" parent="MenuContainer/Buttons" instance=ExtResource( 1 )] anchor_left = 0.0