Skip to content

Instantly share code, notes, and snippets.

# Example of a makefile to bulk export aseprite art onto a game.
# For windows, it is necessary to install some version of make such as:
# http://gnuwin32.sourceforge.net/packages/make.htm
#
# Details and specialized use of make are beyond this example. That's
# a whole different can of worms... Here I'm using the most simple of
# simples but any experts looking at this are welcome to improve.
extends Camera2D
const SCREEN_SIZE := Vector2( 320, 180 )
var cur_screen := Vector2( 0, 0 )
func _ready():
set_as_toplevel( true )
global_position = get_parent().global_position
_update_screen( cur_screen )
@securas
securas / block_tileset.gd
Created August 6, 2020 15:02
A custom godot autotiler for blocks
tool
extends TileSet
const EMPTY_AUTOTILE = Vector2( 4, 0 )
var block_tiles = [ "blocks" ]
func _forward_subtile_selection(autotile_id : int, _bitmask : int, tilemap : Object, tile_location : Vector2 ):
if block_tiles.find( tile_get_name( autotile_id ) ) < 0:
shader_type canvas_item;
uniform sampler2D spritesheet; // Should be a slice image as exported from Magica Voxel
uniform int slice_count = 1; // The number of slices
uniform vec2 camera_vec = vec2( 1., 1. ); // Recomend using (1,1) or (1,1.5)
uniform float camera_ang = 0.0; // change this to change the view angle of the object
const vec2 center = vec2( 0.5 );
bool scale_and_rotate_with_offset( inout vec2 uv, vec2 sxy, float ang, vec2 cent, vec2 offset )
@echo off
set ASEPRITE="C:\Program Files (x86)\Steam\steamapps\common\Aseprite\Aseprite.exe"
%ASEPRITE% -b "tileset.aseprite" --save-as ..\game\assets\tileset.png
%ASEPRITE% -b "trees.aseprite" --save-as ..\game\assets\trees.png
%ASEPRITE% -b "player_punch_mask.aseprite" --save-as ..\game\assets\player_punch_mask.png
%ASEPRITE% -b "player.aseprite" --sheet "..\game\assets\player.png" --sheet-width 256 --sheet-height 512
%ASEPRITE% -b "player_wolf_transformation.aseprite" --sheet "..\game\assets\player_wolf_transformation.png" --sheet-width 256
%ASEPRITE% -b "death_animation.aseprite" --sheet "..\game\assets\death_animation.png" --sheet-width 256
%ASEPRITE% -b "wolf.aseprite" --sheet "..\game\assets\wolf.png" --sheet-width 256 --sheet-height 256
extends Camera
var transform_origin
var offset = Vector2()
var _duration = 0.0
var _period_in_ms = 0.0
var _amplitude = 0.0
extends "res://scripts/controllable.gd"
signal player_dead
#const BULLET_VEL = 250
var cur_bullet = 0
const BULLET_DELAYS = [ 0.15, 0.07 ]
var bullet_scn = preload( "res://player/bullet.tscn" )
var bullet_blast_scn = preload( "res://player/bullet_blast.tscn" )
# Update the object velocity with vel += steering( position, target_position, vel, delta )
# adjust MAX_VEL and MAX_FORCE values to control how the motion looks like
func steering( cur_pos, target_pos, cur_vel, delta ):
var distance_to_target = target_pos - cur_pos
var desired_vel = distance_to_target.normalized() * MAX_VEL
steering_force = ( desired_vel - cur_vel ) / delta
steering_force = steering_force.clamped( MAX_FORCE )
return steering_force * delta
shader_type canvas_item;
//inputs
uniform float AMT = 0.7; //0 - 1 glitch amount
uniform float SPEED = 0.6; //0 - 1 speed
//2D (returns 0 - 1)
float random2d(vec2 n) {
return fract(sin(dot(n, vec2(12.9898, 4.1414))) * 43758.5453);
}
@securas
securas / BackBufferCopy.tscn
Created July 16, 2017 11:28
replicating Glass Bubbles (Texscreen)
[gd_scene load_steps=4 format=1]
[ext_resource path="res://bubble_shader.tres" type="Shader" id=1]
[ext_resource path="res://bubble.png" type="Texture" id=2]
[sub_resource type="CanvasItemMaterial" id=1]
shader/shader = ExtResource( 1 )
shader/shading_mode = 0