Skip to content

Instantly share code, notes, and snippets.

################################################################################
# cellular automata based off of
# https://gamedevelopment.tutsplus.com/tutorials/generate-random-cave-levels-using-cellular-automata--gamedev-9664
################################################################################
import random
import gen_ids, settings
{.experimental: "codeReordering".}
type
BaseButton* = ref object of Widget
mouse_over*:bool
hit_on_release*:bool
is_toggle*:bool
is_pressed*:bool
style:ButtonStyle
is_hovered:bool
is_down:bool
@Skaruts
Skaruts / test.nim
Last active July 11, 2019 01:13
"Quick" workaround for different named attributes in variant types
import strformat
type
WidgetKind = enum
Frame, Separator, Header, Label, Button
ButtonKind = enum
IconButton, TextButton
type Widget* = ref object
id*:int
class Stopwatch:
var start_time = 0
var stop_time = 0
var counting = false
func start():
counting = true
stop_time = 0
start_time = OS.get_ticks_msec()
print(" --- Starting stopwatch at: %d ---" % [start_time] )
#########################################################################
# script attached to HelperPlanes.tscn, which contains:
# HelperPlanes - Spatial
# H_Helper - Area with input_event connected to the root Spatial (HelperPlanes)
# CollisionShape - containing a PlaneShape set to horizontal (everthing default)
# V_Helper - Area with input_event connected to the root Spatial (HelperPlanes)
# CollisionShape - containing a PlaneShape set to vertical (x=0, y=0, Z=1, d=0)
#
# Areas are not 'monitoring' or 'monitorable'.
#########################################################################
@Skaruts
Skaruts / IGTool.gd
Last active October 24, 2021 23:33
[Godot] A tool that helps working with multiple ImmediateGeometry nodes
#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=
# Immediate Geometry Tool (0.7)
#
# experimental WIP
#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=
extends Spatial
class_name IGTool
enum {A,B,C,D,E,F,G,H} # cube vertex indices
extends KinematicBody
onready var head := $Head
onready var camera := $Head/Camera
onready var weapon := $Weapon
onready var frob_ray := $Head/Camera/FrobRay
onready var coll_stand := $CollisionStand
onready var coll_crouch := $CollisionCrouch
#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=
# Builds grid lines, grid bounds and x,y,z axis lines, using three meshes
#
# Attach this script to a 3D scene like:
# GridManager (Spatial)
# Grid (Spatial)
# Origin (Spatial)
#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=
extends Spatial
extends Node
class_name FOV_MRPAS
# TODO: static typing
var _circle_array := [] # to contain a mask to make fov rounded
var last_radius := 0 # to check if circle mask needs to be re-built
var map
#*******************************************************************************************
#
# raylib [models] example - first person maze
#
# This example has been created using raylib 2.5 (www.raylib.com)
# raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
#
# Copyright (c) 2019 Ramon Santamaria (@raysan5)
#
#*******************************************************************************************/