Skip to content

Instantly share code, notes, and snippets.

View iamjoeysox's full-sized avatar

Joey Sox iamjoeysox

  • Idle Pixel
  • USA
View GitHub Profile
@iamjoeysox
iamjoeysox / godot_prevent_kineticbody2d_sliding.gd
Last active October 26, 2021 18:26
Prevent KineticBody2D from sliding on slopes
# If grounded set gravity vector to be inverse floor normal.
# That way your character is "falling" flat against the slope and doesn't slide.
# I fixed this by setting velocity y to zero when is_on_floor is true.
for i in get_slide_count():
var collision:KinematicCollision = get_slide_collision(i)
if collision.normal.y < 0.5:
#angle is bellow 45 degrees (90 would be 1.0)
gravityDir = collision.normal
@iamjoeysox
iamjoeysox / godot_portal_2d.gd
Last active October 23, 2021 04:04
Allow players to travel between scenes through a 2D portal
tool
extends Area2D
onready var anim_player: AnimationPlayer = $AnimationPlayer
export var next_scene: PackedScene
func _on_body_entered(body: PhysicsBody2D):
@iamjoeysox
iamjoeysox / godot_snowfall_shader.gd
Last active October 23, 2021 04:01
Snowfall shader for the Godot game engine
shader_type canvas_item;
// Be sure to set the resolution in the editor
// example 640 x 640
// Also be sure to play around with the z index and
// opacity levels on various modulate values and the final color alpha channel
// .....
uniform vec2 resolution;
float snow(vec2 uv, float scale, float time)
@iamjoeysox
iamjoeysox / aseprite-build-and-install-on-macos.sh
Last active December 6, 2021 22:51 — forked from allangarcia/aseprite-build-and-install-on-macos.sh
Pull down compile and build latest Aseprite
#!/bin/bash
# Update all home folder paths to relfect your own setup. Uses ~/Downloads, ~/Projects
brew update
brew install ninja
brew install cmake
# Download and setup skia lib
cd ~/Downloads/
@iamjoeysox
iamjoeysox / godot-pixel-perfect-rendering.gd
Last active October 14, 2021 18:18 — forked from CowThing/pixel_perfect.gd
Pixel perfect scaling script for Godot 3.1
extends Node
"""
An autoload singleton for pixel perfect rendering of the game.
Set this script as an autoload.
`base_size` - Is the target size of the viewport. The viewport will scale up to fit the largest
possible integer multiple of this size within the window.
`expand` - If true the viewport will expand to the edges of the window after scaling up.
@iamjoeysox
iamjoeysox / cloudflare-update-ip-ranges.md
Last active April 21, 2022 18:58 — forked from AidasK/README.md
Auto update of CloudFlare IPs in NGINX

This script is a copy of https://marekbosman.com/site/automatic-update-of-cloudflare-ip-addresses-in-nginx/

wget https://gist.githubusercontent.com/AidasK/27aa5d6f918eca12d95427178b5aaa59/raw/e3ce185de43d89c237e081d3f56e5a79024b4115/cloudflare-update-ip-ranges.sh -P /usr/local/bin/
chmod +x /usr/local/bin/cloudflare-update-ip-ranges.sh

add include /etc/nginx/cloudflare; this line to /etc/nginx/nginx.conf (above include /etc/nginx/conf.d/*.conf;)

crontab -e