Finished coin counter
This commit is contained in:
@@ -1,35 +0,0 @@
|
||||
[gd_scene load_steps=6 format=2]
|
||||
|
||||
[ext_resource path="res://assets/coin.png" type="Texture" id=1]
|
||||
|
||||
[sub_resource type="CircleShape2D" id=1]
|
||||
radius = 6.0
|
||||
|
||||
[sub_resource type="AtlasTexture" id=2]
|
||||
atlas = ExtResource( 1 )
|
||||
region = Rect2( 0, 0, 18, 18 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=3]
|
||||
atlas = ExtResource( 1 )
|
||||
region = Rect2( 18, 0, 18, 18 )
|
||||
|
||||
[sub_resource type="SpriteFrames" id=4]
|
||||
animations = [ {
|
||||
"frames": [ SubResource( 2 ), SubResource( 3 ) ],
|
||||
"loop": true,
|
||||
"name": "spin",
|
||||
"speed": 5.0
|
||||
} ]
|
||||
|
||||
[node name="coin" type="Area2D"]
|
||||
collision_layer = 4
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
position = Vector2( 9, 9 )
|
||||
shape = SubResource( 1 )
|
||||
|
||||
[node name="AnimatedSprite" type="AnimatedSprite" parent="."]
|
||||
frames = SubResource( 4 )
|
||||
animation = "spin"
|
||||
playing = true
|
||||
centered = false
|
8
godot/hud/coin/Counter.gdns
Normal file
8
godot/hud/coin/Counter.gdns
Normal file
@@ -0,0 +1,8 @@
|
||||
[gd_resource type="NativeScript" load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://gdnative/alai.tres" type="GDNativeLibrary" id=1]
|
||||
|
||||
[resource]
|
||||
resource_name = "CoinCounter"
|
||||
class_name = "CoinCounter"
|
||||
library = ExtResource( 1 )
|
@@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=8 format=2]
|
||||
[gd_scene load_steps=12 format=2]
|
||||
|
||||
[ext_resource path="res://CameraLimit.gdns" type="Script" id=1]
|
||||
[ext_resource path="res://characters/player/Player.tscn" type="PackedScene" id=2]
|
||||
@@ -6,10 +6,27 @@
|
||||
[ext_resource path="res://assets/backgrounds/mountains.png" type="Texture" id=4]
|
||||
[ext_resource path="res://collectables/coin/Coin.tscn" type="PackedScene" id=5]
|
||||
[ext_resource path="res://assets/coin.png" type="Texture" id=6]
|
||||
[ext_resource path="res://hud/coin/Counter.gdns" type="Script" id=7]
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id=1]
|
||||
bg_color = Color( 0, 0, 0, 0.541176 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=2]
|
||||
atlas = ExtResource( 6 )
|
||||
region = Rect2( 0, 0, 18, 18 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=3]
|
||||
atlas = ExtResource( 6 )
|
||||
region = Rect2( 18, 0, 18, 18 )
|
||||
|
||||
[sub_resource type="SpriteFrames" id=4]
|
||||
animations = [ {
|
||||
"frames": [ SubResource( 2 ), SubResource( 3 ) ],
|
||||
"loop": true,
|
||||
"name": "spin",
|
||||
"speed": 5.0
|
||||
} ]
|
||||
|
||||
[node name="Prototype" type="Node2D"]
|
||||
|
||||
[node name="Player" parent="." instance=ExtResource( 2 )]
|
||||
@@ -46,12 +63,6 @@ centered = false
|
||||
[node name="Prototype" parent="Map" instance=ExtResource( 3 )]
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="coin" parent="." instance=ExtResource( 5 )]
|
||||
position = Vector2( 72, 450 )
|
||||
|
||||
[node name="coin2" parent="." instance=ExtResource( 5 )]
|
||||
position = Vector2( 234, 450 )
|
||||
|
||||
[node name="CoinHUD" type="CanvasLayer" parent="."]
|
||||
|
||||
[node name="Panel" type="Panel" parent="CoinHUD"]
|
||||
@@ -61,25 +72,35 @@ margin_right = 288.0
|
||||
margin_bottom = 54.0
|
||||
custom_styles/panel = SubResource( 1 )
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="CoinHUD"]
|
||||
margin_left = 144.0
|
||||
margin_top = 18.0
|
||||
margin_right = 184.0
|
||||
margin_bottom = 58.0
|
||||
texture = ExtResource( 6 )
|
||||
|
||||
[node name="Label" type="Label" parent="CoinHUD"]
|
||||
margin_left = 198.0
|
||||
margin_left = 180.0
|
||||
margin_top = 18.0
|
||||
margin_right = 238.0
|
||||
margin_right = 220.0
|
||||
margin_bottom = 36.0
|
||||
text = "X"
|
||||
|
||||
[node name="Coins" type="Label" parent="CoinHUD"]
|
||||
margin_left = 216.0
|
||||
margin_left = 198.0
|
||||
margin_top = 18.0
|
||||
margin_right = 256.0
|
||||
margin_right = 238.0
|
||||
margin_bottom = 32.0
|
||||
text = "##"
|
||||
script = ExtResource( 7 )
|
||||
|
||||
[connection signal="ready" from="CoinHUD" to="Player" method="_on_CoinHUD_ready"]
|
||||
[node name="AnimatedSprite" type="AnimatedSprite" parent="CoinHUD"]
|
||||
position = Vector2( 162, 18 )
|
||||
frames = SubResource( 4 )
|
||||
animation = "spin"
|
||||
frame = 1
|
||||
playing = true
|
||||
centered = false
|
||||
|
||||
[node name="Coins" type="Node" parent="."]
|
||||
|
||||
[node name="coin" parent="Coins" instance=ExtResource( 5 )]
|
||||
position = Vector2( 72, 450 )
|
||||
|
||||
[node name="coin2" parent="Coins" instance=ExtResource( 5 )]
|
||||
position = Vector2( 234, 450 )
|
||||
|
||||
[editable path="Coins/coin"]
|
||||
|
Reference in New Issue
Block a user