main
Leon Anžel 2023-12-26 14:31:56 +01:00
commit 007a526ddf
10 changed files with 159 additions and 0 deletions

2
.gitattributes vendored 100644
View File

@ -0,0 +1,2 @@
# Normalize EOL for all files that Git considers text files.
* text=auto eol=lf

2
.gitignore vendored 100644
View File

@ -0,0 +1,2 @@
# Godot 4+ specific ignores
.godot/

0
README.md 100644
View File

24
game.tscn 100644
View File

@ -0,0 +1,24 @@
[gd_scene load_steps=3 format=3 uid="uid://ew5kw35yq5og"]
[ext_resource type="Script" path="res://game_logic.gd" id="1_08qwr"]
[ext_resource type="PackedScene" uid="uid://c3q3kuwyx3wju" path="res://player/player.tscn" id="1_16bpk"]
[node name="game" type="Node"]
[node name="game_logic" type="Node" parent="."]
script = ExtResource("1_08qwr")
[node name="canvas" type="Node2D" parent="."]
[node name="player" parent="canvas" instance=ExtResource("1_16bpk")]
position = Vector2(187, 188)
rotation = 1.5708
[node name="trails" type="Node2D" parent="canvas"]
[node name="player_trail" type="Node2D" parent="canvas/trails" groups=["player_trail"]]
[node name="trail_line" type="Line2D" parent="canvas/trails/player_trail" groups=["trail_line"]]
width = 5.0
default_color = Color(0, 0.360784, 1, 1)
joint_mode = 2

10
game_logic.gd 100644
View File

@ -0,0 +1,10 @@
extends Node
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.
func _input(event):
if event.is_action_pressed(&"ui_cancel"):
get_tree().quit()

1
icon.svg 100644
View File

@ -0,0 +1 @@
<svg height="128" width="128" xmlns="http://www.w3.org/2000/svg"><rect x="2" y="2" width="124" height="124" rx="14" fill="#363d52" stroke="#212532" stroke-width="4"/><g transform="scale(.101) translate(122 122)"><g fill="#fff"><path d="M105 673v33q407 354 814 0v-33z"/><path fill="#478cbf" d="m105 673 152 14q12 1 15 14l4 67 132 10 8-61q2-11 15-15h162q13 4 15 15l8 61 132-10 4-67q3-13 15-14l152-14V427q30-39 56-81-35-59-83-108-43 20-82 47-40-37-88-64 7-51 8-102-59-28-123-42-26 43-46 89-49-7-98 0-20-46-46-89-64 14-123 42 1 51 8 102-48 27-88 64-39-27-82-47-48 49-83 108 26 42 56 81zm0 33v39c0 276 813 276 813 0v-39l-134 12-5 69q-2 10-14 13l-162 11q-12 0-16-11l-10-65H447l-10 65q-4 11-16 11l-162-11q-12-3-14-13l-5-69z"/><path d="M483 600c3 34 55 34 58 0v-86c-3-34-55-34-58 0z"/><circle cx="725" cy="526" r="90"/><circle cx="299" cy="526" r="90"/></g><g fill="#414042"><circle cx="307" cy="532" r="60"/><circle cx="717" cy="532" r="60"/></g></g></svg>

After

Width:  |  Height:  |  Size: 950 B

37
icon.svg.import 100644
View File

@ -0,0 +1,37 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bpkj0f25cae3w"
path="res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://icon.svg"
dest_files=["res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
svg/scale=1.0
editor/scale_with_editor_scale=false
editor/convert_colors_with_editor_theme=false

43
player/player.gd 100644
View File

@ -0,0 +1,43 @@
extends CharacterBody2D
var rotation_speed = 0.1
var movement_speed = 2
var direction
var player_trail
var trail_line
var previous_position
var left
var right
func _ready():
player_trail = get_tree().get_first_node_in_group(&"player_trail")
trail_line = get_tree().get_first_node_in_group(&"trail_line")
previous_position = $trail_spawner.global_position
func _physics_process(delta):
left = Input.is_action_pressed(&"ui_left")
right = Input.is_action_pressed(&"ui_right")
# holding down both buttons should do nothing
if left or right:
if left:
rotate(-rotation_speed)
if right:
rotate(rotation_speed)
direction = Vector2(0, -movement_speed).rotated(rotation)
var collision = move_and_collide(direction)
if collision:
player_trail.queue_free()
queue_free()
trail_line.add_point($trail_spawner.global_position)
var new_collision_segment = StaticBody2D.new()
var new_collision_shape = CollisionShape2D.new()
var new_segment = SegmentShape2D.new()
new_segment.a = previous_position
new_segment.b = $trail_spawner.global_position
new_collision_shape.shape = new_segment
new_collision_segment.add_child(new_collision_shape)
player_trail.add_child(new_collision_segment)
previous_position = $trail_spawner.global_position

19
player/player.tscn 100644
View File

@ -0,0 +1,19 @@
[gd_scene load_steps=3 format=3 uid="uid://c3q3kuwyx3wju"]
[ext_resource type="Script" path="res://player/player.gd" id="1_rgaqq"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_gaw8f"]
size = Vector2(6, 20)
[node name="player" type="CharacterBody2D"]
script = ExtResource("1_rgaqq")
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
shape = SubResource("RectangleShape2D_gaw8f")
[node name="Polygon2D" type="Polygon2D" parent="."]
color = Color(0.0019802, 0.232666, 0.857673, 1)
polygon = PackedVector2Array(-3, -10, -6, 10, 6, 10, 3, -10)
[node name="trail_spawner" type="Marker2D" parent="."]
position = Vector2(0, 10)

21
project.godot 100644
View File

@ -0,0 +1,21 @@
; Engine configuration file.
; It's best edited using the editor UI and not directly,
; since the parameters that go here are not all obvious.
;
; Format:
; [section] ; section goes between []
; param=value ; assign values to parameters
config_version=5
[application]
config/name="curve prototype"
run/main_scene="res://game.tscn"
config/features=PackedStringArray("4.3")
config/icon="res://icon.svg"
[global_group]
trail_line=""
player_trail=""