load_from_disk.gd 941 B

123456789101112131415161718192021222324
  1. extends Node2D
  2. func _ready():
  3. # Load the skeleton file
  4. var skeleton_file_res = SpineSkeletonFileResource.new();
  5. skeleton_file_res.load_from_file("/Users/badlogic/workspaces/spine-runtimes/examples/coin/export/coin-pro.skel");
  6. # Load the atlas file
  7. var atlas_res = SpineAtlasResource.new();
  8. atlas_res.load_from_atlas_file("/Users/badlogic/workspaces/spine-runtimes/examples/coin/export/coin.atlas");
  9. # Create a skeleton data resource, you can share this across multiple sprites
  10. var skeleton_data_res = SpineSkeletonDataResource.new();
  11. skeleton_data_res.skeleton_file_res = skeleton_file_res;
  12. skeleton_data_res.atlas_res = atlas_res
  13. # Create a sprite from the skeleton data and add it as a child
  14. var sprite = SpineSprite.new();
  15. sprite.skeleton_data_res = skeleton_data_res;
  16. sprite.position.x = 200;
  17. sprite.position.y = 200;
  18. sprite.get_animation_state().set_animation("animation", true, 0);
  19. self.add_child(sprite)
  20. pass