Skip to content

Instantly share code, notes, and snippets.

shader_type canvas_item;
/**
Maps object texture onto a sphere and applies a spherical normal
based on a simulated light.
Adapted from
https://www.raywenderlich.com/2323-opengl-es-pixel-shaders-tutorial
and
https://gamedev.stackexchange.com/a/9385
@XANOZOID
XANOZOID / KinematicPlatformer2d.gd
Last active February 7, 2022 02:59
Godot easy and composable slopes platformer code (DEMO: https://media.giphy.com/media/iPQssOxSZ61Zm/giphy.gif )
# Please credit "Ghouly The Ghost" out of your kind heart! Check my gist page for a license.
# Includes: No slip inclines, variable angle climbing, shape agnostic implementation, slope climb up/down, smooth old school vertical collisions
# WARNING! IMPORTANT!: Relies on " Scene >> Projects Settings >> Physics 2D >> motion_fixed_enabled[x] __ on[x]"
extends KinematicBody2D
const floorCheckVector = Vector2( 0, 1 )
const normalCheckVector = Vector2( 0, -1 )
var angleThreshold = 1.39 setget set_angle_threshold
var slopeScale = tan( angleThreshold )