Skip to content

Instantly share code, notes, and snippets.

@cenullum
cenullum / Debug.gd
Last active August 29, 2022 19:12
To make console commands and show stats in Godot Engine projects
extends Node
#You need to set "console" and "stats" keys to input map
#The video about how to implement to your project https://youtu.be/klaxiaQ94Zc
#UI
var canvaslayer
var color_rect#black background
var debug_output
var debug_tween
var left_label
@cenullum
cenullum / circle.shader
Created October 18, 2020 16:30
Godot Engine Circle with Outline Color Shader
shader_type canvas_item;
uniform vec4 outline_color:hint_color = vec4(1.0,1.0,0.0,1.0);
uniform float inner_circle=0.45;
uniform float outer_circle=0.5;
const vec4 alpha_color= vec4(0,0,0,0);
uniform float smoothness=0.01;
@cenullum
cenullum / Infinite_loop_with_delta_time.js
Last active August 28, 2022 00:34
Javascript Infinite Loop with Delta Time
var lastUpdate = Date.now();
var lastFixed = Date.now();
var fixedTimer=0.02;
var updateInterval = setInterval(tick, 0);
var fixedInterval = setInterval(fixedTick,fixedTimer);
function tick() {
var now = Date.now();
@cenullum
cenullum / hole.shader
Last active April 7, 2020 16:56
Rectangle Hole Godot Engine Shader
shader_type canvas_item;
uniform vec2 size;
uniform vec2 scale;
uniform vec2 position;
vec2 uv(vec2 uv) {
vec2 s = vec2(size.x / scale.x, size.x / scale.y);
vec2 p = vec2(position.x / (size.x / s.x), position.y / (size.y / s.y));
vec2 result = vec2(uv.x * s.x - p.x, uv.y * s.y - p.y);