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
# MIT License | |
# | |
# Copyright (c) 2018 Jelle Hermsen | |
# | |
# Permission is hereby granted, free of charge, to any person obtaining a copy | |
# of this software and associated documentation files (the "Software"), to deal | |
# in the Software without restriction, including without limitation the rights | |
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
# copies of the Software, and to permit persons to whom the Software is | |
# furnished to do so, subject to the following conditions: |
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
namespace = "zdoom"; | |
thing // 0 | |
{ | |
x = -488.000; | |
y = -48.000; | |
angle = 90; | |
type = 1; | |
coop = true; | |
dm = true; | |
single = true; |
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 | |
var inventorys = {} # NEW | |
func _ready(): | |
LoadDictionary("res://Items/Armor/", "Armor") | |
LoadDictionary("res://Items/Consumable/", "Consumables") | |
LoadDictionary("res://Items/Resource/", "Resources") |
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
tool | |
extends Node | |
# dummy variable, click var in editor to update | |
export var tool_update = false setget set_tool_update | |
func set_tool_update(new_value): | |
tool_update = new_value | |
if tool_update: | |
tool_update() |
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 flood_fill(x,y,val, ttl = 1000): | |
var tile_map = $TileMap | |
var start_val = tile_map.get_cell(x,y) | |
if start_val != val: | |
var cells_to_check = [[x,y]] # add cells like [x,y] | |
while cells_to_check.size() > 0 and ttl > 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
func _ready(): | |
var test_iterations = 1000000 | |
print("start tests...") | |
var dispose # i put this here, to prevent some clever compiler from realising these values are not used | |
var counter = test_iterations | |
var start_time = OS.get_ticks_msec() |
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 _ready(): | |
print("start tests...") | |
var dispose # i put this here, to prevent some clever compiler from realising these values are not used | |
var start_time = OS.get_ticks_msec() | |
for i in range(1,1000000): | |
dispose = 15629/i | |
var total_time = OS.get_ticks_msec() - start_time |
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 my_rotate_towards_lerp(target, delta): | |
var deg360 = deg2rad(360.0) # is 360 degrees but in radians | |
var deg180 = deg2rad(180.0) | |
var node = Node2D.new() #create a new node | |
node.position = global_position #at the same position | |
node.look_at(target) #get it to look instead! (missing functions in godot) |
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 my_rotate_towards_lerp(target, delta): | |
var deg360 = deg2rad(360.0) # is 360 degrees but in radians | |
var deg180 = deg2rad(180.0) | |
var node = Node2D.new() #create a new node | |
node.position = global_position #at the same position | |
node.look_at(target) #get it to look instead! (missing functions in godot) | |
#adding 180 degrees is to do with needing to find left and right, like -180 to 180 |
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 distance_to_string(distance_m): | |
var suffix = "m" | |
if distance_m > 1000.0: | |
distance_m /= 1000.0 | |
suffix = "km" | |
var txt = "%*.*f m" % [7,1,distance_m] | |
txt += " %s" % suffix | |
return txt |