Skip to content

Instantly share code, notes, and snippets.

View eka's full-sized avatar
🏠
Working from home

Esteban Feldman eka

🏠
Working from home
View GitHub Profile
@eka
eka / gdlogger.gd
Last active June 20, 2024 07:19
Small Print wrapper for Godot that includes time and time in ms since play started - Add this to Autoload to use as Singleton
extends Node
func log(message: String) -> void:
print("-> %s %s %s " % [Time.get_time_string_from_system(), str(Time.get_ticks_msec()), message])
func _ready() -> void:
GDLogger.log("Logger services ready")
@eka
eka / SoundResource.cs
Last active April 30, 2024 07:15
Resource for cllients to play sounds and send to the AudioManager via GameEventsManager
using System.Linq;
using Godot;
using Godot.Collections;
public partial class SoundResource : Resource
{
[Export] public string Id { get; set; }
[Export] public AudioStream AudioStream { get; set; }
}
@eka
eka / GameEventsManager.cs
Last active May 29, 2024 13:12
EventBus for Godot Use in Autoload
using Godot;
using System;
public partial class GameEventsManager : Node
{
private static GameEventsManager _instance;
public static GameEventsManager Instance => _instance;
[Signal]
public delegate void UpdateWorldSpeedEventHandler(float speed);
using System.Linq;
using Godot;
using Godot.Collections;
public partial class AudioManager : Node
{
// ** needed sounds **
// Music
// shoot
// die
@eka
eka / uuid_generator.gd
Last active September 23, 2024 02:13
Poormans UUID Generator for Godot 4.x
extends Node
func generate_uuid_v4() -> String:
var uuid = PackedByteArray()
for i in range(16):
uuid.append(randi() % 256)
# Set the version to 4 (randomly generated UUID)
uuid[6] = (uuid[6] & 0x0F) | 0x40
# Set the variant to DCE 1.1, ITU-T X.667
uuid[8] = (uuid[8] & 0x3F) | 0x80
@eka
eka / ExplosiveBarrel.cpp
Created January 30, 2024 14:47
Using Interfaces to implement MagicProjectile hitting something
// Fill out your copyright notice in the Description page of Project Settings.
#include "ExplosiveBarrel.h"
#include "PhysicsEngine/RadialForceComponent.h"
// Sets default values
AExplosiveBarrel::AExplosiveBarrel()
{
using Godot;
public partial class State : Node
{
[Signal]
public delegate void FinishedEventHandler(string nextState);
[Signal]
public delegate void StackEventHandler(string nextState);
@eka
eka / bofh_excuses.txt
Created October 30, 2019 10:48
BOFH excuse list
clock speed
solar flares
electromagnetic radiation from satellite debris
static from nylon underwear
static from plastic slide rules
global warming
poor power conditioning
static buildup
doppler effect
hardware stress fractures
@eka
eka / AccelerationControl.cs
Created December 27, 2018 08:39
Acceleration example for Unity
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class AccelerationControl : MonoBehaviour
{
public float Speed = 50f;
// Use this for initialization
void Start () {
@eka
eka / GameManager.cs
Created July 27, 2018 12:29
InfiniteRunner Managers Can't be extended
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace YakDogGames
{
public class GameManager : MoreMountains.InfiniteRunnerEngine.GameManager
{
public override void LoseLives(int lives)
{