diff --git a/addons/ridiculous_coding/GravityBold8.ttf b/addons/ridiculous_coding/GravityBold8.ttf new file mode 100644 index 0000000..5e119db Binary files /dev/null and b/addons/ridiculous_coding/GravityBold8.ttf differ diff --git a/addons/ridiculous_coding/GravityBold8.ttf.import b/addons/ridiculous_coding/GravityBold8.ttf.import new file mode 100644 index 0000000..6f97ca0 --- /dev/null +++ b/addons/ridiculous_coding/GravityBold8.ttf.import @@ -0,0 +1,41 @@ +[remap] + +importer="font_data_dynamic" +type="FontFile" +uid="uid://coiaqb8xwuaic" +path="res://.godot/imported/GravityBold8.ttf-e67aa3e4866d0a81519c9b866a8f924b.fontdata" + +[deps] + +source_file="res://addons/ridiculous_coding/GravityBold8.ttf" +dest_files=["res://.godot/imported/GravityBold8.ttf-e67aa3e4866d0a81519c9b866a8f924b.fontdata"] + +[params] + +Rendering=null +antialiasing=1 +generate_mipmaps=false +disable_embedded_bitmaps=true +multichannel_signed_distance_field=false +msdf_pixel_range=8 +msdf_size=48 +allow_system_fallback=true +force_autohinter=false +modulate_color_glyphs=false +hinting=1 +subpixel_positioning=1 +keep_rounding_remainders=true +oversampling=0.0 +Fallbacks=null +fallbacks=[] +Compress=null +compress=true +preload=[{ +"chars": [], +"glyphs": [], +"name": "New Configuration", +"size": Vector2i(16, 0) +}] +language_support={} +script_support={} +opentype_features={} diff --git a/addons/ridiculous_coding/blip.gd b/addons/ridiculous_coding/blip.gd new file mode 100644 index 0000000..dde337d --- /dev/null +++ b/addons/ridiculous_coding/blip.gd @@ -0,0 +1,36 @@ +@tool +extends Node2D + +var destroy: bool = false +var last_key: String = "" +var pitch_increase: float = 0.0 +var sound: bool = true +var blips: bool = true + +@onready var audio_stream_player: AudioStreamPlayer = $AudioStreamPlayer +@onready var animated_sprite_2d: AnimatedSprite2D = $AnimatedSprite2D +@onready var animated_player: AnimationPlayer = $AnimationPlayer +@onready var gpu_particle_2d: GPUParticles2D = $GPUParticles2D +@onready var timer: Timer = $Timer +@onready var label: Label = $Label + + +func _ready(): + if sound: + audio_stream_player.pitch_scale = 1.0 + pitch_increase * 0.01 + audio_stream_player.play() + + if blips: + animated_sprite_2d.frame = 0 + animated_sprite_2d.play("default") + animated_player.play("default") + gpu_particle_2d.emitting = true + + timer.start() + label.text = last_key + label.modulate = Color(randf_range(0,2), randf_range(0,2), randf_range(0,2)) + + +func _on_Timer_timeout(): + if destroy: + queue_free() diff --git a/addons/ridiculous_coding/blip.gd.uid b/addons/ridiculous_coding/blip.gd.uid new file mode 100644 index 0000000..66eeee4 --- /dev/null +++ b/addons/ridiculous_coding/blip.gd.uid @@ -0,0 +1 @@ +uid://b8gq8xm5rsshw diff --git a/addons/ridiculous_coding/blip.png b/addons/ridiculous_coding/blip.png new file mode 100644 index 0000000..9030639 Binary files /dev/null and b/addons/ridiculous_coding/blip.png differ diff --git a/addons/ridiculous_coding/blip.png.import b/addons/ridiculous_coding/blip.png.import new file mode 100644 index 0000000..94f966b --- /dev/null +++ b/addons/ridiculous_coding/blip.png.import @@ -0,0 +1,40 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://d1tio2ceqgm7m" +path="res://.godot/imported/blip.png-7449238b2e7dcd337fbb9eec8c7b957e.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://addons/ridiculous_coding/blip.png" +dest_files=["res://.godot/imported/blip.png-7449238b2e7dcd337fbb9eec8c7b957e.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/addons/ridiculous_coding/blip.tscn b/addons/ridiculous_coding/blip.tscn new file mode 100644 index 0000000..1c98cf2 --- /dev/null +++ b/addons/ridiculous_coding/blip.tscn @@ -0,0 +1,174 @@ +[gd_scene load_steps=19 format=3 uid="uid://c0fhho0dp1svt"] + +[ext_resource type="Script" path="res://addons/ridiculous_coding/blip.gd" id="1_tp8nq"] +[ext_resource type="Texture2D" uid="uid://d1tio2ceqgm7m" path="res://addons/ridiculous_coding/blip.png" id="2_kj7um"] +[ext_resource type="AudioStream" uid="uid://b2ood3lkcgpqb" path="res://addons/ridiculous_coding/blip.wav" id="3_xg6qd"] +[ext_resource type="FontFile" uid="uid://bvwnnnja1ur2i" path="res://addons/ridiculous_coding/font.tres" id="4_ullf3"] + +[sub_resource type="AtlasTexture" id="AtlasTexture_hp4ed"] +atlas = ExtResource("2_kj7um") +region = Rect2(192, 0, 32, 32) + +[sub_resource type="AtlasTexture" id="AtlasTexture_hcxxe"] +atlas = ExtResource("2_kj7um") +region = Rect2(160, 0, 32, 32) + +[sub_resource type="AtlasTexture" id="AtlasTexture_3w7u8"] +atlas = ExtResource("2_kj7um") +region = Rect2(128, 0, 32, 32) + +[sub_resource type="AtlasTexture" id="AtlasTexture_qo2pv"] +atlas = ExtResource("2_kj7um") +region = Rect2(96, 0, 32, 32) + +[sub_resource type="AtlasTexture" id="AtlasTexture_55mlh"] +atlas = ExtResource("2_kj7um") +region = Rect2(64, 0, 32, 32) + +[sub_resource type="AtlasTexture" id="AtlasTexture_3eube"] +atlas = ExtResource("2_kj7um") +region = Rect2(32, 0, 32, 32) + +[sub_resource type="AtlasTexture" id="AtlasTexture_jwwsh"] +atlas = ExtResource("2_kj7um") +region = Rect2(0, 0, 32, 32) + +[sub_resource type="AtlasTexture" id="AtlasTexture_ye4cv"] +atlas = ExtResource("2_kj7um") +region = Rect2(224, 0, 32, 32) + +[sub_resource type="SpriteFrames" id="SpriteFrames_g4ki7"] +animations = [{ +"frames": [{ +"duration": 1.0, +"texture": SubResource("AtlasTexture_hp4ed") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_hcxxe") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_3w7u8") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_qo2pv") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_55mlh") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_3eube") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_jwwsh") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_ye4cv") +}], +"loop": false, +"name": &"default", +"speed": 24.0 +}] + +[sub_resource type="Animation" id="Animation_u2m4c"] +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("AnimatedSprite2D:scale") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0, 0.5), +"transitions": PackedFloat32Array(-2, 1), +"update": 0, +"values": [Vector2(1, 1), Vector2(5, 5)] +} +tracks/1/type = "value" +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/path = NodePath("Label:scale") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/keys = { +"times": PackedFloat32Array(0, 1), +"transitions": PackedFloat32Array(-2, 1), +"update": 0, +"values": [Vector2(1, 1), Vector2(2, 2)] +} +tracks/2/type = "value" +tracks/2/imported = false +tracks/2/enabled = true +tracks/2/path = NodePath("Label:position") +tracks/2/interp = 1 +tracks/2/loop_wrap = true +tracks/2/keys = { +"times": PackedFloat32Array(0, 1), +"transitions": PackedFloat32Array(-2, 1), +"update": 0, +"values": [Vector2(-35, -32), Vector2(-35, -70)] +} + +[sub_resource type="AnimationLibrary" id="AnimationLibrary_8epm6"] +_data = { +"default": SubResource("Animation_u2m4c") +} + +[sub_resource type="Gradient" id="Gradient_mplh3"] +offsets = PackedFloat32Array(0, 0.350746, 1) +colors = PackedColorArray(0.160156, 0.783478, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0) + +[sub_resource type="GradientTexture2D" id="GradientTexture2D_gu7qo"] +gradient = SubResource("Gradient_mplh3") + +[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_5k50n"] +lifetime_randomness = 0.5 +spread = 180.0 +gravity = Vector3(0, 0, 0) +color_ramp = SubResource("GradientTexture2D_gu7qo") + +[node name="Node2D" type="Node2D"] +texture_filter = 1 +script = ExtResource("1_tp8nq") + +[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."] +scale = Vector2(5, 5) +sprite_frames = SubResource("SpriteFrames_g4ki7") +frame = 7 +frame_progress = 1.0 + +[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."] +stream = ExtResource("3_xg6qd") +volume_db = -12.0 +autoplay = true + +[node name="AnimationPlayer" type="AnimationPlayer" parent="."] +libraries = { +"": SubResource("AnimationLibrary_8epm6") +} +autoplay = "default" + +[node name="GPUParticles2D" type="GPUParticles2D" parent="."] +emitting = false +amount = 50 +process_material = SubResource("ParticleProcessMaterial_5k50n") +lifetime = 0.5 +one_shot = true +explosiveness = 1.0 + +[node name="Timer" type="Timer" parent="."] +one_shot = true + +[node name="Label" type="Label" parent="."] +modulate = Color(1.88557, 1.35563, 0.609976, 1) +texture_filter = 1 +offset_left = -35.0 +offset_top = -70.0 +offset_right = 35.0 +offset_bottom = -47.0 +scale = Vector2(2, 2) +pivot_offset = Vector2(35, 8) +theme_override_fonts/font = ExtResource("4_ullf3") +theme_override_font_sizes/font_size = 16 +uppercase = true + +[connection signal="animation_finished" from="AnimatedSprite2D" to="." method="_on_AnimatedSprite1_animation_finished"] +[connection signal="timeout" from="Timer" to="." method="_on_Timer_timeout"] diff --git a/addons/ridiculous_coding/blip.wav b/addons/ridiculous_coding/blip.wav new file mode 100644 index 0000000..b586dde Binary files /dev/null and b/addons/ridiculous_coding/blip.wav differ diff --git a/addons/ridiculous_coding/blip.wav.import b/addons/ridiculous_coding/blip.wav.import new file mode 100644 index 0000000..d906f85 --- /dev/null +++ b/addons/ridiculous_coding/blip.wav.import @@ -0,0 +1,24 @@ +[remap] + +importer="wav" +type="AudioStreamWAV" +uid="uid://b2ood3lkcgpqb" +path="res://.godot/imported/blip.wav-b30aed86048a8d09a6b99458d730bd48.sample" + +[deps] + +source_file="res://addons/ridiculous_coding/blip.wav" +dest_files=["res://.godot/imported/blip.wav-b30aed86048a8d09a6b99458d730bd48.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/addons/ridiculous_coding/boom.gd b/addons/ridiculous_coding/boom.gd new file mode 100644 index 0000000..dcb0236 --- /dev/null +++ b/addons/ridiculous_coding/boom.gd @@ -0,0 +1,29 @@ +@tool +extends Node2D + +var destroy = false +var last_key = "" +var sound = true + +@onready var audio_stream_player: AudioStreamPlayer = $AudioStreamPlayer +@onready var animated_sprite_2d: AnimatedSprite2D = $AnimatedSprite2D +@onready var animation_player: AnimationPlayer = $AnimationPlayer +@onready var timer: Timer = $Timer +@onready var label: Label = $Label + + +func _ready(): + if sound: + audio_stream_player.play() + + animated_sprite_2d.frame = 0 + animated_sprite_2d.play("default") + animation_player.play("default") + timer.start() + label.text = last_key + label.modulate = Color(randf_range(0,2), randf_range(0,2), randf_range(0,2)) + + +func _on_Timer_timeout(): + if destroy: + queue_free() diff --git a/addons/ridiculous_coding/boom.gd.uid b/addons/ridiculous_coding/boom.gd.uid new file mode 100644 index 0000000..f230c7c --- /dev/null +++ b/addons/ridiculous_coding/boom.gd.uid @@ -0,0 +1 @@ +uid://dsr8caekeohe1 diff --git a/addons/ridiculous_coding/boom.png b/addons/ridiculous_coding/boom.png new file mode 100644 index 0000000..7e0ab90 Binary files /dev/null and b/addons/ridiculous_coding/boom.png differ diff --git a/addons/ridiculous_coding/boom.png.import b/addons/ridiculous_coding/boom.png.import new file mode 100644 index 0000000..bb658fc --- /dev/null +++ b/addons/ridiculous_coding/boom.png.import @@ -0,0 +1,40 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://dl75e74oom1i3" +path="res://.godot/imported/boom.png-8824a5a1f762eb053b72081ff54ed1ba.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://addons/ridiculous_coding/boom.png" +dest_files=["res://.godot/imported/boom.png-8824a5a1f762eb053b72081ff54ed1ba.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/addons/ridiculous_coding/boom.tscn b/addons/ridiculous_coding/boom.tscn new file mode 100644 index 0000000..4a87c10 --- /dev/null +++ b/addons/ridiculous_coding/boom.tscn @@ -0,0 +1,135 @@ +[gd_scene load_steps=15 format=3 uid="uid://c4rdv4wkukc5g"] + +[ext_resource type="Texture2D" uid="uid://dl75e74oom1i3" path="res://addons/ridiculous_coding/boom.png" id="1"] +[ext_resource type="AudioStream" uid="uid://b6841f7osi4rh" path="res://addons/ridiculous_coding/boom.wav" id="2"] +[ext_resource type="Script" path="res://addons/ridiculous_coding/boom.gd" id="4"] +[ext_resource type="FontFile" uid="uid://bvwnnnja1ur2i" path="res://addons/ridiculous_coding/font.tres" id="5"] + +[sub_resource type="AtlasTexture" id="AtlasTexture_g3t5t"] +atlas = ExtResource("1") +region = Rect2(0, 0, 128, 128) + +[sub_resource type="AtlasTexture" id="AtlasTexture_4skxo"] +atlas = ExtResource("1") +region = Rect2(128, 0, 128, 128) + +[sub_resource type="AtlasTexture" id="AtlasTexture_ccvbr"] +atlas = ExtResource("1") +region = Rect2(256, 0, 128, 128) + +[sub_resource type="AtlasTexture" id="AtlasTexture_0ojec"] +atlas = ExtResource("1") +region = Rect2(384, 0, 128, 128) + +[sub_resource type="AtlasTexture" id="AtlasTexture_1koxs"] +atlas = ExtResource("1") +region = Rect2(512, 0, 128, 128) + +[sub_resource type="AtlasTexture" id="AtlasTexture_g5t7n"] +atlas = ExtResource("1") +region = Rect2(640, 0, 128, 128) + +[sub_resource type="AtlasTexture" id="AtlasTexture_27xno"] +atlas = ExtResource("1") +region = Rect2(0, 128, 128, 128) + +[sub_resource type="SpriteFrames" id="SpriteFrames_ld5tu"] +animations = [{ +"frames": [{ +"duration": 1.0, +"texture": SubResource("AtlasTexture_g3t5t") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_4skxo") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_ccvbr") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_0ojec") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_1koxs") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_g5t7n") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_27xno") +}], +"loop": false, +"name": &"default", +"speed": 24.0 +}] + +[sub_resource type="Animation" id="Animation_pxf6h"] +resource_name = "default" +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("Label:scale") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0, 1), +"transitions": PackedFloat32Array(-2, 1), +"update": 0, +"values": [Vector2(1, 1), Vector2(2, 2)] +} +tracks/1/type = "value" +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/path = NodePath("Label:position") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/keys = { +"times": PackedFloat32Array(0, 1), +"transitions": PackedFloat32Array(-2, 1), +"update": 0, +"values": [Vector2(-35, -32), Vector2(-35, -70)] +} + +[sub_resource type="AnimationLibrary" id="AnimationLibrary_ocb2c"] +_data = { +"default": SubResource("Animation_pxf6h") +} + +[node name="Node2D" type="Node2D"] +texture_filter = 1 +script = ExtResource("4") + +[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."] +scale = Vector2(0.5, 0.5) +sprite_frames = SubResource("SpriteFrames_ld5tu") +frame = 6 +frame_progress = 1.0 + +[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."] +stream = ExtResource("2") +volume_db = -26.0 +autoplay = true + +[node name="Timer" type="Timer" parent="."] +one_shot = true + +[node name="Label" type="Label" parent="."] +modulate = Color(0.852828, 1.64201, 1.90577, 1) +texture_filter = 1 +offset_left = -35.0 +offset_top = -70.0 +offset_right = 35.0 +offset_bottom = -47.0 +scale = Vector2(2, 2) +pivot_offset = Vector2(35, 8) +theme_override_fonts/font = ExtResource("5") +theme_override_font_sizes/font_size = 16 +uppercase = true + +[node name="AnimationPlayer" type="AnimationPlayer" parent="."] +libraries = { +"": SubResource("AnimationLibrary_ocb2c") +} +autoplay = "default" + +[connection signal="animation_finished" from="AnimatedSprite2D" to="." method="_on_AnimatedSprite_animation_finished"] +[connection signal="timeout" from="Timer" to="." method="_on_Timer_timeout"] diff --git a/addons/ridiculous_coding/boom.wav b/addons/ridiculous_coding/boom.wav new file mode 100644 index 0000000..bd554d3 Binary files /dev/null and b/addons/ridiculous_coding/boom.wav differ diff --git a/addons/ridiculous_coding/boom.wav.import b/addons/ridiculous_coding/boom.wav.import new file mode 100644 index 0000000..b6788a2 --- /dev/null +++ b/addons/ridiculous_coding/boom.wav.import @@ -0,0 +1,24 @@ +[remap] + +importer="wav" +type="AudioStreamWAV" +uid="uid://b6841f7osi4rh" +path="res://.godot/imported/boom.wav-8be8413d6a593a69a88c5aabb324258d.sample" + +[deps] + +source_file="res://addons/ridiculous_coding/boom.wav" +dest_files=["res://.godot/imported/boom.wav-8be8413d6a593a69a88c5aabb324258d.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/addons/ridiculous_coding/dock.gd b/addons/ridiculous_coding/dock.gd new file mode 100644 index 0000000..30cb1d4 --- /dev/null +++ b/addons/ridiculous_coding/dock.gd @@ -0,0 +1,168 @@ +@tool +extends Control + +const BASE_XP: int = 50 +const STATS_FILE: String = "user://ridiculous_xp.ini" + +var explosions: bool = true +var blips: bool = true +var chars: bool = true +var shake: bool = true +var sound: bool = true +var fireworks: bool = true +var xp: int = 0 +var xp_next: int = 2*BASE_XP +var level: int = 1 +var stats: ConfigFile = ConfigFile.new() + +@onready var explosion_checkbox: CheckButton = $VBoxContainer/GridContainer/explosionCheckbox +@onready var blip_checkbox: CheckButton = $VBoxContainer/GridContainer/blipCheckbox +@onready var chars_checkbox: CheckButton = $VBoxContainer/GridContainer/charsCheckbox +@onready var shake_checkbox: CheckButton = $VBoxContainer/GridContainer/shakeCheckbox +@onready var sound_checkbox: CheckButton = $VBoxContainer/GridContainer/soundCheckbox +@onready var fireworks_checkbox: CheckButton = $VBoxContainer/GridContainer/fireworksCheckbox +@onready var progress: TextureProgressBar = $VBoxContainer/XP/ProgressBar +@onready var sfx_fireworks: AudioStreamPlayer = $VBoxContainer/XP/ProgressBar/sfxFireworks +@onready var fireworks_timer: Timer = $VBoxContainer/XP/ProgressBar/fireworksTimer +@onready var fire_particles_one: GPUParticles2D = $VBoxContainer/XP/ProgressBar/fire1/GPUParticles2D +@onready var fire_particles_two: GPUParticles2D = $VBoxContainer/XP/ProgressBar/fire2/GPUParticles2D +@onready var xp_label: Label = $VBoxContainer/XP/HBoxContainer/xpLabel +@onready var level_label: Label = $VBoxContainer/XP/HBoxContainer/levelLabel +@onready var reset_button: Button = $VBoxContainer/CenterContainer/resetButton + + +func _ready(): + reset_button.pressed.connect(on_reset_button_pressed) + + load_checkbox_state() + connect_checkboxes() + fireworks_timer.timeout.connect(stop_fireworks) + load_experience_progress() + update_progress() + stop_fireworks() + + +func load_experience_progress(): + if stats.load(STATS_FILE) == OK: + level = stats.get_value("xp", "level", 1) + xp = stats.get_value("xp", "xp", 0) + else: + level = 1 + xp = 0 + + xp_next = 2*BASE_XP + progress.max_value = xp_next + + for i in range(2,level+1): + xp_next += round(BASE_XP * i / 10.0) * 10 + progress.max_value = round(BASE_XP * level / 10.0) * 10 + + progress.value = xp - (xp_next - progress.max_value) + + +func save_experioence_progress(): + stats.set_value("xp", "level", level) + stats.set_value("xp", "xp", xp) + stats.save(STATS_FILE) + + +func _on_typing(): + xp += 1 + progress.value += 1 + + if progress.value >= progress.max_value: + level += 1 + xp_next = xp + round(BASE_XP * level / 10.0) * 10 + progress.value = 0 + progress.max_value = xp_next - xp + + if fireworks: + start_fireworks() + + save_experioence_progress() + update_progress() + + +func start_fireworks(): + sfx_fireworks.play() + fireworks_timer.start() + + fire_particles_one.emitting = true + fire_particles_two.emitting = true + + +func stop_fireworks(): + fire_particles_one.emitting = false + fire_particles_two.emitting = false + + +func update_progress(): + xp_label.text = "XP: %d / %d" % [ xp, xp_next ] + level_label.text = "Level: %d" % level + + +func connect_checkboxes(): + explosion_checkbox.toggled.connect(func(toggled): + explosions = toggled + save_checkbox_state() + ) + + blip_checkbox.toggled.connect(func(toggled): + blips = toggled + save_checkbox_state() + ) + + chars_checkbox.toggled.connect(func(toggled): + chars = toggled + save_checkbox_state() + ) + + shake_checkbox.toggled.connect(func(toggled): + shake = toggled + save_checkbox_state() + ) + + sound_checkbox.toggled.connect(func(toggled): + sound = toggled + save_checkbox_state() + ) + + fireworks_checkbox.toggled.connect(func(toggled): + fireworks = toggled + save_checkbox_state() + ) + + +func save_checkbox_state(): + stats.set_value("settings", "explosion", explosions) + stats.set_value("settings", "blips", blips) + stats.set_value("settings", "chars", chars) + stats.set_value("settings", "shake", shake) + stats.set_value("settings", "sound", sound) + stats.set_value("settings", "fireworks", fireworks) + stats.save(STATS_FILE) + + +func load_checkbox_state(): + if stats.load(STATS_FILE) == OK: + explosions = stats.get_value("settings", "explosion", true) + blips = stats.get_value("settings", "blips", true) + chars = stats.get_value("settings", "chars", true) + shake = stats.get_value("settings", "shake", true) + sound = stats.get_value("settings", "sound", true) + fireworks = stats.get_value("settings", "fireworks", true) + explosion_checkbox.set_pressed_no_signal(explosions) + blip_checkbox.set_pressed_no_signal(blips) + chars_checkbox.set_pressed_no_signal(chars) + shake_checkbox.set_pressed_no_signal(shake) + sound_checkbox.set_pressed_no_signal(sound) + fireworks_checkbox.set_pressed_no_signal(fireworks) + + +func on_reset_button_pressed(): + level = 1 + xp = 0 + xp_next = 2*BASE_XP + progress.value = 0 + progress.max_value = xp_next + update_progress() diff --git a/addons/ridiculous_coding/dock.gd.uid b/addons/ridiculous_coding/dock.gd.uid new file mode 100644 index 0000000..0b3350a --- /dev/null +++ b/addons/ridiculous_coding/dock.gd.uid @@ -0,0 +1 @@ +uid://bgkldbljaarko diff --git a/addons/ridiculous_coding/dock.tscn b/addons/ridiculous_coding/dock.tscn new file mode 100644 index 0000000..b4a5dc0 --- /dev/null +++ b/addons/ridiculous_coding/dock.tscn @@ -0,0 +1,149 @@ +[gd_scene load_steps=8 format=3 uid="uid://b76vnt4rv4p0q"] + +[ext_resource type="Script" path="res://addons/ridiculous_coding/dock.gd" id="1_bwupq"] +[ext_resource type="Texture2D" uid="uid://c3ltnrdrb2qmg" path="res://addons/ridiculous_coding/under.png" id="3_vdb3k"] +[ext_resource type="AudioStream" uid="uid://g6lh6kjt0ynq" path="res://addons/ridiculous_coding/fireworks.wav" id="4_1o4lv"] +[ext_resource type="Texture2D" uid="uid://dmvuvaqf5uhwi" path="res://addons/ridiculous_coding/progress.png" id="4_y2kl4"] + +[sub_resource type="Gradient" id="Gradient_v1eyn"] +offsets = PackedFloat32Array(0, 0.419689, 0.715026, 1) +colors = PackedColorArray(1, 1, 1, 1, 0.979167, 1, 0.333333, 1, 1, 0, 0, 1, 1, 1, 1, 0) + +[sub_resource type="GradientTexture2D" id="GradientTexture2D_6lmfn"] +gradient = SubResource("Gradient_v1eyn") + +[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_x4b51"] +lifetime_randomness = 0.29 +spread = 20.0 +gravity = Vector3(0, 300, 0) +initial_velocity_min = 400.0 +initial_velocity_max = 400.0 +scale_min = 5.0 +scale_max = 6.0 +color_ramp = SubResource("GradientTexture2D_6lmfn") + +[node name="Ridiculous Coding Dock" type="Control"] +custom_minimum_size = Vector2(300, 175) +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +script = ExtResource("1_bwupq") + +[node name="VBoxContainer" type="VBoxContainer" parent="."] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 + +[node name="XP" type="VBoxContainer" parent="VBoxContainer"] +layout_mode = 2 + +[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer/XP"] +layout_mode = 2 + +[node name="xpLabel" type="Label" parent="VBoxContainer/XP/HBoxContainer"] +layout_mode = 2 +size_flags_horizontal = 3 +text = "XP: 201 / 350" + +[node name="levelLabel" type="Label" parent="VBoxContainer/XP/HBoxContainer"] +layout_mode = 2 +size_flags_horizontal = 3 +text = "Level: 3" +horizontal_alignment = 2 + +[node name="ProgressBar" type="TextureProgressBar" parent="VBoxContainer/XP"] +custom_minimum_size = Vector2(0, 10) +layout_mode = 2 +max_value = 150.0 +value = 1.0 +nine_patch_stretch = true +texture_under = ExtResource("3_vdb3k") +texture_progress = ExtResource("4_y2kl4") + +[node name="fire1" type="Control" parent="VBoxContainer/XP/ProgressBar"] +layout_mode = 1 +anchors_preset = 0 +offset_right = 40.0 +offset_bottom = 40.0 + +[node name="GPUParticles2D" type="GPUParticles2D" parent="VBoxContainer/XP/ProgressBar/fire1"] +rotation = -0.785397 +emitting = false +amount = 200 +process_material = SubResource("ParticleProcessMaterial_x4b51") + +[node name="fire2" type="Control" parent="VBoxContainer/XP/ProgressBar"] +layout_mode = 1 +anchors_preset = 1 +anchor_left = 1.0 +anchor_right = 1.0 +offset_top = 8.0 +offset_right = 40.0 +offset_bottom = 48.0 +grow_horizontal = 0 + +[node name="GPUParticles2D" type="GPUParticles2D" parent="VBoxContainer/XP/ProgressBar/fire2"] +rotation = -2.35619 +emitting = false +amount = 200 +process_material = SubResource("ParticleProcessMaterial_x4b51") + +[node name="fireworksTimer" type="Timer" parent="VBoxContainer/XP/ProgressBar"] +wait_time = 3.0 + +[node name="sfxFireworks" type="AudioStreamPlayer" parent="VBoxContainer/XP/ProgressBar"] +stream = ExtResource("4_1o4lv") +volume_db = -12.0 + +[node name="GridContainer" type="GridContainer" parent="VBoxContainer"] +layout_mode = 2 +columns = 2 + +[node name="explosionCheckbox" type="CheckButton" parent="VBoxContainer/GridContainer"] +layout_mode = 2 +size_flags_horizontal = 11 +button_pressed = true +text = "Explosions" + +[node name="shakeCheckbox" type="CheckButton" parent="VBoxContainer/GridContainer"] +layout_mode = 2 +size_flags_horizontal = 11 +button_pressed = true +text = "Shake" + +[node name="blipCheckbox" type="CheckButton" parent="VBoxContainer/GridContainer"] +layout_mode = 2 +size_flags_horizontal = 11 +button_pressed = true +text = "Blips" + +[node name="charsCheckbox" type="CheckButton" parent="VBoxContainer/GridContainer"] +layout_mode = 2 +size_flags_horizontal = 11 +button_pressed = true +text = "Keys" + +[node name="soundCheckbox" type="CheckButton" parent="VBoxContainer/GridContainer"] +layout_mode = 2 +size_flags_horizontal = 11 +button_pressed = true +text = "Sound" + +[node name="fireworksCheckbox" type="CheckButton" parent="VBoxContainer/GridContainer"] +layout_mode = 2 +size_flags_horizontal = 11 +button_pressed = true +text = "Fireworks" + +[node name="CenterContainer" type="CenterContainer" parent="VBoxContainer"] +layout_mode = 2 + +[node name="resetButton" type="Button" parent="VBoxContainer/CenterContainer"] +layout_mode = 2 +text = "Reset" diff --git a/addons/ridiculous_coding/fireworks.wav b/addons/ridiculous_coding/fireworks.wav new file mode 100644 index 0000000..a2763d7 Binary files /dev/null and b/addons/ridiculous_coding/fireworks.wav differ diff --git a/addons/ridiculous_coding/fireworks.wav.import b/addons/ridiculous_coding/fireworks.wav.import new file mode 100644 index 0000000..0b01a13 --- /dev/null +++ b/addons/ridiculous_coding/fireworks.wav.import @@ -0,0 +1,24 @@ +[remap] + +importer="wav" +type="AudioStreamWAV" +uid="uid://dyi5lstxrfkdt" +path="res://.godot/imported/fireworks.wav-f51025571a3b9e32e6113159ed26c3be.sample" + +[deps] + +source_file="res://addons/ridiculous_coding/fireworks.wav" +dest_files=["res://.godot/imported/fireworks.wav-f51025571a3b9e32e6113159ed26c3be.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/addons/ridiculous_coding/font.tres b/addons/ridiculous_coding/font.tres new file mode 100644 index 0000000..35e2b1d --- /dev/null +++ b/addons/ridiculous_coding/font.tres @@ -0,0 +1,42 @@ +[gd_resource type="FontFile" load_steps=2 format=3 uid="uid://bvwnnnja1ur2i"] + +[ext_resource type="FontFile" uid="uid://coiaqb8xwuaic" path="res://addons/ridiculous_coding/GravityBold8.ttf" id="1"] + +[resource] +fallbacks = Array[Font]([ExtResource("1")]) +cache/0/16/0/ascent = 0.0 +cache/0/16/0/descent = 0.0 +cache/0/16/0/underline_position = 0.0 +cache/0/16/0/underline_thickness = 0.0 +cache/0/16/0/scale = 1.0 +cache/0/16/0/kerning_overrides/16/0 = Vector2(0, 0) +cache/0/16/0/kerning_overrides/50/0 = Vector2(0, 0) +cache/0/16/0/kerning_overrides/28/0 = Vector2(0, 0) +cache/0/16/0/kerning_overrides/14/0 = Vector2(0, 0) +cache/0/50/0/ascent = 0.0 +cache/0/50/0/descent = 0.0 +cache/0/50/0/underline_position = 0.0 +cache/0/50/0/underline_thickness = 0.0 +cache/0/50/0/scale = 1.0 +cache/0/50/0/kerning_overrides/16/0 = Vector2(0, 0) +cache/0/50/0/kerning_overrides/50/0 = Vector2(0, 0) +cache/0/50/0/kerning_overrides/28/0 = Vector2(0, 0) +cache/0/50/0/kerning_overrides/14/0 = Vector2(0, 0) +cache/0/28/0/ascent = 0.0 +cache/0/28/0/descent = 0.0 +cache/0/28/0/underline_position = 0.0 +cache/0/28/0/underline_thickness = 0.0 +cache/0/28/0/scale = 1.0 +cache/0/28/0/kerning_overrides/16/0 = Vector2(0, 0) +cache/0/28/0/kerning_overrides/50/0 = Vector2(0, 0) +cache/0/28/0/kerning_overrides/28/0 = Vector2(0, 0) +cache/0/28/0/kerning_overrides/14/0 = Vector2(0, 0) +cache/0/14/0/ascent = 0.0 +cache/0/14/0/descent = 0.0 +cache/0/14/0/underline_position = 0.0 +cache/0/14/0/underline_thickness = 0.0 +cache/0/14/0/scale = 1.0 +cache/0/14/0/kerning_overrides/16/0 = Vector2(0, 0) +cache/0/14/0/kerning_overrides/50/0 = Vector2(0, 0) +cache/0/14/0/kerning_overrides/28/0 = Vector2(0, 0) +cache/0/14/0/kerning_overrides/14/0 = Vector2(0, 0) diff --git a/addons/ridiculous_coding/newline.gd b/addons/ridiculous_coding/newline.gd new file mode 100644 index 0000000..4e910aa --- /dev/null +++ b/addons/ridiculous_coding/newline.gd @@ -0,0 +1,24 @@ +@tool +extends Node2D + +var destroy = false +var blips = true + +@onready var animation_player: AnimationPlayer = $AnimationPlayer +@onready var animated_sprite_2d: AnimatedSprite2D = $AnimatedSprite2D +@onready var timer: Timer = $Timer + + +func _ready(): + if blips: + animation_player.stop() + animation_player.play("default") + animated_sprite_2d.frame = 0 + animated_sprite_2d.play("default") + + timer.start() + + +func _on_Timer_timeout(): + if destroy: + queue_free() diff --git a/addons/ridiculous_coding/newline.gd.uid b/addons/ridiculous_coding/newline.gd.uid new file mode 100644 index 0000000..ff63625 --- /dev/null +++ b/addons/ridiculous_coding/newline.gd.uid @@ -0,0 +1 @@ +uid://2qwy1xxw7b52 diff --git a/addons/ridiculous_coding/newline.png b/addons/ridiculous_coding/newline.png new file mode 100644 index 0000000..95cae82 Binary files /dev/null and b/addons/ridiculous_coding/newline.png differ diff --git a/addons/ridiculous_coding/newline.png.import b/addons/ridiculous_coding/newline.png.import new file mode 100644 index 0000000..7ec8d43 --- /dev/null +++ b/addons/ridiculous_coding/newline.png.import @@ -0,0 +1,40 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://b1vn1823wqae2" +path="res://.godot/imported/newline.png-03ec198c1b51eb116216995dcb893beb.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://addons/ridiculous_coding/newline.png" +dest_files=["res://.godot/imported/newline.png-03ec198c1b51eb116216995dcb893beb.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/addons/ridiculous_coding/newline.tscn b/addons/ridiculous_coding/newline.tscn new file mode 100644 index 0000000..87fd614 --- /dev/null +++ b/addons/ridiculous_coding/newline.tscn @@ -0,0 +1,89 @@ +[gd_scene load_steps=11 format=3 uid="uid://wd4tkg0uxd18"] + +[ext_resource type="Script" path="res://addons/ridiculous_coding/newline.gd" id="1"] +[ext_resource type="Texture2D" uid="uid://b1vn1823wqae2" path="res://addons/ridiculous_coding/newline.png" id="2"] + +[sub_resource type="AtlasTexture" id="1"] +atlas = ExtResource("2") +region = Rect2(0, 0, 64, 64) + +[sub_resource type="AtlasTexture" id="2"] +atlas = ExtResource("2") +region = Rect2(64, 0, 64, 64) + +[sub_resource type="AtlasTexture" id="3"] +atlas = ExtResource("2") +region = Rect2(128, 0, 64, 64) + +[sub_resource type="AtlasTexture" id="4"] +atlas = ExtResource("2") +region = Rect2(192, 0, 64, 64) + +[sub_resource type="AtlasTexture" id="5"] +atlas = ExtResource("2") +region = Rect2(256, 0, 64, 64) + +[sub_resource type="SpriteFrames" id="6"] +animations = [{ +"frames": [{ +"duration": 1.0, +"texture": SubResource("1") +}, { +"duration": 1.0, +"texture": SubResource("2") +}, { +"duration": 1.0, +"texture": SubResource("3") +}, { +"duration": 1.0, +"texture": SubResource("4") +}, { +"duration": 1.0, +"texture": SubResource("5") +}], +"loop": true, +"name": &"default", +"speed": 12.0 +}] + +[sub_resource type="Animation" id="7"] +resource_name = "default" +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("AnimatedSprite2D:position") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0, 0.1), +"transitions": PackedFloat32Array(0.233258, 1), +"update": 0, +"values": [Vector2(-200, 0), Vector2(-50, 0)] +} + +[sub_resource type="AnimationLibrary" id="AnimationLibrary_gwr1r"] +_data = { +"default": SubResource("7") +} + +[node name="Node2D" type="Node2D"] +texture_filter = 1 +script = ExtResource("1") + +[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."] +position = Vector2(-50, 0) +rotation = -1.57079 +scale = Vector2(2, 2) +sprite_frames = SubResource("6") +frame_progress = 0.432846 + +[node name="Timer" type="Timer" parent="."] +one_shot = true + +[node name="AnimationPlayer" type="AnimationPlayer" parent="."] +libraries = { +"": SubResource("AnimationLibrary_gwr1r") +} +autoplay = "default" + +[connection signal="timeout" from="Timer" to="." method="_on_Timer_timeout"] diff --git a/addons/ridiculous_coding/plugin.cfg b/addons/ridiculous_coding/plugin.cfg new file mode 100644 index 0000000..6638258 --- /dev/null +++ b/addons/ridiculous_coding/plugin.cfg @@ -0,0 +1,8 @@ +[plugin] + +name="Ridiculous Coding - Godot 4" +description="Ridiculous screen-shakey coding inspired by Textreme https://ash-k.itch.io/textreme-2" +author="John Watson" +version="2021.11.28" +script="plugin.gd" +constributors="Jeferson 'Shin' Leite Borges" diff --git a/addons/ridiculous_coding/plugin.gd b/addons/ridiculous_coding/plugin.gd new file mode 100644 index 0000000..22ce636 --- /dev/null +++ b/addons/ridiculous_coding/plugin.gd @@ -0,0 +1,170 @@ +@tool +extends EditorPlugin + +signal typing + +# Scenes preloaded +const Boom: PackedScene = preload("res://addons/ridiculous_coding/boom.tscn") +const Blip: PackedScene = preload("res://addons/ridiculous_coding/blip.tscn") +const Newline: PackedScene = preload("res://addons/ridiculous_coding/newline.tscn") +const Dock: PackedScene = preload("res://addons/ridiculous_coding/dock.tscn") + +# Inner Variables +const PITCH_DECREMENT := 2.0 + +var shake: float = 0.0 +var shake_intensity:float = 0.0 +var timer: float = 0.0 +var last_key: String = "" +var pitch_increase: float = 0.0 +var editors = {} +var dock + + +func _enter_tree(): + var editor: EditorInterface = get_editor_interface() + var script_editor: ScriptEditor = editor.get_script_editor() + script_editor.editor_script_changed.connect(editor_script_changed) + + # Add the main panel + dock = Dock.instantiate() + typing.connect(Callable(dock,"_on_typing")) + add_control_to_dock(DOCK_SLOT_RIGHT_BL, dock) + + +func _exit_tree(): + if dock: + remove_control_from_docks(dock) + dock.free() + + +func get_all_text_editors(parent : Node): + for child in parent.get_children(): + if child.get_child_count(): + get_all_text_editors(child) + + if child is TextEdit: + editors[child] = { + "text": child.text, + "line": child.get_caret_line() + } + + if child.caret_changed.is_connected(caret_changed): + child.caret_changed.disconnect(caret_changed) + child.caret_changed.connect(caret_changed.bind(child)) + + if child.text_changed.is_connected(text_changed): + child.text_changed.disconnect(text_changed) + child.text_changed.connect(text_changed.bind(child)) + + if child.gui_input.is_connected(gui_input): + child.gui_input.disconnect(gui_input) + child.gui_input.connect(gui_input) + + +func gui_input(event): + # Get last key typed + if event is InputEventKey and event.pressed: + event = event as InputEventKey + last_key = OS.get_keycode_string(event.get_keycode_with_modifiers()) + + +func editor_script_changed(script): + var editor = get_editor_interface() + var script_editor = editor.get_script_editor() + + editors.clear() + get_all_text_editors(script_editor) + + +func _process(delta): + var editor = get_editor_interface() + + if shake > 0: + shake -= delta + editor.get_base_control().position = Vector2(randf_range(-shake_intensity,shake_intensity), randf_range(-shake_intensity,shake_intensity)) + else: + editor.get_base_control().position = Vector2.ZERO + + timer += delta + if (pitch_increase > 0.0): + pitch_increase -= delta * PITCH_DECREMENT + + +func shake_screen(duration, intensity): + if shake > 0: + return + + shake = duration + shake_intensity = intensity + + +func caret_changed(textedit): + var editor = get_editor_interface() + + if not editors.has(textedit): + # For some reason the editor instances all change + # when the file is saved so you need to reload them + editors.clear() + get_all_text_editors(editor.get_script_editor()) + + editors[textedit]["line"] = textedit.get_caret_line() + + +func text_changed(textedit : TextEdit): + var line_height = textedit.get_line_height() + var pos = textedit.get_caret_draw_pos() + Vector2(0,-line_height/2.0) + emit_signal("typing") + + if editors.has(textedit): + # Deleting + if timer > 0.1 and len(textedit.text) < len(editors[textedit]["text"]): + timer = 0.0 + + if dock.explosions: + # Draw the thing + var thing = Boom.instantiate() + thing.position = pos + thing.destroy = true + if dock.chars: thing.last_key = last_key + thing.sound = dock.sound + textedit.add_child(thing) + + if dock.shake: + # Shake + shake_screen(0.2, 10) + + # Typing + if timer > 0.02 and len(textedit.text) >= len(editors[textedit]["text"]): + timer = 0.0 + + # Draw the thing + var thing = Blip.instantiate() + thing.pitch_increase = pitch_increase + pitch_increase += 1.0 + thing.position = pos + thing.destroy = true + thing.blips = dock.blips + if dock.chars: thing.last_key = last_key + thing.sound = dock.sound + textedit.add_child(thing) + + if dock.shake: + # Shake + shake_screen(0.05, 5) + + # Newline + if textedit.get_caret_line() != editors[textedit]["line"]: + # Draw the thing + var thing = Newline.instantiate() + thing.position = pos + thing.destroy = true + thing.blips = dock.blips + textedit.add_child(thing) + + if dock.shake: + # Shake + shake_screen(0.05, 5) + + editors[textedit]["text"] = textedit.text + editors[textedit]["line"] = textedit.get_caret_line() diff --git a/addons/ridiculous_coding/plugin.gd.uid b/addons/ridiculous_coding/plugin.gd.uid new file mode 100644 index 0000000..5fe3155 --- /dev/null +++ b/addons/ridiculous_coding/plugin.gd.uid @@ -0,0 +1 @@ +uid://b1j6gci7b6cw8 diff --git a/addons/ridiculous_coding/progress.png b/addons/ridiculous_coding/progress.png new file mode 100644 index 0000000..04dc8a0 Binary files /dev/null and b/addons/ridiculous_coding/progress.png differ diff --git a/addons/ridiculous_coding/progress.png.import b/addons/ridiculous_coding/progress.png.import new file mode 100644 index 0000000..9318fab --- /dev/null +++ b/addons/ridiculous_coding/progress.png.import @@ -0,0 +1,40 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://dqpxh1bccjaae" +path="res://.godot/imported/progress.png-7f475b7e84ff0c0c87db61c1f97b4978.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://addons/ridiculous_coding/progress.png" +dest_files=["res://.godot/imported/progress.png-7f475b7e84ff0c0c87db61c1f97b4978.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/addons/ridiculous_coding/under.png b/addons/ridiculous_coding/under.png new file mode 100644 index 0000000..eecb866 Binary files /dev/null and b/addons/ridiculous_coding/under.png differ diff --git a/addons/ridiculous_coding/under.png.import b/addons/ridiculous_coding/under.png.import new file mode 100644 index 0000000..30d8e7b --- /dev/null +++ b/addons/ridiculous_coding/under.png.import @@ -0,0 +1,40 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://dgda8elabipl5" +path="res://.godot/imported/under.png-b737211ee1ab1b3c04a4062a02353851.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://addons/ridiculous_coding/under.png" +dest_files=["res://.godot/imported/under.png-b737211ee1ab1b3c04a4062a02353851.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/project.godot b/project.godot index cd589d8..bd06016 100644 --- a/project.godot +++ b/project.godot @@ -23,10 +23,18 @@ settings/stdout/print_fps=true settings/addon_root_folder="res://addons/debug_draw_3d" +[display] + +window/vsync/vsync_mode=0 + [editor] version_control/autoload_on_startup=true +[editor_plugins] + +enabled=PackedStringArray("res://addons/ridiculous_coding/plugin.cfg") + [gui] common/drop_mouse_on_gui_input_disabled=true diff --git a/smooth_world.gd b/smooth_world.gd index 2d31136..540a1db 100644 --- a/smooth_world.gd +++ b/smooth_world.gd @@ -12,6 +12,8 @@ var gpu_sdf var generate_mesh_shader = preload("res://generate_mesh.tres") +var regenerate_mesh = false + @export var world_size = 16 @export var show_sample_points = false @@ -36,18 +38,23 @@ func _ready() -> void: add_child(meshinstance) gpu_sdf = ComputeSdf.new() gpu_sdf.create_device() - -func _process(_delta: float) -> void: - clear() var dictionaries = gpu_sdf.compute(world_size, RADIUS) surface_points = dictionaries.surface_points_dict sample_points = dictionaries.sample_points_dict + create_surface_mesh() + +func _process(_delta: float) -> void: + if !surface_points.is_empty(): #create_surface_points_gpu() #create_surface_points() if show_surface_points: draw_surface_points() - if show_surface: + if show_surface && regenerate_mesh: + clear() + var dictionaries = gpu_sdf.compute(world_size, RADIUS) + surface_points = dictionaries.surface_points_dict + sample_points = dictionaries.sample_points_dict create_surface_mesh() if show_sample_points: draw_sample_points() @@ -55,6 +62,7 @@ func _process(_delta: float) -> void: func clear(): surface_points = {} + sample_points = {} mesh = ArrayMesh.new() diff --git a/smooth_world.tscn b/smooth_world.tscn index cc6d5ac..a0d11a7 100644 --- a/smooth_world.tscn +++ b/smooth_world.tscn @@ -9,7 +9,8 @@ shader = ExtResource("2_an62b") [node name="SmoothWorld" type="Node3D"] script = ExtResource("1_4h467") -RADIUS = 6.789 +RADIUS = 18.524 +world_size = 39 [node name="MeshInstance3D" type="MeshInstance3D" parent="."] material_override = SubResource("ShaderMaterial_iutkt")