developpement d'écran de chargement et d'écran de sélection de niveau
* modification de certains assets * optimisation de chunks * ajout d'un SceneManager * ajout d'un premier dialogue avec Demeter * changement des jour en charge * mise en place d'un système de run * etc...
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
[gd_scene load_steps=17 format=3 uid="uid://csiacsndm62ll"]
|
||||
|
||||
[ext_resource type="Theme" uid="uid://bgcmd213j6gk1" path="res://gui/ressources/default_theme.tres" id="1_51ks3"]
|
||||
[ext_resource type="Theme" uid="uid://bgcmd213j6gk1" path="res://gui/ressources/hud.tres" id="1_51ks3"]
|
||||
[ext_resource type="Script" uid="uid://crt2d4m5ba25i" path="res://gui/game/pause/scripts/pause.gd" id="1_he4ox"]
|
||||
[ext_resource type="Shader" uid="uid://cuni3ggtw2uuy" path="res://gui/game/pause/resources/blur.gdshader" id="2_apjlw"]
|
||||
[ext_resource type="Shader" uid="uid://cuni3ggtw2uuy" path="res://common/vfx/materials/shaders/blur.gdshader" id="2_apjlw"]
|
||||
[ext_resource type="PackedScene" uid="uid://g6lbgg1fhc25" path="res://gui/menu/settings/settings.tscn" id="4_58dya"]
|
||||
[ext_resource type="FontFile" uid="uid://qt80w6o01q5s" path="res://gui/ressources/fonts/TitanOne-Regular.ttf" id="4_apjlw"]
|
||||
[ext_resource type="Texture2D" uid="uid://vmsn54d1ptih" path="res://common/icons/player-play.svg" id="5_apjlw"]
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
shader_type canvas_item;
|
||||
|
||||
uniform sampler2D SCREEN_TEXTURE: hint_screen_texture,repeat_disable, filter_nearest;
|
||||
/**
|
||||
* How blurry the result should be.
|
||||
* Limited to 20 because of performance, if you want feel free to break it.
|
||||
*/
|
||||
uniform float strength : hint_range(0.1, 20.0) = 3.3;
|
||||
/**
|
||||
* How dark the blur will be
|
||||
*/
|
||||
uniform float mix_percentage: hint_range(0.0, 1.0) = 0.3;
|
||||
|
||||
float gaussianDistribution(float x, float STD){ // STD stands for standard deviation
|
||||
return exp(-(x*x)/(2.*STD*STD))/(sqrt(2.*PI)*STD);
|
||||
}
|
||||
|
||||
vec3 gaussianblur(sampler2D sampler, vec2 pos, vec2 pixel_size, float sigmaUsed, int radius){
|
||||
vec3 blurredPixel = vec3(0.0);
|
||||
float total_weight = 0.0;
|
||||
// Loop over the radius (tecnically its a square)
|
||||
for(int i = -radius ; i <= radius; i++){
|
||||
for(int j = -radius; j <= radius; j++){
|
||||
// Calculate the offset from the current pixel
|
||||
vec2 offset = vec2(float(i), float(j))*pixel_size;
|
||||
vec2 changedPos = pos + offset;
|
||||
|
||||
// Calculate the weight based on the Gaussian distribution multiplying both dimentions (how far are X and Y form the center (pos))
|
||||
float weight = gaussianDistribution(float(i), sigmaUsed)*gaussianDistribution(float(j), sigmaUsed);
|
||||
// Add the weighted color value to the blurred pixel
|
||||
blurredPixel += texture(SCREEN_TEXTURE, changedPos).rgb * weight;
|
||||
total_weight += weight;
|
||||
}
|
||||
}
|
||||
// Normalize the blurred pixel color by the total weight
|
||||
blurredPixel/=total_weight;
|
||||
return blurredPixel;
|
||||
}
|
||||
void fragment() {
|
||||
vec3 PixelBlurred = gaussianblur(SCREEN_TEXTURE, SCREEN_UV, SCREEN_PIXEL_SIZE, strength, int(round(3.0 * strength)));
|
||||
vec3 color = mix(PixelBlurred, vec3(0.0), mix_percentage);
|
||||
// The radius is 3*strength because it is the point where the Gaussian weight is near zero.
|
||||
COLOR = vec4(color, 1.);
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
uid://cuni3ggtw2uuy
|
||||
@@ -2,39 +2,37 @@ extends CanvasLayer
|
||||
|
||||
var pause = false : set = set_pause
|
||||
|
||||
const PLANET_RUN_SCENE = preload("res://stages/planet_run/planet_run.tscn")
|
||||
|
||||
func set_pause(p):
|
||||
if p != pause:
|
||||
if p:
|
||||
%AnimationPlayer.play("pause")
|
||||
else:
|
||||
%AnimationPlayer.play_backwards("pause")
|
||||
pause = p
|
||||
get_tree().paused = pause
|
||||
%Settings.close_settings()
|
||||
%Controls.close_controls()
|
||||
if p != pause:
|
||||
if p:
|
||||
%AnimationPlayer.play("pause")
|
||||
else:
|
||||
%AnimationPlayer.play_backwards("pause")
|
||||
pause = p
|
||||
get_tree().paused = pause
|
||||
%Settings.close_settings()
|
||||
%Controls.close_controls()
|
||||
|
||||
func _input(_event):
|
||||
if Input.is_action_just_pressed("pause"):
|
||||
pause = not pause
|
||||
if Input.is_action_just_pressed("pause"):
|
||||
pause = not pause
|
||||
|
||||
func _on_resume_pressed():
|
||||
pause = false
|
||||
pause = false
|
||||
|
||||
func _on_restart_pressed():
|
||||
GameInfo.game_data.reset_all()
|
||||
pause = false
|
||||
get_tree().change_scene_to_packed(PLANET_RUN_SCENE)
|
||||
GameInfo.game_data.reset_all()
|
||||
pause = false
|
||||
SceneManager.change_scene(SceneManager.REGION_SELECTION_SCREEN)
|
||||
|
||||
func _on_quit_pressed():
|
||||
get_tree().quit()
|
||||
get_tree().quit()
|
||||
|
||||
func _on_game_gui_pause_asked():
|
||||
pause = true
|
||||
pause = true
|
||||
|
||||
func _on_settings_pressed():
|
||||
%Settings.open_settings()
|
||||
%Settings.open_settings()
|
||||
|
||||
func _on_controls_pressed():
|
||||
%Controls.open_controls()
|
||||
%Controls.open_controls()
|
||||
|
||||
Reference in New Issue
Block a user