Skip to content

Instantly share code, notes, and snippets.

Avatar
🙂

Lisandro Lorea noidexe

🙂
View GitHub Profile
@noidexe
noidexe / IconPNGAsAudio.gd
Last active Aug 17, 2020
User icon.png as Audio
View IconPNGAsAudio.gd
tool
extends AudioStreamPlayer
# "We were so preoccupied with whether or not we could, we didn’t stop to think if we should."
var sample_hz = 8000.0 # Adjust and enjoy the sound of nightmares
var playback: AudioStreamPlayback = null # Actual playback stream, assigned in _init().
var _stream = PoolRealArray()
var stream_pos = 0
@noidexe
noidexe / Godot_unstable.svg
Last active Feb 28, 2020
Godot icon with alternative palette to differentiate from stable in desktop shortcuts
View Godot_unstable.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@noidexe
noidexe / RoundRobinPlayer.gd
Created Sep 9, 2019
RoundRobinPlayer node for Godot Engine with sequence, random, and shuffle modes extending AudioStreamPlayer
View RoundRobinPlayer.gd
tool
extends AudioStreamPlayer #exactly the same code should work for extending 2D and 3D versions
class_name RoundRobinPlayer
export(int, "sequence", "random", "shuffle") var queue_mode = 0
export(Array, AudioStream) var playlist = [] setget _set_playlist, _get_playlist
export(bool) var round_robin_playing = false setget _set_playing, _is_playing # can't override properties so use this for animations
var playlist_index = -1 # current position in the playlist
var shuffled_indices = [] # Array<int> of shuffled playlist indices
@noidexe
noidexe / some_singleton.gd
Created Dec 28, 2017
ShuffleBag implementation in gdscript
View some_singleton.gd
#You can add this to any singleton where you have helper classes and functions
class ShuffleBag:
var _shuffled_list
var _current_pos = -1
func _init(array_from):
var _unshuffled = array_from.duplicate()
var _shuffled = []
var _current_pos
# Pick a random element from the unshuffled list
@noidexe
noidexe / script.cs
Created Oct 12, 2017
Godot sample script: GDScript vs C#
View script.cs
using Godot;
using System;
public class SharpBird : Node2D
{
// Member variables here, example:
// private int a = 2;
// private string b = "textvar";
private double direction;
Random r = new Random();
@noidexe
noidexe / draggableObject.gd
Last active Oct 20, 2017
Drag n Drop example in Godot
View draggableObject.gd
extends Node2D
signal picked
signal dropped
enum DRAGSTATES { PICKED, DROPPED }
var drag_state = DRAGSTATES.DROPPED
var prev_mouse_pos = Vector2(0,0)
var absolute_z = IntArray([0])
var last_event
@noidexe
noidexe / joycon-mappings.txt
Created Jul 31, 2017
Nintendo Switch Joycons as html5 bluetooth controller
View joycon-mappings.txt
Nintendo Switch Joycons use standard bluetooth technology and can be paired with a PC or phone by holding the power button between SL and SR while the console is off.
If your Switch can't find em after that just reattach them to the console and they'll pair up immediately.
Button scheme info obtained using http://html5gamepad.com and http://gamepadviewer.com
Joycon R: Wireless Gamepad (Vendor: 057e Product: 2007)
Switch, Generic, XBOX
SL, B4, LB
SR, B5, RB
@noidexe
noidexe / PyxelEdit-LicenseFix.cmd
Last active May 11, 2017
Pyxel Edit License Fix (Windows)
View PyxelEdit-LicenseFix.cmd
@echo OFF
echo.=================================
echo.PYXEL EDIT LICENSE FIX BY NOIDEXE
echo.Gist at https://goo.gl/hXVb7q
echo.Remember to run as admin
echo.=================================
echo.
set licensefile="C:\Program Files\PyxelEdit\Settings\LicenseKey.txt"
set licensefilex64="C:\Program Files (x86)\PyxelEdit\Settings\LicenseKey.txt"
set exepath="C:\Program Files\PyxelEdit\PyxelEdit.exe"
View Iterador.cmd
REM Reemplaza las lineas echo por el comando del conversor
REM Copia este archivo a la carpeta donde esten los wavs y ejecutalo
@echo off
for %%f in (*.wav) do call:mifuncion %%f
GOTO:end
:mifuncion
echo.aca se convertiria %1 a mp3
echo.aca se convertiria %1 a ogg
@noidexe
noidexe / build-spigot-update.ps1
Created Mar 14, 2015
Script to build Spigot on windows using PowerShell
View build-spigot-update.ps1
#To use just do: [Right Click]->[Run in PowerShell]
$source = "https://hub.spigotmc.org/jenkins/job/BuildTools-Beta/lastSuccessfulBuild/artifact/target/BuildTools.jar"
#Once the new BuildTools are out of beta chage the url above to:
#https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar
$destination = "BuildTools.jar"
Invoke-WebRequest $source -OutFile $destination