Skip to content

Instantly share code, notes, and snippets.

@brunosxs
brunosxs / ESP32_BLE_Arcade.ino
Created April 15, 2019 12:57 — forked from GameDragon2k/ESP32_BLE_Arcade.ino
NodeMCU-32S Game Pad
/*
Video: https://www.youtube.com/watch?v=oCMOYS71NIU
Based on Neil Kolban example for IDF: https://github.com/nkolban/esp32-snippets/blob/master/cpp_utils/tests/BLE%20Tests/SampleNotify.cpp
Ported to Arduino ESP32 by Evandro Copercini
Gamepad coding by Game Dragon
*/
#include <BLEDevice.h>
#include <BLEServer.h>
#include <BLEUtils.h>
@brunosxs
brunosxs / char.gd
Last active June 6, 2017 12:22
SMRT cave example
extends KinematicBody2D
var walk_speed = 500
var direction = Vector2(0,0)
func _ready():
set_fixed_process(true)
Globals.set("player", self) # We make the player accessible more easily through Globals.
func _fixed_process(delta):
# Simple movement for our char
@brunosxs
brunosxs / savenload.gd
Last active July 9, 2020 22:30
Godot Quick Tips 02: Simple save and load methods for godot engine with dir and file handling
# Created by BrunoSXS
# LICENSED UNDER MIT
var save_slot = 0 # Just like classic JRPs, change the slot to save in a different place
var current_save_game # This is the contents of the save file, for now we just declare it
var default_save = {"money":0,"powers":null} # The default save contents, if there is no save file to load, then, the current_save_game gets its contents from this variable and then creates a save file with it
func _ready():
current_save_game = load_game(save_slot) if typeof(load_game(save_slot)) == TYPE_DICTIONARY else default_save # This is the first loading, when the game starts.
@brunosxs
brunosxs / create_timer.gd
Last active April 22, 2022 20:02
Godot Quick Tips 01: The create_timer() helper for waiting X seconds
# Available only in the 2.2 legacy branch and posterior versions
func _ready():
# The old way:
print("HELLO") # Code before the yield
# Setting up the yield:
var t = Timer.new() # Create a new Timer node
t.set_wait_time(5.5) # Set the wait time
add_child(t) # Add it to the node tree as the direct child