Skip to content

Instantly share code, notes, and snippets.

@kingthrillgore
kingthrillgore / vehicle.gd
Created March 30, 2023 01:50
Modified vehicle.gd
if Input.is_action_pressed(&"reverse"):
print("Reverse pressed (fwd_mps: ", fwd_mps, ")")
# Increase engine force at low speeds to make the initial acceleration faster.
if fwd_mps >= -1.0:
var speed := linear_velocity.length()
print("Meters Per Second is gteq -1 (speed: ", speed, ")")
if speed < 5.0 and not is_zero_approx(speed):
print("Reverse Engine")
engine_force = -clampf(engine_force_value * 5.0 / speed, 0.0, 0.0)
brake = 0.0
@kingthrillgore
kingthrillgore / vehicle.gd
Last active March 30, 2023 02:16
The original trucktown vehicle code
if Input.is_action_pressed(&"accelerate"):
# Increase engine force at low speeds to make the initial acceleration faster.
var speed := linear_velocity.length()
if speed < 5.0 and not is_zero_approx(speed):
engine_force = clampf(engine_force_value * 5.0 / speed, 0.0, 100.0)
else:
engine_force = engine_force_value
# Apply analog throttle factor for more subtle acceleration if not fully holding down the trigger.
engine_force *= Input.get_action_strength(&"accelerate")
var game_scene = get_parent().get_parent().get_parent()
var player_scene = get_parent().get_parent().get_parent().find_child("Player", true)
player_scene.global_position = player_spawn.global_position
var scene_tree = get_parent().get_parent().get_parent().find_child("Player", true)
func interact(interact := false):
# Return anything hitting the raycast collider
print("Interact thrown")
var collider = interact_collider.get_collider()
if collider != null:
if collider.is_in_group(group_for_interactions):
print("Player is facing an interactive")
emit_signal("throwing_interactive")
collider.interact()
@kingthrillgore
kingthrillgore / standard_task.gd
Last active March 7, 2023 22:15
Standard task implementation
extends "res://scripts/quests/task.gd"
# Fields
var tasks : Array
var tasks_completed : Array
# System Methods
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.
@kingthrillgore
kingthrillgore / task.gd
Last active March 7, 2023 22:15
Parent Task class
extends Node
# Enums
enum state { PENDING, UNLOCKED, IN_PROGRESS, COMPLETED, DONE, CANCELED }
# Fields
export var uid : String
export var task_title : String
export var task_description : String
var task_status : int
@kingthrillgore
kingthrillgore / PlayerController.gd
Created February 26, 2023 00:50
Modifications to pemguin005's godot third person controller. MIT licensed
extends KinematicBody
# Imports
# Allows to pick your animation tree from the inspector
export (NodePath) var PlayerAnimationTree
export onready var animation_tree = get_node(PlayerAnimationTree)
onready var playback = animation_tree.get("parameters/playback");
# Allows to pick your chracter's mesh from the inspector

Keybase proof

I hereby claim:

  • I am ghostfreeman on github.
  • I am thrillgore (https://keybase.io/thrillgore) on keybase.
  • I have a public key ASBoUzVDrInvvZNqCHs1wWmD5lzRXlXyFyK2BVvC_6jgawo

To claim this, I am signing this object:

var BreezeCardInfo = {
username: userNameField,
password: passwordField,
email: emailField,
ridesToAdd: ridesToAdd
};
// Pull values with the attribute from 'value'
// wihin above object
$('#FIELD_ID').attr("value");