Skip to content

Commit

Permalink
Merge pull request #53 from Lateasusual/main
Browse files Browse the repository at this point in the history
Add a happy little trail
  • Loading branch information
TaylorAnderson authored Apr 9, 2022
2 parents f132e83 + 289550b commit ca6d318
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 5 deletions.
26 changes: 21 additions & 5 deletions scenes/Player.tscn
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
[gd_scene load_steps=14 format=2]
[gd_scene load_steps=18 format=2]

[ext_resource path="res://sfx/jump.wav" type="AudioStream" id=1]
[ext_resource path="res://sprites/mario.png" type="Texture" id=2]
[ext_resource path="res://scripts/Player.gd" type="Script" id=3]
[ext_resource path="res://scripts/Trail.gd" type="Script" id=4]
[ext_resource path="res://sprites/flag.jpg" type="Texture" id=5]

[sub_resource type="Curve" id=11]
_data = [ Vector2( 0, 0 ), 0.0, 2.49311, 0, 0, Vector2( 1, 1 ), 0.329092, 0.0, 0, 0 ]

[sub_resource type="Gradient" id=12]
colors = PoolColorArray( 0, 0, 0, 0, 1, 1, 1, 1 )

[sub_resource type="RectangleShape2D" id=1]
extents = Vector2( 23.5, 27 )
Expand Down Expand Up @@ -39,17 +47,13 @@ region = Rect2( 96, 32, 32, 32 )
atlas = ExtResource( 2 )
region = Rect2( 128, 32, 32, 32 )

[sub_resource type="AtlasTexture" id=9]
atlas = ExtResource( 2 )
region = Rect2( 160, 32, 32, 32 )
[sub_resource type="SpriteFrames" id=10]
animations = [ {
"frames": [ SubResource( 2 ) ],
"loop": true,
"name": "idle",
"speed": 5.0
}, {

"frames": [ SubResource( 9 ) ],
"loop": true,
"name": "jump",
Expand All @@ -66,6 +70,18 @@ z_index = 1
collision_mask = 14
script = ExtResource( 3 )

[node name="Trail" type="Line2D" parent="."]
width = 30.0
width_curve = SubResource( 11 )
default_color = Color( 1, 1, 1, 1 )
gradient = SubResource( 12 )
texture = ExtResource( 5 )
texture_mode = 2
joint_mode = 2
end_cap_mode = 2
script = ExtResource( 4 )
trail_length = 30

[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2( -0.5, 5 )
shape = SubResource( 1 )
Expand Down
14 changes: 14 additions & 0 deletions scripts/Trail.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
extends Line2D

export(int) var trail_length = 5;
var positions = []

onready var parent = get_parent()

func _process(delta):
self.global_position = Vector2(0.0, 0.0)

while len(positions) > trail_length:
positions.pop_front()
positions.push_back(parent.global_position)
points = PoolVector2Array(positions)
Binary file added sprites/flag.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit ca6d318

Please sign in to comment.