initial commit
This commit is contained in:
commit
71093b29f0
4
.editorconfig
Normal file
4
.editorconfig
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
charset = utf-8
|
||||||
2
.gitattributes
vendored
Normal file
2
.gitattributes
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
# Normalize EOL for all files that Git considers text files.
|
||||||
|
* text=auto eol=lf
|
||||||
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
# Godot 4+ specific ignores
|
||||||
|
.godot/
|
||||||
|
/android/
|
||||||
38
debug_label.gd
Normal file
38
debug_label.gd
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
@tool
|
||||||
|
#@icon
|
||||||
|
class_name DebugLabel
|
||||||
|
extends HBoxContainer
|
||||||
|
## Easy-to-use(?) container for visualizing variables
|
||||||
|
|
||||||
|
## Signals
|
||||||
|
## Enums
|
||||||
|
## Constants
|
||||||
|
## @export variables
|
||||||
|
@export var target: Node ## The Node this label applies to (usually its parent)
|
||||||
|
@export var variable_name: String ## The variable this label displays; check spelling and casing
|
||||||
|
## Regular variables
|
||||||
|
## @onready variables
|
||||||
|
@onready var title_label: Label = $TitleLabel
|
||||||
|
@onready var value_label: Label = $ValueLabel
|
||||||
|
|
||||||
|
## Overridden built-in virtual methods
|
||||||
|
#func _init() -> void:
|
||||||
|
#func _enter_tree() -> void:
|
||||||
|
func _ready() -> void:
|
||||||
|
title_label.text = variable_name.capitalize() + ": "
|
||||||
|
add_child(title_label)
|
||||||
|
add_child(value_label)
|
||||||
|
|
||||||
|
|
||||||
|
func _process(_delta: float) -> void:
|
||||||
|
if not Engine.is_editor_hint():
|
||||||
|
if target:
|
||||||
|
if variable_name:
|
||||||
|
var value = target.get(variable_name)
|
||||||
|
value_label.text = str(value)
|
||||||
|
|
||||||
|
#func _physics_process(delta: float) -> void:
|
||||||
|
## Remaining virtual methods
|
||||||
|
## Overridden custom methods
|
||||||
|
## Remaining methods
|
||||||
|
## Subclasses
|
||||||
1
debug_label.gd.uid
Normal file
1
debug_label.gd.uid
Normal file
@ -0,0 +1 @@
|
|||||||
|
uid://1txbj5djbkq0
|
||||||
14
debug_label.tscn
Normal file
14
debug_label.tscn
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
[gd_scene load_steps=2 format=3 uid="uid://bsmtdok8be7d8"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" uid="uid://1txbj5djbkq0" path="res://debug_label.gd" id="1_0rxpk"]
|
||||||
|
|
||||||
|
[node name="DebugLabel" type="HBoxContainer"]
|
||||||
|
script = ExtResource("1_0rxpk")
|
||||||
|
|
||||||
|
[node name="TitleLabel" type="Label" parent="."]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "VariableName: "
|
||||||
|
|
||||||
|
[node name="ValueLabel" type="Label" parent="."]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "##somevalue##"
|
||||||
1
icon.svg
Normal file
1
icon.svg
Normal file
@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="128" height="128"><rect width="124" height="124" x="2" y="2" fill="#363d52" stroke="#212532" stroke-width="4" rx="14"/><g fill="#fff" transform="translate(12.322 12.322)scale(.101)"><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 814 0v-39l-134 12-5 69q-2 10-14 13l-162 11q-12 0-16-11l-10-65H446l-10 65q-4 11-16 11l-162-11q-12-3-14-13l-5-69z"/><path d="M483 600c0 34 58 34 58 0v-86c0-34-58-34-58 0z"/><circle cx="725" cy="526" r="90"/><circle cx="299" cy="526" r="90"/></g><g fill="#414042" transform="translate(12.322 12.322)scale(.101)"><circle cx="307" cy="532" r="60"/><circle cx="717" cy="532" r="60"/></g></svg>
|
||||||
|
After Width: | Height: | Size: 995 B |
43
icon.svg.import
Normal file
43
icon.svg.import
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://croowm1661ut1"
|
||||||
|
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/uastc_level=0
|
||||||
|
compress/rdo_quality_loss=0.0
|
||||||
|
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/channel_remap/red=0
|
||||||
|
process/channel_remap/green=1
|
||||||
|
process/channel_remap/blue=2
|
||||||
|
process/channel_remap/alpha=3
|
||||||
|
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
|
||||||
22
main.tscn
Normal file
22
main.tscn
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
[gd_scene load_steps=4 format=3 uid="uid://dkt8o6fkbh5u"]
|
||||||
|
|
||||||
|
[ext_resource type="PackedScene" uid="uid://dyerg4wkjmayq" path="res://player.tscn" id="1_ig7tw"]
|
||||||
|
|
||||||
|
[sub_resource type="Gradient" id="Gradient_7dm0k"]
|
||||||
|
interpolation_mode = 2
|
||||||
|
colors = PackedColorArray(0.27022192, 0.27022192, 0.2702219, 1, 0.5290667, 0.52906674, 0.5290664, 1)
|
||||||
|
|
||||||
|
[sub_resource type="GradientTexture2D" id="GradientTexture2D_ig7tw"]
|
||||||
|
gradient = SubResource("Gradient_7dm0k")
|
||||||
|
width = 1024
|
||||||
|
height = 1024
|
||||||
|
fill_from = Vector2(0.5, 0.5)
|
||||||
|
fill_to = Vector2(0.55, 0.55)
|
||||||
|
repeat = 2
|
||||||
|
|
||||||
|
[node name="Main" type="Node2D"]
|
||||||
|
|
||||||
|
[node name="Background1" type="Sprite2D" parent="."]
|
||||||
|
texture = SubResource("GradientTexture2D_ig7tw")
|
||||||
|
|
||||||
|
[node name="Player" parent="." instance=ExtResource("1_ig7tw")]
|
||||||
39
player.gd
Normal file
39
player.gd
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
#@tool
|
||||||
|
#@icon
|
||||||
|
#class_name
|
||||||
|
extends CharacterBody2D
|
||||||
|
## Top-down player controller
|
||||||
|
|
||||||
|
## Signals
|
||||||
|
## Enums
|
||||||
|
## Constants
|
||||||
|
## @export variables
|
||||||
|
@export var speed: int = 100
|
||||||
|
@export var turning_speed: float = 0.1
|
||||||
|
## Regular variables
|
||||||
|
var thrust: float = 0.0
|
||||||
|
var rudder: float = 0.0
|
||||||
|
var yaw
|
||||||
|
var heading: Vector2 = Vector2.UP
|
||||||
|
## @onready variables
|
||||||
|
|
||||||
|
## Overridden built-in virtual methods
|
||||||
|
#func _init() -> void:
|
||||||
|
#func _enter_tree() -> void:
|
||||||
|
#func _ready() -> void:
|
||||||
|
#func _process(_delta: float) -> void:
|
||||||
|
|
||||||
|
func _physics_process(_delta: float) -> void:
|
||||||
|
thrust = Input.get_axis("backward", "forward")
|
||||||
|
rudder = Input.get_axis("turn_left", "turn_right")
|
||||||
|
yaw = rudder * turning_speed
|
||||||
|
|
||||||
|
heading = heading.rotated(yaw)
|
||||||
|
rotate(yaw)
|
||||||
|
|
||||||
|
velocity = thrust * heading * speed
|
||||||
|
move_and_slide()
|
||||||
|
## Remaining virtual methods
|
||||||
|
## Overridden custom methods
|
||||||
|
## Remaining methods
|
||||||
|
## Subclasses
|
||||||
1
player.gd.uid
Normal file
1
player.gd.uid
Normal file
@ -0,0 +1 @@
|
|||||||
|
uid://cmggbqdffjgwf
|
||||||
41
player.tscn
Normal file
41
player.tscn
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
[gd_scene load_steps=3 format=3 uid="uid://dyerg4wkjmayq"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" uid="uid://cmggbqdffjgwf" path="res://player.gd" id="1_4flbx"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://bsmtdok8be7d8" path="res://debug_label.tscn" id="3_i3pqv"]
|
||||||
|
|
||||||
|
[node name="Player" type="CharacterBody2D"]
|
||||||
|
motion_mode = 1
|
||||||
|
script = ExtResource("1_4flbx")
|
||||||
|
|
||||||
|
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="."]
|
||||||
|
position = Vector2(0, -0.16666603)
|
||||||
|
polygon = PackedVector2Array(0, -20, 10, 15, 0, 5, -10, 15)
|
||||||
|
|
||||||
|
[node name="Camera2D" type="Camera2D" parent="."]
|
||||||
|
zoom = Vector2(4, 4)
|
||||||
|
|
||||||
|
[node name="PlayerDebug" type="CanvasLayer" parent="."]
|
||||||
|
|
||||||
|
[node name="VBoxContainer" type="VBoxContainer" parent="PlayerDebug"]
|
||||||
|
offset_right = 40.0
|
||||||
|
offset_bottom = 40.0
|
||||||
|
|
||||||
|
[node name="ThrustLabel" parent="PlayerDebug/VBoxContainer" node_paths=PackedStringArray("target") instance=ExtResource("3_i3pqv")]
|
||||||
|
layout_mode = 2
|
||||||
|
target = NodePath("../../..")
|
||||||
|
variable_name = "thrust"
|
||||||
|
|
||||||
|
[node name="RudderLabel" parent="PlayerDebug/VBoxContainer" node_paths=PackedStringArray("target") instance=ExtResource("3_i3pqv")]
|
||||||
|
layout_mode = 2
|
||||||
|
target = NodePath("../../..")
|
||||||
|
variable_name = "rudder"
|
||||||
|
|
||||||
|
[node name="YawLabel" parent="PlayerDebug/VBoxContainer" node_paths=PackedStringArray("target") instance=ExtResource("3_i3pqv")]
|
||||||
|
layout_mode = 2
|
||||||
|
target = NodePath("../../..")
|
||||||
|
variable_name = "yaw"
|
||||||
|
|
||||||
|
[node name="HeadingLabel" parent="PlayerDebug/VBoxContainer" node_paths=PackedStringArray("target") instance=ExtResource("3_i3pqv")]
|
||||||
|
layout_mode = 2
|
||||||
|
target = NodePath("../../..")
|
||||||
|
variable_name = "heading"
|
||||||
43
project.godot
Normal file
43
project.godot
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
; 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="trijam-355-inconvenient-superpowers"
|
||||||
|
run/main_scene="uid://dkt8o6fkbh5u"
|
||||||
|
config/features=PackedStringArray("4.5", "Forward Plus")
|
||||||
|
config/icon="res://icon.svg"
|
||||||
|
|
||||||
|
[input]
|
||||||
|
|
||||||
|
forward={
|
||||||
|
"deadzone": 0.2,
|
||||||
|
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":87,"key_label":0,"unicode":119,"location":0,"echo":false,"script":null)
|
||||||
|
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194320,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
backward={
|
||||||
|
"deadzone": 0.2,
|
||||||
|
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":83,"key_label":0,"unicode":115,"location":0,"echo":false,"script":null)
|
||||||
|
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194322,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
turn_left={
|
||||||
|
"deadzone": 0.2,
|
||||||
|
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":65,"key_label":0,"unicode":97,"location":0,"echo":false,"script":null)
|
||||||
|
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194319,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
turn_right={
|
||||||
|
"deadzone": 0.2,
|
||||||
|
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":68,"key_label":0,"unicode":100,"location":0,"echo":false,"script":null)
|
||||||
|
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194321,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user