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
# https://www.reddit.com/r/godot/comments/rfzwom/sexystupid_state_machine_in_8_lines/ | |
class_name StateMachine extends Node | |
signal state_changed | |
var state:int = 0 setget _set_state | |
func _init(inital_state:int = 0) -> void: | |
state = inital_state | |
pass |
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
# TODO: Make sure it can handle multiple spawn locations | |
# TODO: Add the ability to trace back along player nav_path to find furthest point to use as distance traveled | |
# TODO: Add ability to get a point from a percentage along the nav_path | |
# TODO: Add ability to look forward n distance from where the intersect or player is | |
# TODO: Add ability to check if player can travel to path without obstacles. if not find another near segment to check from. | |
# TODO: Add ability to get path ahead from vector3 to distance | |
extends Node | |
var director:Node |
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
extends Node | |
# Declare member variables here. Examples: | |
# var a = 2 | |
# var b = "text" | |
# Called when the node enters the scene tree for the first time. | |
func _enter_tree(): | |
push_warning("WARNING Generating Key Maps: Be sure to use the Input Map in the release") |
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 last_velocity = Vector3.ZERO | |
var slide_collisions = [] | |
func handle_stairs3(slides:Array, start_position:Vector3, rotation, radius:float,ray:RayCast): | |
ray.enabled = true | |
$StepClear.enabled = true | |
if slides.size()>0: | |
var selected_slide:KinematicCollision = null | |
var slide_positions = [] |
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
func optimize_path(path:Array,remove_duplicates = true): | |
#fail early | |
if path.size() < 1: | |
return path | |
var last_normal:Vector3 | |
var point:Vector3 | |
var optimized_list = [] | |
var uniq = [] |
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
#Simple script to generate Trimesh Collisions on a node and all it's children | |
extends Node | |
var collision_body = StaticBody.new() | |
var collision_shape = CollisionShape.new() | |
func _ready(): | |
walk_nodes(self) |
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
extends Node2D | |
# Declare memr variables here. Examples: | |
# var a = 2 | |
# var b = "text" | |
# Called when the node enters the scene tree for the first time. | |
var _fps_ticker_data = [] | |
var fpskeydown = false |
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
extends Camera | |
# Takes the needed pictures to create a cube map. | |
# Read this to find where the files are saved. http://docs.godotengine.org/en/3.0/tutorials/io/data_paths.html?highlight=user%3A%2F%2F | |
# Go here to make it useable in godot. https://nadirpatch.com/cube2sphere/ | |
var _pass = 0 | |
func _ready(): | |
get_viewport().size = Vector2(1024,1024) | |
self.rotation = Vector3(0,0,0) | |
pass |
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
# Simple Utility Script | |
# Traps Mouse Cursor and hides it. | |
# ESCAPE to quit game | |
# F5 to reload current scene | |
# F9 to toggle collision shape dispay. Scene MUST be reloaded | |
# F10 to toggle fps Display | |
# F11 to switch from windowed to fullscreen | |
# F12 to take screenshot | |
# | |
# Works great for fps games |
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
extends KinematicBody | |
# class member variables go here, for example: | |
# var a = 2 | |
# var b = "textvar" | |
export(float) var walk_speed = 4 | |
export(float) var run_speed = 6 | |
export(float) var acceleration = 5 | |
export(float) var deceleration = 8 |
NewerOlder