Skip to content

Instantly share code, notes, and snippets.

View Shilo's full-sized avatar

Shilo Shilo

View GitHub Profile
@Shilo
Shilo / TileMapEditor.gd
Last active February 4, 2024 12:23
Simple runtime tilemap editor that will draw the a terrain from a tileset. (Left click = place, Right click = remove, Middle click = pan)
class_name TileMapEditor extends TileMap
enum InputState {
NONE,
PLACE,
REMOVE,
PAN
}
var input_state: InputState = InputState.NONE
@Shilo
Shilo / AutoCollisionShape3D.cs
Last active October 24, 2023 15:51
Godot tool for auto syncing position and size of collision shape 3d with a target mesh instance 3d. (GDScript or C#)
using Godot;
[Tool, GlobalClass]
public partial class AutoCollisionShape3D : CollisionShape3D
{
[Export]
public MeshInstance3D MeshInstance;
[ExportGroup("Editor Auto Sync")]
[Export]
@Shilo
Shilo / character_push_2d.gd
Last active March 23, 2024 10:42
Godot 2d character ability to push rigid bodies.
class_name CharacterPush2D extends Node
@export var character: CharacterBody2D
@export var push_strength: float = 1000
@export var pushable_body_group: String = "pushable_body"
@export var lock_x: bool = false
@export var lock_y: bool = false
@export var no_physics: bool = false
@export var disabled: bool = false
@Shilo
Shilo / ColorCollisionShape2D.cs
Last active March 23, 2024 11:44
Godot tool for drawing 2d collision shapes. (C# or GDScript)
using System.Linq;
using Godot;
[Tool]
[GlobalClass]
public partial class ColorCollisionShape2D : CollisionShape2D
{
private Color _color = Colors.White;
[Export]
@Shilo
Shilo / index.html
Last active June 21, 2023 14:22 — forked from chrisvfritz/index.html
Simplest possible HTML template
<!doctype html>
<html>
<head>
<title>This is the title of the webpage!</title>
</head>
<body>
<p>
This is an example paragraph.<br />
Anything in the <strong>body</strong> tag will appear on the page.<br />
Just like this <strong>p</strong> tag and its contents.
@Shilo
Shilo / CastCPPVoidToNil.lua
Last active September 22, 2022 08:18
Roblox studio scripting tricks. (Examples)
local function test()
end
typeof( (test()) )
@Shilo
Shilo / NilNothingTest.lua
Created September 17, 2022 08:46
Nothing to nil casting test in LUA.
function testNil() return nil end
function testNothing() end
print( type( (testNil()) ) )
print( type( (testNothing()) ) )
print( type( testNil() ) )
print( type( testNothing() ) )
@Shilo
Shilo / CollisionGroupManager.lua
Last active September 16, 2022 07:12
Collision group manager that allows automatically setting collision groups via Instance Attributes (CollisionGroup) in Roblox Studio.
local COLLISION_GROUP_ATTR_NAME = "CollisionGroup"
local RECURSIVE_PLAYER = true
local RECURSIVE_NON_PLAYER = true
local PhysicsService = game:GetService("PhysicsService")
local function IsValidCollisionGroup(collisionGroup)
return collisionGroup and #collisionGroup > 0
end
@Shilo
Shilo / Example.lua
Last active September 16, 2022 21:58
Flexible gui tooltip system for Roblox Studio.
local Tooltip = require(game.ReplicatedStorage.Tooltip)
local tooltipGui = script.Parent
local tooltipTextLabel = tooltipGui.Text
local offset = Vector2.new(16, 0)
local maxSize = Vector2.new(200, math.huge)
local tooltip = Tooltip.new(tooltipGui, tooltipTextLabel, offset, maxSize)
tooltip:AutoShow(script.Parent.Parent)
@Shilo
Shilo / ClickToMove.lua
Created September 14, 2022 09:37
Click to move example in Roblox Studio.
local ContextActionService = game:GetService("ContextActionService")
local RunService = game:GetService("RunService")
local player = game.Players.LocalPlayer
local effect = game.ReplicatedStorage.ClickToMoveEffect
local heartbeatSignal = nil
local function OnClickToMoveTick()
local hit = player:GetMouse().Hit
if not hit then return end