diff --git a/project.godot b/project.godot index 29ad97d..5d09a6a 100644 --- a/project.godot +++ b/project.godot @@ -39,14 +39,12 @@ theme/custom_font="uid://n1nd5m2kwexu" turn_left={ "deadzone": 0.2, "events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":65,"key_label":0,"unicode":97,"location":0,"echo":false,"script":null) -, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":0,"axis_value":-1.0,"script":null) , Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":2,"axis_value":-1.0,"script":null) ] } turn_right={ "deadzone": 0.2, "events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":68,"key_label":0,"unicode":100,"location":0,"echo":false,"script":null) -, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":0,"axis_value":1.0,"script":null) , Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":2,"axis_value":1.0,"script":null) ] } @@ -99,6 +97,30 @@ pause={ , Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":6,"pressure":0.0,"pressed":true,"script":null) ] } +ground_left={ +"deadzone": 0.2, +"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":65,"key_label":0,"unicode":97,"location":0,"echo":false,"script":null) +, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":0,"axis_value":-1.0,"script":null) +] +} +ground_right={ +"deadzone": 0.2, +"events": [Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":0,"axis_value":1.0,"script":null) +, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":68,"key_label":0,"unicode":100,"location":0,"echo":false,"script":null) +] +} +ground_up={ +"deadzone": 0.2, +"events": [Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":1,"axis_value":-1.0,"script":null) +, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":87,"key_label":0,"unicode":119,"location":0,"echo":false,"script":null) +] +} +ground_down={ +"deadzone": 0.2, +"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":83,"key_label":0,"unicode":115,"location":0,"echo":false,"script":null) +, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":1,"axis_value":1.0,"script":null) +] +} [physics] diff --git a/scenes/game.tscn b/scenes/game.tscn index 65d3947..9bd3dd1 100644 --- a/scenes/game.tscn +++ b/scenes/game.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=13 format=3 uid="uid://bauklhpieuivd"] +[gd_scene load_steps=21 format=4 uid="uid://bauklhpieuivd"] [ext_resource type="Script" uid="uid://d0qswyhwbhdua" path="res://scripts/game.gd" id="1_u5sy4"] [ext_resource type="Texture2D" uid="uid://dtwo7g0ipc4k" path="res://textures/ship_1.png" id="1_uwrxv"] @@ -9,7 +9,11 @@ [ext_resource type="AudioStream" uid="uid://b6tyof2j3ytbv" path="res://sounds/concrete_halls.mp3" id="3_0tnpc"] [ext_resource type="AudioStream" uid="uid://b1ung55xg31l3" path="res://sounds/boost_finish.mp3" id="3_p57ef"] [ext_resource type="AudioStream" uid="uid://y7lhonymtk3t" path="res://sounds/fire.mp3" id="8_vtaks"] -[ext_resource type="PackedScene" uid="uid://dy6dv2tio433m" path="res://scenes/enemy.tscn" id="11_dinhu"] +[ext_resource type="Texture2D" uid="uid://dsdd1830ilu1" path="res://textures/navigation_ring.png" id="10_dinhu"] +[ext_resource type="Texture2D" uid="uid://yfsqc4i52c6k" path="res://textures/space_station_1.png" id="12_dinhu"] +[ext_resource type="Shader" uid="uid://bk7q00br1ms30" path="res://scripts/retro.gdshader" id="12_kvuet"] +[ext_resource type="Texture2D" uid="uid://hgfmjw6gbdnn" path="res://textures/blank.png" id="12_trtic"] +[ext_resource type="Script" uid="uid://d0txwo63hlrsy" path="res://scripts/enterable.gd" id="13_trtic"] [sub_resource type="CircleShape2D" id="CircleShape2D_uwrxv"] radius = 16.0 @@ -17,6 +21,34 @@ radius = 16.0 [sub_resource type="CircleShape2D" id="CircleShape2D_lnu2h"] radius = 20.0 +[sub_resource type="ShaderMaterial" id="ShaderMaterial_trtic"] +shader = ExtResource("12_kvuet") +shader_parameter/shake = 0.002000000095 +shader_parameter/noiseQuality = 250.0 +shader_parameter/noiseIntensity = 0.0010000000475 +shader_parameter/offsetIntensity = 0.0045 +shader_parameter/colorOffsetIntensity = 0.10000000149012 +shader_parameter/pixelSize = 1024.0 +shader_parameter/grainIntensity = 0.04 +shader_parameter/use_overlay = true +shader_parameter/use_lens_distortion = true +shader_parameter/overlay_color = Color(1, 1, 1, 10) +shader_parameter/lens_distortion_strength = 0.0 + +[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_ir15t"] +texture = ExtResource("12_trtic") +0:0/size_in_atlas = Vector2i(2, 2) +0:0/0 = 0 +0:0/0/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, 16, -16, 16, 16, -16, 16) + +[sub_resource type="TileSet" id="TileSet_ca42v"] +tile_size = Vector2i(32, 32) +physics_layer_0/collision_layer = 1 +sources/0 = SubResource("TileSetAtlasSource_ir15t") + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_kvuet"] +size = Vector2(128, 32) + [node name="Game" type="Node2D"] script = ExtResource("1_u5sy4") @@ -30,6 +62,9 @@ stream = ExtResource("3_0tnpc") volume_db = -10.0 bus = &"Music" +[node name="Navring" type="Sprite2D" parent="."] +texture = ExtResource("10_dinhu") + [node name="Player" type="RigidBody2D" parent="."] linear_damp = 6.247 script = ExtResource("1_yqjtg") @@ -69,15 +104,6 @@ rotation_smoothing_speed = 15.0 shape = SubResource("CircleShape2D_lnu2h") debug_color = Color(0.9686392, 0, 0.4696517, 0.41960785) -[node name="Enemy" parent="." instance=ExtResource("11_dinhu")] -position = Vector2(0, -418) - -[node name="Enemy2" parent="." instance=ExtResource("11_dinhu")] -position = Vector2(362, 397) - -[node name="Enemy3" parent="." instance=ExtResource("11_dinhu")] -position = Vector2(362, 397) - [node name="Unloadables" type="Node2D" parent="."] [node name="UI" type="CanvasLayer" parent="."] @@ -107,4 +133,34 @@ offset_bottom = 12.0 grow_vertical = 2 text = "DIST: 2048" +[node name="Shader" type="ColorRect" parent="UI"] +material = SubResource("ShaderMaterial_trtic") +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +color = Color(1, 1, 1, 0) + +[node name="SpaceStation1" type="Sprite2D" parent="."] +scale = Vector2(2, 2) +texture = ExtResource("12_dinhu") +script = ExtResource("13_trtic") + +[node name="Collision" type="TileMapLayer" parent="SpaceStation1"] +scale = Vector2(0.5, 0.5) +tile_map_data = PackedByteArray("AAD6/wgAAAAAAAAAAAD6/wkAAAAAAAAAAAD6/woAAAAAAAAAAAD6/wsAAAAAAAAAAAD6/wwAAAAAAAAAAAD6/w0AAAAAAAAAAAD6/w4AAAAAAAAAAAD6/w8AAAAAAAAAAAD7/w8AAAAAAAAAAAD8/w8AAAAAAAAAAAD9/w8AAAAAAAAAAAD9/w4AAAAAAAAAAAD8/w4AAAAAAAAAAAD7/w4AAAAAAAAAAAD7/w0AAAAAAAAAAAD7/wwAAAAAAAAAAAD7/wsAAAAAAAAAAAD7/woAAAAAAAAAAAD7/wkAAAAAAAAAAAD7/wgAAAAAAAAAAAD8/wgAAAAAAAAAAAD9/wgAAAAAAAAAAAD9/wkAAAAAAAAAAAD9/woAAAAAAAAAAAD9/wsAAAAAAAAAAAD9/wwAAAAAAAAAAAD8/wwAAAAAAAAAAAD8/w0AAAAAAAAAAAD8/wsAAAAAAAAAAAD8/woAAAAAAAAAAAD8/wkAAAAAAAAAAAD+/wkAAAAAAAAAAAD//wkAAAAAAAAAAAAAAAkAAAAAAAAAAAABAAkAAAAAAAAAAAACAAkAAAAAAAAAAAADAAkAAAAAAAAAAAABAAgAAAAAAAAAAAAAAAgAAAAAAAAAAAD//wgAAAAAAAAAAAD+/wgAAAAAAAAAAAD+/wcAAAAAAAAAAAD+/wYAAAAAAAAAAAD//wYAAAAAAAAAAAAAAAYAAAAAAAAAAAABAAYAAAAAAAAAAAABAAcAAAAAAAAAAAACAAgAAAAAAAAAAAADAAgAAAAAAAAAAAAEAAkAAAAAAAAAAAAEAAgAAAAAAAAAAAAFAAgAAAAAAAAAAAADAAoAAAAAAAAAAAACAAoAAAAAAAAAAAACAAsAAAAAAAAAAAACAAwAAAAAAAAAAAACAA0AAAAAAAAAAAACAA4AAAAAAAAAAAACAA8AAAAAAAAAAAADAA8AAAAAAAAAAAAEAA8AAAAAAAAAAAAFAA8AAAAAAAAAAAAFAA4AAAAAAAAAAAAEAA4AAAAAAAAAAAADAA4AAAAAAAAAAAADAA0AAAAAAAAAAAAEAA0AAAAAAAAAAAAFAA0AAAAAAAAAAAAFAAwAAAAAAAAAAAAEAAwAAAAAAAAAAAADAAwAAAAAAAAAAAADAAsAAAAAAAAAAAAEAAsAAAAAAAAAAAAFAAsAAAAAAAAAAAAFAAoAAAAAAAAAAAAEAAoAAAAAAAAAAAAFAAkAAAAAAAAAAAA=") +tile_set = SubResource("TileSet_ca42v") + +[node name="EnterHitbox" type="Area2D" parent="SpaceStation1"] +position = Vector2(0, 176) + +[node name="CollisionShape2D" type="CollisionShape2D" parent="SpaceStation1/EnterHitbox"] +shape = SubResource("RectangleShape2D_kvuet") + +[node name="ExitPoint" type="Node2D" parent="SpaceStation1"] +position = Vector2(0, 245.5) +rotation = 3.1415927 + [connection signal="body_shape_entered" from="Player/Hitbox" to="Player" method="_on_hitbox_body_shape_entered"] +[connection signal="area_entered" from="SpaceStation1/EnterHitbox" to="SpaceStation1" method="_on_enter_hitbox_area_entered"] diff --git a/scenes/ground_test.tscn b/scenes/ground_test.tscn new file mode 100644 index 0000000..a52a010 --- /dev/null +++ b/scenes/ground_test.tscn @@ -0,0 +1,88 @@ +[gd_scene load_steps=9 format=3 uid="uid://crc7t4acei3hj"] + +[ext_resource type="Texture2D" uid="uid://c6s5n6xqoy353" path="res://textures/player.png" id="1_s58gg"] +[ext_resource type="Script" uid="uid://dowu512otgyyf" path="res://scripts/player_ground.gd" id="1_vgnaj"] +[ext_resource type="Texture2D" uid="uid://btcap3oh2dqt8" path="res://textures/wall_tile.png" id="3_jsun3"] +[ext_resource type="Shader" uid="uid://bk7q00br1ms30" path="res://scripts/retro.gdshader" id="4_ppdof"] + +[sub_resource type="CircleShape2D" id="CircleShape2D_ppdof"] +radius = 32.0 + +[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_ppdof"] +texture = ExtResource("3_jsun3") +0:0/size_in_atlas = Vector2i(2, 2) +0:0/0 = 0 +0:0/0/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, 16, -16, 16, 16, -16, 16) + +[sub_resource type="TileSet" id="TileSet_gysiw"] +tile_size = Vector2i(32, 32) +physics_layer_0/collision_layer = 1 +sources/0 = SubResource("TileSetAtlasSource_ppdof") + +[sub_resource type="ShaderMaterial" id="ShaderMaterial_gysiw"] +shader = ExtResource("4_ppdof") +shader_parameter/shake = 0.002000000095 +shader_parameter/noiseQuality = 250.0 +shader_parameter/noiseIntensity = 0.0010000000475 +shader_parameter/offsetIntensity = 0.0045 +shader_parameter/colorOffsetIntensity = 0.10000000149012 +shader_parameter/pixelSize = 1024.0 +shader_parameter/grainIntensity = 0.04 +shader_parameter/use_overlay = true +shader_parameter/use_lens_distortion = true +shader_parameter/overlay_color = Color(1, 1, 1, 10) +shader_parameter/lens_distortion_strength = 0.0 + +[node name="GroundTest" type="Node2D"] + +[node name="PlayerGround" type="CharacterBody2D" parent="."] +script = ExtResource("1_vgnaj") + +[node name="Sprite" type="Sprite2D" parent="PlayerGround"] +texture = ExtResource("1_s58gg") + +[node name="Camera" type="Camera2D" parent="PlayerGround"] +position_smoothing_enabled = true + +[node name="CollisionShape2D" type="CollisionShape2D" parent="PlayerGround"] +shape = SubResource("CircleShape2D_ppdof") + +[node name="Map" type="TileMapLayer" parent="."] +tile_map_data = PackedByteArray(0, 0, 253, 255, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 253, 255, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 253, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 253, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 253, 255, 254, 255, 0, 0, 0, 0, 0, 0, 0, 0) +tile_set = SubResource("TileSet_gysiw") + +[node name="UI" type="CanvasLayer" parent="."] + +[node name="Control" type="Control" parent="UI"] +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 + +[node name="BoostText" type="Label" parent="UI/Control"] +layout_mode = 0 +offset_right = 40.0 +offset_bottom = 24.0 +text = "BOOST: 100" + +[node name="Distance" type="Label" parent="UI/Control"] +layout_mode = 1 +anchors_preset = 4 +anchor_top = 0.5 +anchor_bottom = 0.5 +offset_top = -12.0 +offset_right = 136.0 +offset_bottom = 12.0 +grow_vertical = 2 +text = "DIST: 2048" + +[node name="Shader" type="ColorRect" parent="UI"] +material = SubResource("ShaderMaterial_gysiw") +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +color = Color(1, 1, 1, 0) diff --git a/scenes/loading.tscn b/scenes/loading.tscn new file mode 100644 index 0000000..c3ecbdd --- /dev/null +++ b/scenes/loading.tscn @@ -0,0 +1,100 @@ +[gd_scene load_steps=7 format=3 uid="uid://c1imokv4f3shm"] + +[ext_resource type="Shader" uid="uid://bk7q00br1ms30" path="res://scripts/retro.gdshader" id="1_ir5ef"] + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_yc7uc"] +bg_color = Color(0, 0, 0, 1) +border_width_left = 8 +border_width_top = 8 +border_width_right = 8 +border_width_bottom = 8 +border_color = Color(1, 1, 1, 1) +corner_detail = 1 + +[sub_resource type="LabelSettings" id="LabelSettings_dhqfv"] +font_size = 64 + +[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_ir5ef"] + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_dhqfv"] +bg_color = Color(1, 1, 1, 1) +corner_detail = 1 + +[sub_resource type="ShaderMaterial" id="ShaderMaterial_101rs"] +shader = ExtResource("1_ir5ef") +shader_parameter/shake = 0.002000000095 +shader_parameter/noiseQuality = 250.0 +shader_parameter/noiseIntensity = 0.0010000000475 +shader_parameter/offsetIntensity = 0.0045 +shader_parameter/colorOffsetIntensity = 0.10000000149012 +shader_parameter/pixelSize = 1024.0 +shader_parameter/grainIntensity = 0.04 +shader_parameter/use_overlay = true +shader_parameter/use_lens_distortion = true +shader_parameter/overlay_color = Color(1, 1, 1, 10) +shader_parameter/lens_distortion_strength = 0.0 + +[node name="Loading" type="Node2D"] + +[node name="UI" type="CanvasLayer" parent="."] + +[node name="Control" type="Control" parent="UI"] +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 + +[node name="Panel" type="Panel" parent="UI/Control"] +custom_minimum_size = Vector2(640, 240) +layout_mode = 1 +anchors_preset = 8 +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +offset_left = -20.0 +offset_top = -20.0 +offset_right = 20.0 +offset_bottom = 20.0 +grow_horizontal = 2 +grow_vertical = 2 +theme_override_styles/panel = SubResource("StyleBoxFlat_yc7uc") + +[node name="Label" type="Label" parent="UI/Control/Panel"] +custom_minimum_size = Vector2(0, 128) +layout_mode = 1 +anchors_preset = 10 +anchor_right = 1.0 +offset_bottom = 24.0 +grow_horizontal = 2 +text = "LOAD" +label_settings = SubResource("LabelSettings_dhqfv") +horizontal_alignment = 1 +vertical_alignment = 1 + +[node name="ProgressBar" type="ProgressBar" parent="UI/Control/Panel"] +layout_mode = 1 +anchors_preset = -1 +anchor_right = 1.0 +anchor_bottom = 1.0 +offset_left = 32.0 +offset_top = 128.0 +offset_right = -32.0 +offset_bottom = -32.0 +grow_horizontal = 2 +grow_vertical = 0 +theme_override_styles/background = SubResource("StyleBoxEmpty_ir5ef") +theme_override_styles/fill = SubResource("StyleBoxFlat_dhqfv") +value = 50.0 +show_percentage = false + +[node name="Shader" type="ColorRect" parent="UI"] +material = SubResource("ShaderMaterial_101rs") +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +color = Color(1, 1, 1, 0) diff --git a/scripts/enterable.gd b/scripts/enterable.gd new file mode 100644 index 0000000..99f2b41 --- /dev/null +++ b/scripts/enterable.gd @@ -0,0 +1,7 @@ +extends Sprite2D + +var game = get_parent() + +func _on_enter_hitbox_area_entered(area: Area2D) -> void: + if area.get_name() == "Player": + game.enter_physical(get_name()) diff --git a/scripts/enterable.gd.uid b/scripts/enterable.gd.uid new file mode 100644 index 0000000..238acf1 --- /dev/null +++ b/scripts/enterable.gd.uid @@ -0,0 +1 @@ +uid://d0txwo63hlrsy diff --git a/scripts/game.gd b/scripts/game.gd index c6fb248..b5dd42d 100644 --- a/scripts/game.gd +++ b/scripts/game.gd @@ -15,6 +15,8 @@ func chunk_to_world(position: Vector2) -> Vector2: return Vector2(floori(position.x * 1024), floori(position.y * 1024)) func _process(delta: float) -> void: + $Navring.position = $Player.position + $UI/Control/BoostText.text = "BOOST: " + str($Player.boost) $UI/Control/Distance.text = "DIST: " + str(floori($Player.position.length())) diff --git a/scripts/global.gd b/scripts/global.gd index 0d831ba..614d3c3 100644 --- a/scripts/global.gd +++ b/scripts/global.gd @@ -1,6 +1,11 @@ extends Node var orbit_zones = [ + { + "name": "The Star", + "distance": 2048 * 1.5, + "spawns": [] + }, { "name": "Test Zone", "distance": 0, @@ -13,9 +18,5 @@ var orbit_zones = [ } ] }, - { - "name": "Test Zone 2", - "distance": 2048 * 1.5, - "spawns": [] - } + ] diff --git a/scripts/player.gd b/scripts/player.gd index ebdd5a4..bbd0baa 100644 --- a/scripts/player.gd +++ b/scripts/player.gd @@ -83,7 +83,13 @@ func _physics_process(delta: float) -> void: func _on_hitbox_body_shape_entered(body_rid: RID, body: Node2D, body_shape_index: int, local_shape_index: int) -> void: - if body.linear_velocity.length() + linear_velocity.length() > 256: + var hit_velocity = linear_velocity.length() + if "linear_velocity" in body: + hit_velocity = body.linear_velocity.length() + linear_velocity.length() + + print(hit_velocity) + + if hit_velocity > 256: camera_shake_power = 4 $Collision.play() diff --git a/scripts/player_ground.gd b/scripts/player_ground.gd new file mode 100644 index 0000000..5e3618c --- /dev/null +++ b/scripts/player_ground.gd @@ -0,0 +1,9 @@ +extends CharacterBody2D + +func _process(delta: float) -> void: + var horizontial_movement = Input.get_axis("ground_left", "ground_right") + var vertical_movement = Input.get_axis("ground_up", "ground_down") + + velocity = Vector2(256 * horizontial_movement, 256 * vertical_movement) + + move_and_slide() diff --git a/scripts/player_ground.gd.uid b/scripts/player_ground.gd.uid new file mode 100644 index 0000000..760d72a --- /dev/null +++ b/scripts/player_ground.gd.uid @@ -0,0 +1 @@ +uid://dowu512otgyyf diff --git a/scripts/retro.gdshader b/scripts/retro.gdshader new file mode 100644 index 0000000..ac1eddd --- /dev/null +++ b/scripts/retro.gdshader @@ -0,0 +1,93 @@ +shader_type canvas_item; + +uniform float shake: hint_range(0, 10) = 0.015; +uniform float noiseQuality: hint_range(0.1, 250, 0.1) = 250; +uniform float noiseIntensity: hint_range(0, 0.05, 0.001) = 0.001; +uniform float offsetIntensity: hint_range(0, 0.05, 0.0001) = 0.0045; +uniform float colorOffsetIntensity: hint_range(0.1, 1.5, 0.001) = 0.2; +uniform float pixelSize: hint_range(1, 1024) = 200.0; +uniform float grainIntensity: hint_range(0, 1) = 0.04; // Intensity of film grain + +uniform sampler2D screen_texture : hint_screen_texture, repeat_disable, filter_nearest; +uniform sampler2D overlay_texture : hint_default_transparent; +uniform bool use_overlay = true; // Toggle for using overlay texture +uniform bool use_lens_distortion = true; // Toggle for using lens distortion + +uniform vec4 overlay_color : source_color = vec4(1.0, 1.0, 1.0, 10.0); // Allow changing overlay color +uniform float lens_distortion_strength: hint_range(0, 0.1) = 0.05; // Strength of lens distortion effect + +varying vec2 previous_pos; // Previous fragment position + +float rand(vec2 co) +{ + return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453); +} + +float verticalBar(float pos, float uvY, float offset) +{ + float edge0 = (pos - shake); + float edge1 = (pos + shake); + + float x = smoothstep(edge0, pos, uvY) * offset; + x -= smoothstep(pos, edge1, uvY) * offset; + return x; +} + +void fragment() { + vec2 iResolution = 1.0 / SCREEN_PIXEL_SIZE; + vec2 uv = FRAGCOORD.xy / iResolution.xy; + + // Calculate velocity + vec2 velocity = uv - previous_pos; + + // Apply pixelation effect + uv = floor(uv * pixelSize) / pixelSize; + + // Add vertical bars distortion + for (float i = 0.0; i < 0.71; i += 0.1313) + { + float d = mod(TIME * i, 1.7); + float o = sin(1.0 - tan(TIME * 0.24 * i)); + o *= offsetIntensity; + uv.x += verticalBar(d, uv.y, o); + } + + // Add noise distortion + float uvY = uv.y * noiseQuality; + uvY = float(int(uvY)) * (1.0 / noiseQuality); + float noise = rand(vec2(TIME * 0.00001, uvY)); + uv.x += noise * noiseIntensity; + + // Add color offset distortion + vec2 offsetR = vec2(0.006 * sin(TIME), 0.0) * colorOffsetIntensity; + vec2 offsetG = vec2(0.0073 * cos(TIME * 0.97), 0.0) * colorOffsetIntensity; + + float r = texture(screen_texture, uv + offsetR).r; + float g = texture(screen_texture, uv + offsetG).g; + float b = texture(screen_texture, uv).b; + + vec4 tex = vec4(r, g, b, 1.0); + + // Overlay with an optional texture + if (use_overlay) { + vec4 overlayColor = texture(overlay_texture, uv) * overlay_color; // Apply overlay color + tex = mix(tex, overlayColor, overlayColor.a); + } + + // Add film grain + float grain = rand(uv) * 2.0 - 1.0; // Range from -1 to 1 + tex.rgb += grainIntensity * grain; + + // Apply lens distortion + if (use_lens_distortion) { + vec2 distortion = uv * lens_distortion_strength * (uv - 1.0); + vec4 distorted_tex = texture(screen_texture, uv + distortion); + tex = mix(tex, distorted_tex, 0.5); + } + + // Apply final color + COLOR = tex; + + // Store current position for next frame + previous_pos = FRAGCOORD.xy / iResolution.xy; +} diff --git a/scripts/retro.gdshader.uid b/scripts/retro.gdshader.uid new file mode 100644 index 0000000..3e30bfa --- /dev/null +++ b/scripts/retro.gdshader.uid @@ -0,0 +1 @@ +uid://bk7q00br1ms30 diff --git a/textures/blank.png b/textures/blank.png new file mode 100644 index 0000000..a1e4190 Binary files /dev/null and b/textures/blank.png differ diff --git a/textures/blank.png.import b/textures/blank.png.import new file mode 100644 index 0000000..64682ee --- /dev/null +++ b/textures/blank.png.import @@ -0,0 +1,40 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://hgfmjw6gbdnn" +path="res://.godot/imported/blank.png-c01b3bfe55bc48d9dbcbf1f585c4ade9.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://textures/blank.png" +dest_files=["res://.godot/imported/blank.png-c01b3bfe55bc48d9dbcbf1f585c4ade9.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/textures/navigation_ring.png b/textures/navigation_ring.png new file mode 100644 index 0000000..9846851 Binary files /dev/null and b/textures/navigation_ring.png differ diff --git a/textures/navigation_ring.png.import b/textures/navigation_ring.png.import new file mode 100644 index 0000000..b0dd178 --- /dev/null +++ b/textures/navigation_ring.png.import @@ -0,0 +1,40 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://dsdd1830ilu1" +path="res://.godot/imported/navigation_ring.png-eaf2cfea0480ebed8f7f659b783d94ef.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://textures/navigation_ring.png" +dest_files=["res://.godot/imported/navigation_ring.png-eaf2cfea0480ebed8f7f659b783d94ef.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/textures/player.png b/textures/player.png new file mode 100644 index 0000000..6e344f2 Binary files /dev/null and b/textures/player.png differ diff --git a/textures/player.png.import b/textures/player.png.import new file mode 100644 index 0000000..df95819 --- /dev/null +++ b/textures/player.png.import @@ -0,0 +1,40 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://c6s5n6xqoy353" +path="res://.godot/imported/player.png-ce289a19efa81f268b1bb13630e9f80b.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://textures/player.png" +dest_files=["res://.godot/imported/player.png-ce289a19efa81f268b1bb13630e9f80b.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/textures/space_station_1.png b/textures/space_station_1.png new file mode 100644 index 0000000..0212ba2 Binary files /dev/null and b/textures/space_station_1.png differ diff --git a/textures/space_station_1.png.import b/textures/space_station_1.png.import new file mode 100644 index 0000000..83b6be6 --- /dev/null +++ b/textures/space_station_1.png.import @@ -0,0 +1,40 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://yfsqc4i52c6k" +path="res://.godot/imported/space_station_1.png-6f3b1269ea35367a5a36b418ba5f55a3.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://textures/space_station_1.png" +dest_files=["res://.godot/imported/space_station_1.png-6f3b1269ea35367a5a36b418ba5f55a3.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/textures/wall_tile.png b/textures/wall_tile.png new file mode 100644 index 0000000..e338aab Binary files /dev/null and b/textures/wall_tile.png differ diff --git a/textures/wall_tile.png.import b/textures/wall_tile.png.import new file mode 100644 index 0000000..4201d7d --- /dev/null +++ b/textures/wall_tile.png.import @@ -0,0 +1,40 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://btcap3oh2dqt8" +path="res://.godot/imported/wall_tile.png-09b14932d3c2b71c0c48b8e730ea62df.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://textures/wall_tile.png" +dest_files=["res://.godot/imported/wall_tile.png-09b14932d3c2b71c0c48b8e730ea62df.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1