coins~
This commit is contained in:
parent
792dd99546
commit
37a19d8788
14 changed files with 379 additions and 105 deletions
19
Prefabs/coin.gd
Normal file
19
Prefabs/coin.gd
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
extends Area2D
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
modulate = Storyteller.current_coin_color
|
||||
|
||||
|
||||
func _on_body_entered(body: Node2D) -> void:
|
||||
if body is RigidBody2D:
|
||||
#body.apply_force((body.global_position - global_position).normalized() *10000)
|
||||
#body.linear_velocity = (body.global_position - global_position).normalized() *100
|
||||
queue_free()
|
||||
body.got_points.emit()
|
||||
1
Prefabs/coin.gd.uid
Normal file
1
Prefabs/coin.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://do7o4q625abg3
|
||||
73
Prefabs/coin.tscn
Normal file
73
Prefabs/coin.tscn
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
[gd_scene load_steps=11 format=3 uid="uid://b7km814mwwsvv"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://do7o4q625abg3" path="res://Prefabs/coin.gd" id="1_ilgmi"]
|
||||
[ext_resource type="Texture2D" uid="uid://bnd3eacyt5x70" path="res://Sprites/coinspin.png" id="2_cbfdx"]
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_oi7sn"]
|
||||
atlas = ExtResource("2_cbfdx")
|
||||
region = Rect2(0, 0, 15, 15)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_thoqv"]
|
||||
atlas = ExtResource("2_cbfdx")
|
||||
region = Rect2(15, 0, 15, 15)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_h4ckm"]
|
||||
atlas = ExtResource("2_cbfdx")
|
||||
region = Rect2(30, 0, 15, 15)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_ewynv"]
|
||||
atlas = ExtResource("2_cbfdx")
|
||||
region = Rect2(45, 0, 15, 15)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_i2k62"]
|
||||
atlas = ExtResource("2_cbfdx")
|
||||
region = Rect2(60, 0, 15, 15)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_f2p4i"]
|
||||
atlas = ExtResource("2_cbfdx")
|
||||
region = Rect2(75, 0, 15, 15)
|
||||
|
||||
[sub_resource type="SpriteFrames" id="SpriteFrames_4nl6u"]
|
||||
animations = [{
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_oi7sn")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_thoqv")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_h4ckm")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_ewynv")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_i2k62")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_f2p4i")
|
||||
}],
|
||||
"loop": true,
|
||||
"name": &"new_animation",
|
||||
"speed": 10.0
|
||||
}]
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_ar03h"]
|
||||
radius = 6.0
|
||||
|
||||
[node name="Coin" type="Area2D"]
|
||||
script = ExtResource("1_ilgmi")
|
||||
|
||||
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
|
||||
scale = Vector2(0.8, 0.8)
|
||||
sprite_frames = SubResource("SpriteFrames_4nl6u")
|
||||
animation = &"new_animation"
|
||||
autoplay = "new_animation"
|
||||
frame_progress = 0.29463264
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
visible = false
|
||||
shape = SubResource("CircleShape2D_ar03h")
|
||||
|
||||
[connection signal="body_entered" from="." to="." method="_on_body_entered"]
|
||||
Loading…
Add table
Add a link
Reference in a new issue