fuck around with native script

This commit is contained in:
zoe 2022-05-01 22:23:01 +02:00
parent c8046a6e85
commit 3317db5211
8 changed files with 115 additions and 9 deletions

View file

@ -0,0 +1,6 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://world/state_server.gdns" type="Script" id=1]
[node name="StateServer" type="Node"]
script = ExtResource( 1 )

Binary file not shown.

8
godot/world/StateApi.gd Normal file
View file

@ -0,0 +1,8 @@
extends Node
var server = preload("res://native/StateServer.tscn").instance()
# Called when the node enters the scene tree for the first time.
func _ready():
add_child(server)
print(server.a)
server.foo()

View file

@ -0,0 +1,16 @@
extends Node
# Declare member variables here. Examples:
# var a = 2
# var b = "text"
# Called when the node enters the scene tree for the first time.
func _ready():
pass
# Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta):
# pass

View file

@ -3,10 +3,13 @@
[ext_resource path="res://world/terrain/terrain.tres" type="TileSet" id=1]
[ext_resource path="res://world/terrain.gd" type="Script" id=2]
[ext_resource path="res://world/worldcam.gd" type="Script" id=3]
[ext_resource path="res://world/state_server.gdns" type="Script" id=4]
[ext_resource path="res://world/StateApi.gd" type="Script" id=5]
[node name="World" type="Node2D"]
[node name="StateApi" type="Node" parent="."]
script = ExtResource( 5 )
[node name="terrain" type="TileMap" parent="."]
position = Vector2( -2, 0 )
mode = 1
@ -27,6 +30,3 @@ format = 1
current = true
zoom = Vector2( 0.4, 0.4 )
script = ExtResource( 3 )
[node name="state_server" type="Node" parent="."]
script = ExtResource( 4 )