This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
### | |
# SOME COMMANDS WILL NOT WORK ON macOS (Sierra or newer) | |
# For Sierra or newer, see https://github.com/mathiasbynens/dotfiles/blob/master/.macos | |
### | |
# Alot of these configs have been taken from the various places | |
# on the web, most from here | |
# https://github.com/mathiasbynens/dotfiles/blob/5b3c8418ed42d93af2e647dc9d122f25cc034871/.osx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_closest_point(a, b, p, clamp_to_segment=True): | |
""" get closest point on line segment [ab] to point p """ | |
ab = b - a # vector from a -> b | |
ap = p - a # vector from a -> p | |
ab2 = ab.x ** 2 + ab.y ** 2 # length of ab | |
ap_dot_ab = ap.x * ab.x + ap.y * ab.y # dot product (project ap onto ab) | |
t = ap_dot_ab / ab2 | |
if clamp_to_segment: | |
if t < 0: | |
t = 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var vect = Vector2() | |
vect.x = Input.is_action_pressed("right") - Input.is_action_pressed("left") | |
vect.y = Input.is_action_pressed("down") - Input.is_action_pressed("up") | |
vect = vect.normalized() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[color_theme] | |
background_color="211F26" | |
base_type_color="bf616a" | |
brace_mismatch_color="ffff3333" | |
caret_color="ffffffff" | |
comment_color="65737e" | |
current_line_color="ff2d2f31" | |
engine_type_color="a3be8c" | |
function_color="8fa1b3" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# global - scene manager also scene with only anim and black texture | |
func change_stage(stage_path): | |
if is_changing: return | |
is_changing = true | |
get_tree().get_root().set_disable_input(true) | |
# fade to black | |
get_node("anim").play("fade_in") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// use on 1x1 white pixel texframe | |
// shader properties | |
uniform float brightness = 0.5; | |
color pixel_color = vec4(texscreen(SCREEN_UV), 1); | |
COLOR.rgb = vec3(dot(pixel_color.rgb, vec3(brightness, brightness, brightness))); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import turtle | |
t = turtle.Pen() | |
t.speed(0) | |
t.width(5) | |
turtle.tracer(0) | |
# goto start | |
t.up() | |
t.goto(-300, 300) | |
t.down() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Explosion(pygame.sprite.Sprite): | |
def __init__(self, center, size): | |
pygame.sprite.Sprite.__init__(self) | |
self.size = size | |
self.image = explosion_anim[self.size][0] | |
self.rect = self.image.get_rect() | |
self.rect.center = center | |
self.frame = 0 # set frame to 0 (frame will increment based on frame rate) | |
self.last_update = pygame.time.get_ticks() # set last_update to gametime in miliseconds (since object initaited) | |
self.frame_rate = 50 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ____________LICENSE____________ | |
# (See license.txt or the *maintained* link included for more details ) | |
# This Source Code Form is subject to the terms of the Mozilla Public | |
# License, v. 2.0. If a copy of the MPL was not distributed with this | |
# file, You can obtain one at http://mozilla.org/MPL/2.0/. | |
# ______________________________ | |
# Please credit "Abe Noll(forgotten-king)", the writer of this script and implementation. | |
# For what MPL-2.0 covers, I would appreciate if you went the extra mile to include a link in the source | |
# to any of the changes and fixes you made back to this gist, and also to leave a link on |