Added color modulated background

This commit is contained in:
Melvin Weiß 2025-09-24 17:43:16 +02:00
parent 8740b632a1
commit beb0b697ea
5 changed files with 18 additions and 2 deletions

11
bg_image.gd Normal file
View file

@ -0,0 +1,11 @@
extends TextureRect
@export var colors : Array[Color] = [Color(0.3, 1, 1) * 0.7, Color(1, 0.6, 0.6) * 0.7, Color(1, 1, 1) * 0.7]
func _process(_delta: float) -> void:
var index : int = floor((%Player.position.angle() + PI)/ TAU * colors.size())
var diff = (%Player.position.angle() + PI)/ TAU * colors.size() - index
self.modulate = linear_color_interpolation(colors[index], colors[(index + 1) % colors.size()], diff)
func linear_color_interpolation(c1 : Color, c2 : Color, t : float):
return c1 + (c2 - c1) * t

1
bg_image.gd.uid Normal file
View file

@ -0,0 +1 @@
uid://gul4u5tw1vxk

View file

@ -37,6 +37,7 @@ script = ExtResource("1_6attn")
[node name="EnemyHurtbox" parent="." node_paths=PackedStringArray("canvasItem") instance=ExtResource("2_34o1m")]
max_hp = 50
canvasItem = NodePath("..")
id_block_time = 0.2
[node name="CollisionShape2D" type="CollisionShape2D" parent="EnemyHurtbox"]
scale = Vector2(6, 6)

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=15 format=3 uid="uid://cxo6bq26huau7"]
[gd_scene load_steps=16 format=3 uid="uid://cxo6bq26huau7"]
[ext_resource type="PackedScene" uid="uid://cmaovvr15b3qk" path="res://player/player.tscn" id="2_1bvp3"]
[ext_resource type="Texture2D" uid="uid://d3fpq76anm4t7" path="res://world/Background Prototype/Background prototype.png" id="3_kek77"]
@ -14,6 +14,7 @@
[ext_resource type="Script" uid="uid://cpaskpj67pnaj" path="res://enemies/boss/boss_spawner.gd" id="10_efxa6"]
[ext_resource type="PackedScene" uid="uid://cqn67nwyrtq3k" path="res://ui/journal/journal.tscn" id="10_w48qg"]
[ext_resource type="PackedScene" uid="uid://cpe4s6vsn0ujd" path="res://enemies/boss/boss.tscn" id="11_efxa6"]
[ext_resource type="Script" uid="uid://gul4u5tw1vxk" path="res://bg_image.gd" id="13_vivmo"]
[node name="main" type="Node2D"]
@ -87,6 +88,8 @@ anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
texture = ExtResource("3_kek77")
script = ExtResource("13_vivmo")
colors = Array[Color]([Color(0, 0.6441987, 0.6693053, 1), Color(0.90588236, 0.15686275, 0.21176471, 0.60784316), Color(0.69803923, 0.69803923, 0.69803923, 1)])
[node name="BossSpawner" type="Node" parent="."]
script = ExtResource("10_efxa6")

View file

@ -1,4 +1,4 @@
extends Label
func _process(_delta):
set_text("FPS " + str(Engine.get_frames_per_second()))
set_text("FPS " + str(Engine.get_frames_per_second()) + ", ANGLE " + str(floor((%Player.position.angle() + PI) / TAU * 360)))