48 lines
1.5 KiB
GDScript3
48 lines
1.5 KiB
GDScript3
tool
|
|
extends Node
|
|
|
|
|
|
# Declare member variables here. Examples:
|
|
# var a = 2
|
|
# var b = "text"
|
|
export var save = false
|
|
var par = get_parent()
|
|
var conf = File.new()
|
|
|
|
# Called when the node enters the scene tree for the first time.
|
|
func _ready():
|
|
pass # Replace with function body.
|
|
|
|
|
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
func _process(delta):
|
|
if save:
|
|
#THIS IS SAVE. MAKE SURE LOAD ONLY LOADS IN GAME THOUGH. MAYBE.
|
|
print("asss")
|
|
save = false
|
|
var savedata = {}
|
|
savedata["name"] = "Rabbit"
|
|
savedata["simple"] = true
|
|
savedata["name"] = "Rabbit"
|
|
savedata["name"] = "Rabbit"
|
|
#get image data of normal
|
|
var pngdat = par.get_node("flip/body").texture.get_data().save_png_to_buffer()
|
|
savedata["sprite-main"] = pngdat
|
|
#digest1
|
|
pngdat = par.get_node("flip/digest1").texture.get_data().save_png_to_buffer()
|
|
savedata["sprite-digest1"] = pngdat
|
|
#digest2
|
|
pngdat = par.get_node("flip/digest2").texture.get_data().save_png_to_buffer()
|
|
savedata["sprite-digest2"] = pngdat
|
|
#digest3 bones
|
|
pngdat = par.get_node("flip/digest3").texture.get_data().save_png_to_buffer()
|
|
savedata["sprite-digest3"] = pngdat
|
|
#cum overlay
|
|
pngdat = par.get_node("flip/cum").texture.get_data().save_png_to_buffer()
|
|
savedata["sprite-cum"] = pngdat
|
|
savedata["collision-shape"] = par.get_node("CollisionShape2D").shape
|
|
savedata["collision-position"] = par.get_node("CollisionShape2D").position
|
|
conf.open("res://preys/test.prey",conf.WRITE)
|
|
#conf.store_string(var2str(savedata))
|
|
conf.store_var(savedata,false)
|
|
conf.close()
|