123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119 |
- [gd_scene load_steps=18 format=2]
- [ext_resource path="res://cat.png" type="Texture" id=1]
- [ext_resource path="res://Player.gd" type="Script" id=2]
- [sub_resource type="CircleShape2D" id=1]
- radius = 15.0
- [sub_resource type="AtlasTexture" id=2]
- flags = 4
- atlas = ExtResource( 1 )
- region = Rect2( 0, 0, 32, 32 )
- [sub_resource type="AtlasTexture" id=3]
- flags = 4
- atlas = ExtResource( 1 )
- region = Rect2( 32, 0, 32, 32 )
- [sub_resource type="AtlasTexture" id=4]
- flags = 4
- atlas = ExtResource( 1 )
- region = Rect2( 64, 0, 32, 32 )
- [sub_resource type="AtlasTexture" id=5]
- flags = 4
- atlas = ExtResource( 1 )
- region = Rect2( 0, 32, 32, 32 )
- [sub_resource type="AtlasTexture" id=6]
- flags = 4
- atlas = ExtResource( 1 )
- region = Rect2( 32, 32, 32, 32 )
- [sub_resource type="AtlasTexture" id=7]
- flags = 4
- atlas = ExtResource( 1 )
- region = Rect2( 64, 32, 32, 32 )
- [sub_resource type="AtlasTexture" id=8]
- flags = 4
- atlas = ExtResource( 1 )
- region = Rect2( 0, 64, 32, 32 )
- [sub_resource type="AtlasTexture" id=9]
- flags = 4
- atlas = ExtResource( 1 )
- region = Rect2( 32, 64, 32, 32 )
- [sub_resource type="AtlasTexture" id=10]
- flags = 4
- atlas = ExtResource( 1 )
- region = Rect2( 64, 64, 32, 32 )
- [sub_resource type="AtlasTexture" id=11]
- flags = 4
- atlas = ExtResource( 1 )
- region = Rect2( 0, 96, 32, 32 )
- [sub_resource type="AtlasTexture" id=12]
- flags = 4
- atlas = ExtResource( 1 )
- region = Rect2( 32, 96, 32, 32 )
- [sub_resource type="AtlasTexture" id=13]
- flags = 4
- atlas = ExtResource( 1 )
- region = Rect2( 64, 96, 32, 32 )
- [sub_resource type="SpriteFrames" id=14]
- animations = [ {
- "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 ) ],
- "loop": true,
- "name": "default",
- "speed": 5.0
- } ]
- [sub_resource type="GDScript" id=15]
- script/source = "extends AnimatedSprite
- # 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():
- $\"..\".connect(\"player_velchange\", self, \"on_player_velchange\")
- # Called every frame. 'delta' is the elapsed time since the previous frame.
- #func _process(delta):
- # pass
- func on_player_velchange(velocity):
- if velocity.y < 0:
- self.frame = 10
- elif velocity.y > 0:
- self.frame = 0
- elif velocity.x < 0:
- self.frame = 5
- elif velocity.x > 0:
- self.frame = 6
- else:
- self.frame = 1
- "
- [node name="PlayerBody" type="KinematicBody2D"]
- script = ExtResource( 2 )
- [node name="PlayerCollision" type="CollisionShape2D" parent="."]
- shape = SubResource( 1 )
- [node name="PlayerSprite" type="AnimatedSprite" parent="."]
- frames = SubResource( 14 )
- script = SubResource( 15 )
- [node name="Camera2D" type="Camera2D" parent="."]
|