RemotePlayer.tscn 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. [gd_scene load_steps=18 format=2]
  2. [ext_resource path="res://cat.png" type="Texture" id=1]
  3. [ext_resource path="res://RemotePlayer.gd" type="Script" id=2]
  4. [sub_resource type="CircleShape2D" id=1]
  5. radius = 15.0
  6. [sub_resource type="AtlasTexture" id=2]
  7. flags = 4
  8. atlas = ExtResource( 1 )
  9. region = Rect2( 0, 0, 32, 32 )
  10. [sub_resource type="AtlasTexture" id=3]
  11. flags = 4
  12. atlas = ExtResource( 1 )
  13. region = Rect2( 32, 0, 32, 32 )
  14. [sub_resource type="AtlasTexture" id=4]
  15. flags = 4
  16. atlas = ExtResource( 1 )
  17. region = Rect2( 64, 0, 32, 32 )
  18. [sub_resource type="AtlasTexture" id=5]
  19. flags = 4
  20. atlas = ExtResource( 1 )
  21. region = Rect2( 0, 32, 32, 32 )
  22. [sub_resource type="AtlasTexture" id=6]
  23. flags = 4
  24. atlas = ExtResource( 1 )
  25. region = Rect2( 32, 32, 32, 32 )
  26. [sub_resource type="AtlasTexture" id=7]
  27. flags = 4
  28. atlas = ExtResource( 1 )
  29. region = Rect2( 64, 32, 32, 32 )
  30. [sub_resource type="AtlasTexture" id=8]
  31. flags = 4
  32. atlas = ExtResource( 1 )
  33. region = Rect2( 0, 64, 32, 32 )
  34. [sub_resource type="AtlasTexture" id=9]
  35. flags = 4
  36. atlas = ExtResource( 1 )
  37. region = Rect2( 32, 64, 32, 32 )
  38. [sub_resource type="AtlasTexture" id=10]
  39. flags = 4
  40. atlas = ExtResource( 1 )
  41. region = Rect2( 64, 64, 32, 32 )
  42. [sub_resource type="AtlasTexture" id=11]
  43. flags = 4
  44. atlas = ExtResource( 1 )
  45. region = Rect2( 0, 96, 32, 32 )
  46. [sub_resource type="AtlasTexture" id=12]
  47. flags = 4
  48. atlas = ExtResource( 1 )
  49. region = Rect2( 32, 96, 32, 32 )
  50. [sub_resource type="AtlasTexture" id=13]
  51. flags = 4
  52. atlas = ExtResource( 1 )
  53. region = Rect2( 64, 96, 32, 32 )
  54. [sub_resource type="SpriteFrames" id=14]
  55. animations = [ {
  56. "frames": [ SubResource( 2 ), SubResource( 3 ), SubResource( 4 ), SubResource( 5 ), SubResource( 6 ), SubResource( 7 ), SubResource( 8 ), SubResource( 9 ), SubResource( 10 ), SubResource( 11 ), SubResource( 12 ), SubResource( 13 ) ],
  57. "loop": true,
  58. "name": "default",
  59. "speed": 5.0
  60. } ]
  61. [sub_resource type="GDScript" id=15]
  62. script/source = "extends AnimatedSprite
  63. # Declare member variables here. Examples:
  64. # var a = 2
  65. # var b = \"text\"
  66. # Called when the node enters the scene tree for the first time.
  67. func _ready():
  68. $\"..\".connect(\"remoteplayer_velchange\", self, \"on_player_velchange\")
  69. # Called every frame. 'delta' is the elapsed time since the previous frame.
  70. #func _process(delta):
  71. # pass
  72. func on_player_velchange(velocity):
  73. if velocity.y < 0:
  74. self.frame = 10
  75. elif velocity.y > 0:
  76. self.frame = 0
  77. elif velocity.x < 0:
  78. self.frame = 5
  79. elif velocity.x > 0:
  80. self.frame = 6
  81. else:
  82. self.frame = 1
  83. "
  84. [node name="RemotePlayerBody" type="KinematicBody2D"]
  85. script = ExtResource( 2 )
  86. [node name="PlayerCollision" type="CollisionShape2D" parent="."]
  87. shape = SubResource( 1 )
  88. [node name="PlayerSprite" type="AnimatedSprite" parent="."]
  89. frames = SubResource( 14 )
  90. script = SubResource( 15 )