Merge remote-tracking branch 'remotes/origin/stage'
This commit is contained in:
commit
8145f7ad86
|
@ -0,0 +1,18 @@
|
||||||
|
class_name Boundary
|
||||||
|
extends Node2D
|
||||||
|
|
||||||
|
@export var width = 200
|
||||||
|
|
||||||
|
# Called when the node enters the scene tree for the first time.
|
||||||
|
func _ready():
|
||||||
|
pass # Replace with function body.
|
||||||
|
|
||||||
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
|
func _process(delta):
|
||||||
|
pass
|
||||||
|
|
||||||
|
func get_most_left_position():
|
||||||
|
return global_position.x - width / 2
|
||||||
|
|
||||||
|
func get_most_right_position():
|
||||||
|
return global_position.x + width / 2
|
|
@ -0,0 +1,20 @@
|
||||||
|
extends Node2D
|
||||||
|
|
||||||
|
@export var move_speed = 100
|
||||||
|
@export var boundary: Boundary
|
||||||
|
|
||||||
|
# Called when the node enters the scene tree for the first time.
|
||||||
|
func _ready():
|
||||||
|
pass # Replace with function body.
|
||||||
|
|
||||||
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
|
func _process(delta):
|
||||||
|
if Input.is_action_pressed("move_right"):
|
||||||
|
position += Vector2.RIGHT * delta * move_speed
|
||||||
|
if position.x > boundary.get_most_right_position():
|
||||||
|
position = Vector2(boundary.get_most_right_position(), position.y)
|
||||||
|
|
||||||
|
if Input.is_action_pressed("move_left"):
|
||||||
|
position += Vector2.LEFT * delta * move_speed
|
||||||
|
if position.x < boundary.get_most_left_position():
|
||||||
|
position = Vector2(boundary.get_most_left_position(), position.y)
|
|
@ -0,0 +1,25 @@
|
||||||
|
[gd_scene load_steps=5 format=3 uid="uid://dw8tbafwj1rgo"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" path="res://scenes/Tim.gd" id="1_g3k2b"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://kq63ictuirhc" path="res://sprites/tim_side.png" id="1_saxit"]
|
||||||
|
[ext_resource type="Script" path="res://scenes/Boundary.gd" id="2_8p6ir"]
|
||||||
|
|
||||||
|
[sub_resource type="PlaceholderTexture2D" id="PlaceholderTexture2D_3hx6l"]
|
||||||
|
size = Vector2(600, 200)
|
||||||
|
|
||||||
|
[node name="Stage" type="Node2D"]
|
||||||
|
|
||||||
|
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||||
|
texture = SubResource("PlaceholderTexture2D_3hx6l")
|
||||||
|
offset = Vector2(0, -100)
|
||||||
|
|
||||||
|
[node name="Tim" type="Node2D" parent="." node_paths=PackedStringArray("boundary")]
|
||||||
|
script = ExtResource("1_g3k2b")
|
||||||
|
boundary = NodePath("../Boundary")
|
||||||
|
|
||||||
|
[node name="Sprite2D" type="Sprite2D" parent="Tim"]
|
||||||
|
texture = ExtResource("1_saxit")
|
||||||
|
offset = Vector2(0, -200)
|
||||||
|
|
||||||
|
[node name="Boundary" type="Node2D" parent="."]
|
||||||
|
script = ExtResource("2_8p6ir")
|
Binary file not shown.
After Width: | Height: | Size: 17 KiB |
|
@ -0,0 +1,34 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://kq63ictuirhc"
|
||||||
|
path="res://.godot/imported/tim_side.png-2080c0b8b2d695e4d35042c1d2710b4f.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://sprites/tim_side.png"
|
||||||
|
dest_files=["res://.godot/imported/tim_side.png-2080c0b8b2d695e4d35042c1d2710b4f.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
|
Loading…
Reference in New Issue