This file contains hidden or 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 _delete_data(path): | |
var dir = Directory.new() | |
var opened = dir.change_dir(path) | |
if opened != OK: | |
OS.alert("Error "+str(opened)+" opening path: "+path) | |
dir.list_dir_begin() | |
var current = dir.get_next() | |
print(current) | |
while not current.empty(): |
This file contains hidden or 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
# List of current Actions used by Controller. | |
# (update this as new actions are added) | |
var cmd_list = [ | |
'thrust_pro', | |
'thrust_retro', | |
'rcs_pro', | |
'rcs_retro', | |
'rcs_left', | |
'rcs_right', | |
'yaw_left', |
This file contains hidden or 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
################################################# | |
# CONTROLLER SIGNALS FOR SHIP FLIGHT CONTROL # | |
# # | |
# (Any actions set in this ship's Controller # | |
# MUST have a function defined here. The # | |
# function name must be identical to the # | |
# Controller signal emitted. # | |
# # | |
################################################# | |
# CONTROLLER SIGNAL FUNCTIONS START HERE # |
This file contains hidden or 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 Position2D | |
onready var main = get_node('/root/Main') | |
func _ready(): | |
set_process(true) | |
func _process(delta): | |
# apply ship rotation to radar rotation |
This file contains hidden or 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 | |
## solution for dealing with Big Friggin Numbers | |
#value is stored as a list of ints 0-999 | |
#if an int > 999, remainder is carried over to a new int | |
# 10 = [10] | |
# 100 = [100] | |
# 1000 = [0,1] |
This file contains hidden or 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 story = { | |
'clearing': { | |
'text': "You are in a sunny CLEARING.", | |
'choices': { | |
'north': 'castle', | |
'west': 'river', | |
'east': 'forest', | |
} | |
}, |
This file contains hidden or 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 _integrate_forces(state): | |
var direction = get_linear_velocity() | |
var step = state.get_step() | |
for i in range(state.get_contact_count()): | |
var pos = get_pos() | |
var col = state.get_contact_collider_object(i) | |
var norm = state.get_contact_local_normal(i) |
This file contains hidden or 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
#..global save func | |
func save_hero(hero): | |
#grab data | |
var data = hero.get_package() | |
#init save file | |
var save = File.new() | |
var path = 'res://data/heroes/'+hero.get_name()+'.zd' | |
save.open(path,File.WRITE) | |
#save data | |
save.store_line(data.to_json()) |
This file contains hidden or 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
+# load from a file with several dicts | |
+static func loadJsonMult(path): | |
+ var curfile = File.new() | |
+ if ( !curfile.file_exists(path)): | |
+ logd(str("ERR: loadJson file doesn't exist ",path)) | |
+ return null | |
+ curfile.open(path,File.READ) | |
+ logd(str("MSG: loadJsonMult from ",path)) | |
+ var data = {} |
This file contains hidden or 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
#Make sure our file exists: | |
if not saveGame.file_exists('res://saves/savegame.sav'): | |
print("no savegame found!") | |
return | |
#Dict to hold json lines | |
var loadNodes = {} | |
#Open file to Read | |
saveGame.open('res://saves/savegame.sav', File.READ) | |
#Go through file lines and append each line to loadNodes | |
while (!saveGame.eof_reached()): |