Skip to content

Instantly share code, notes, and snippets.

View henriiquecampos's full-sized avatar
🎮
Making games with open source tools

Henrique Campos henriiquecampos

🎮
Making games with open source tools
View GitHub Profile
Verifying that +henriquecampos is my blockchain ID. https://onename.com/henriquecampos
extends Control
func _ready():
#void call_group( int flags, String group, String method, Variant arg0=NULL, Variant arg1=NULL, Variant arg2=NULL, Variant arg3=NULL, Variant arg4=NULL )
#int connect( String signal, Object target, String method, Array binds=Array(), int flags=0 )
get_tree().call_group(0, "buttons", "connect", "pressed", self, "play_feedback", ["click"])
@henriiquecampos
henriiquecampos / godot_ignore.gitignore
Last active December 11, 2017 16:17
Git ignore template file for Godot Engine projects
temp/
.import/
.mono/
export_presets.cfg
extends Panel
var tutor_part = 1
func _ready():
$Button.connect("button_up", self, "_on_next_up")
func _on_next_up():
if $Animator.is_playing():
$Animator.seek($Animator.get_current_animation_length())
else:
@henriiquecampos
henriiquecampos / audio_library_factory.gd
Created October 12, 2018 13:59
A Godot Editor Script that automatically creates AudioStreamPlayer nodes and AudioStreamRandomPitch resources based on a source directory with the raw files.
tool
extends EditorScript
func _run():
var interface = get_editor_interface()
var filesys = interface.get_resource_filesystem()
var dir = filesys.get_filesystem_path(get_scene().source_directory)
for f in dir.get_file_count():
var path = dir.get_file_path(f)
extends Node
onready var active_battler : Battler = null
func play_turn():
active_battler = get_child(0)
active_battler.active = true
yield(active_battler, "turn_finished")
move_child(active_battler, get_child_count() -1)
@henriiquecampos
henriiquecampos / save_load.gd
Last active May 6, 2021 19:56
A very, versy simple way to save and load games in Godot Engine
extends Node
func save_game():
var scene = PackedScene.new()
scene.pack(self)
ResourceSaver.save("user://save_01.tscn", scene)
func load_game():
var scene = load("user://save_01.tscn")
extends Node2D
var carta_ataque = 1
var carta_defesa = 2
func _ready():
sistema_de_ataque()
func sistema_de_ataque():
extends Node
export (float) var mass = 20.0
func steer(current_velocity, desired_velocity):
var steering = desired_velocity - current_velocity
steering /= mass
steering *= -1
return steering
@henriiquecampos
henriiquecampos / Grid.gd
Last active November 18, 2019 22:45
A Tilemap that maps Nodes to cell positions, allowing to access them based on their cell
extends TileMap
var tiles = {}
func _ready():
update_tiles()
func update_tiles():