Merge branch 'feature/sticker'
# Conflicts: # export_presets.cfg
This commit is contained in:
commit
5b6edfa836
20 changed files with 666 additions and 7 deletions
121
core/Cur6C3A.tmp
Normal file
121
core/Cur6C3A.tmp
Normal file
|
@ -0,0 +1,121 @@
|
||||||
|
[gd_scene load_steps=8 format=3 uid="uid://524sv8spw6go"]
|
||||||
|
|
||||||
|
[ext_resource type="Texture2D" uid="uid://q1rdbr8uh78r" path="res://textures/cursor_default.tres" id="1_50ts1"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://bdstohvc7pvot" path="res://textures/cursor_click.tres" id="1_h0do2"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://buxws7r3kn0d7" path="res://textures/cursor_grab_01.tres" id="3_fj3w4"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://pbahcjllgjjq" path="res://textures/cursor_grab_02.tres" id="4_153q8"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://6fajq480n7se" path="res://textures/cursor_grab_03.tres" id="5_tsejy"]
|
||||||
|
|
||||||
|
[sub_resource type="GDScript" id="GDScript_h2l04"]
|
||||||
|
script/source = "extends Node2D
|
||||||
|
|
||||||
|
const Speed:float = 900
|
||||||
|
|
||||||
|
var spaceState
|
||||||
|
var query
|
||||||
|
var CastResult
|
||||||
|
var old_result
|
||||||
|
var selectedSticker
|
||||||
|
|
||||||
|
|
||||||
|
# Called when the node enters the scene tree for the first time.
|
||||||
|
func _ready():
|
||||||
|
if not OS.is_debug_build():
|
||||||
|
Input.set_mouse_mode(Input.MOUSE_MODE_CONFINED_HIDDEN)
|
||||||
|
query = PhysicsPointQueryParameters2D.new()
|
||||||
|
spaceState = get_world_2d()
|
||||||
|
|
||||||
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
|
func _process(delta):
|
||||||
|
|
||||||
|
#region Mouse Position
|
||||||
|
position = get_global_mouse_position()
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
pointcast()
|
||||||
|
cursor_look()
|
||||||
|
|
||||||
|
|
||||||
|
func pointcast():
|
||||||
|
query.collide_with_areas = true
|
||||||
|
query.position = get_global_mouse_position()
|
||||||
|
CastResult = spaceState.direct_space_state.intersect_point(query)
|
||||||
|
if ( (CastResult.size() > 0) and (old_result != CastResult) ):
|
||||||
|
old_result = CastResult
|
||||||
|
for _result in CastResult:
|
||||||
|
if (_result.collider.input_pickable == true):
|
||||||
|
selectedSticker = _result.collider.get_parent()
|
||||||
|
print(\"selected sticker %\",selectedSticker)
|
||||||
|
|
||||||
|
|
||||||
|
if (CastResult.size() == 0):
|
||||||
|
CastResult.clear()
|
||||||
|
old_result = null
|
||||||
|
selectedSticker = null
|
||||||
|
|
||||||
|
func cursor_look():
|
||||||
|
$AnimatedSprite2D.play(\"default\")
|
||||||
|
if (Input.is_action_pressed(\"select\")):
|
||||||
|
if (selectedSticker):
|
||||||
|
$AnimatedSprite2D.play(\"grab\")
|
||||||
|
else:
|
||||||
|
$AnimatedSprite2D.play(\"click\")
|
||||||
|
else:
|
||||||
|
if (selectedSticker):
|
||||||
|
$AnimatedSprite2D.play(\"grab_intro\")
|
||||||
|
|
||||||
|
|
||||||
|
"
|
||||||
|
|
||||||
|
[sub_resource type="SpriteFrames" id="SpriteFrames_u3xkr"]
|
||||||
|
resource_local_to_scene = true
|
||||||
|
animations = [{
|
||||||
|
"frames": [{
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": ExtResource("1_h0do2")
|
||||||
|
}],
|
||||||
|
"loop": true,
|
||||||
|
"name": &"click",
|
||||||
|
"speed": 5.0
|
||||||
|
}, {
|
||||||
|
"frames": [{
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": ExtResource("1_50ts1")
|
||||||
|
}],
|
||||||
|
"loop": true,
|
||||||
|
"name": &"default",
|
||||||
|
"speed": 5.0
|
||||||
|
}, {
|
||||||
|
"frames": [{
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": ExtResource("3_fj3w4")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": ExtResource("4_153q8")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": ExtResource("5_tsejy")
|
||||||
|
}],
|
||||||
|
"loop": true,
|
||||||
|
"name": &"grab",
|
||||||
|
"speed": 7.0
|
||||||
|
}, {
|
||||||
|
"frames": [{
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": ExtResource("3_fj3w4")
|
||||||
|
}],
|
||||||
|
"loop": true,
|
||||||
|
"name": &"grab_intro",
|
||||||
|
"speed": 5.0
|
||||||
|
}]
|
||||||
|
|
||||||
|
[node name="Cursor" type="Node2D"]
|
||||||
|
top_level = true
|
||||||
|
script = SubResource("GDScript_h2l04")
|
||||||
|
|
||||||
|
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
|
||||||
|
scale = Vector2(1.5, 1.5)
|
||||||
|
sprite_frames = SubResource("SpriteFrames_u3xkr")
|
||||||
|
animation = &"grab"
|
||||||
|
centered = false
|
||||||
|
offset = Vector2(-80, -190)
|
121
core/Cur9BFD.tmp
Normal file
121
core/Cur9BFD.tmp
Normal file
|
@ -0,0 +1,121 @@
|
||||||
|
[gd_scene load_steps=8 format=3 uid="uid://524sv8spw6go"]
|
||||||
|
|
||||||
|
[ext_resource type="Texture2D" uid="uid://q1rdbr8uh78r" path="res://textures/cursor_default.tres" id="1_50ts1"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://bdstohvc7pvot" path="res://textures/cursor_click.tres" id="1_h0do2"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://buxws7r3kn0d7" path="res://textures/cursor_grab_01.tres" id="3_fj3w4"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://pbahcjllgjjq" path="res://textures/cursor_grab_02.tres" id="4_153q8"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://6fajq480n7se" path="res://textures/cursor_grab_03.tres" id="5_tsejy"]
|
||||||
|
|
||||||
|
[sub_resource type="GDScript" id="GDScript_h2l04"]
|
||||||
|
script/source = "extends Node2D
|
||||||
|
|
||||||
|
const Speed:float = 900
|
||||||
|
|
||||||
|
var spaceState
|
||||||
|
var query
|
||||||
|
var CastResult
|
||||||
|
var old_result
|
||||||
|
var selectedSticker
|
||||||
|
|
||||||
|
|
||||||
|
# Called when the node enters the scene tree for the first time.
|
||||||
|
func _ready():
|
||||||
|
if not OS.is_debug_build():
|
||||||
|
Input.set_mouse_mode(Input.MOUSE_MODE_CONFINED_HIDDEN)
|
||||||
|
query = PhysicsPointQueryParameters2D.new()
|
||||||
|
spaceState = get_world_2d()
|
||||||
|
|
||||||
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
|
func _process(delta):
|
||||||
|
|
||||||
|
#region Mouse Position
|
||||||
|
position = get_global_mouse_position()
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
pointcast()
|
||||||
|
cursor_look()
|
||||||
|
|
||||||
|
|
||||||
|
func pointcast():
|
||||||
|
query.collide_with_areas = true
|
||||||
|
query.position = get_global_mouse_position()
|
||||||
|
CastResult = spaceState.direct_space_state.intersect_point(query)
|
||||||
|
if ( (CastResult.size() > 0) and (old_result != CastResult) ):
|
||||||
|
old_result = CastResult
|
||||||
|
for _result in CastResult:
|
||||||
|
if (_result.collider.input_pickable == true):
|
||||||
|
selectedSticker = _result.collider.get_parent()
|
||||||
|
print(\"selected sticker %\",selectedSticker)
|
||||||
|
|
||||||
|
|
||||||
|
if (CastResult.size() == 0):
|
||||||
|
CastResult.clear()
|
||||||
|
old_result = null
|
||||||
|
selectedSticker = null
|
||||||
|
|
||||||
|
func cursor_look():
|
||||||
|
$AnimatedSprite2D.play(\"default\")
|
||||||
|
if (Input.is_action_pressed(\"select\")):
|
||||||
|
if (selectedSticker):
|
||||||
|
$AnimatedSprite2D.play(\"grab\")
|
||||||
|
else:
|
||||||
|
$AnimatedSprite2D.play(\"click\")
|
||||||
|
if (selectedSticker):
|
||||||
|
$AnimatedSprite2D.play(\"grab_intro\")
|
||||||
|
|
||||||
|
|
||||||
|
"
|
||||||
|
|
||||||
|
[sub_resource type="SpriteFrames" id="SpriteFrames_u3xkr"]
|
||||||
|
resource_local_to_scene = true
|
||||||
|
animations = [{
|
||||||
|
"frames": [{
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": ExtResource("1_h0do2")
|
||||||
|
}],
|
||||||
|
"loop": true,
|
||||||
|
"name": &"click",
|
||||||
|
"speed": 5.0
|
||||||
|
}, {
|
||||||
|
"frames": [{
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": ExtResource("1_50ts1")
|
||||||
|
}],
|
||||||
|
"loop": true,
|
||||||
|
"name": &"default",
|
||||||
|
"speed": 5.0
|
||||||
|
}, {
|
||||||
|
"frames": [{
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": ExtResource("3_fj3w4")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": ExtResource("4_153q8")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": ExtResource("5_tsejy")
|
||||||
|
}],
|
||||||
|
"loop": true,
|
||||||
|
"name": &"grab",
|
||||||
|
"speed": 7.0
|
||||||
|
}, {
|
||||||
|
"frames": [{
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": ExtResource("3_fj3w4")
|
||||||
|
}],
|
||||||
|
"loop": true,
|
||||||
|
"name": &"grab_intro",
|
||||||
|
"speed": 5.0
|
||||||
|
}]
|
||||||
|
|
||||||
|
[node name="Cursor" type="Node2D"]
|
||||||
|
top_level = true
|
||||||
|
script = SubResource("GDScript_h2l04")
|
||||||
|
|
||||||
|
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
|
||||||
|
scale = Vector2(1.5, 1.5)
|
||||||
|
sprite_frames = SubResource("SpriteFrames_u3xkr")
|
||||||
|
animation = &"grab"
|
||||||
|
autoplay = "grab"
|
||||||
|
centered = false
|
||||||
|
offset = Vector2(-80, -190)
|
160
core/Cursor.tscn
Normal file
160
core/Cursor.tscn
Normal file
|
@ -0,0 +1,160 @@
|
||||||
|
[gd_scene load_steps=8 format=3 uid="uid://524sv8spw6go"]
|
||||||
|
|
||||||
|
[ext_resource type="Texture2D" uid="uid://q1rdbr8uh78r" path="res://textures/cursor_default.tres" id="1_50ts1"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://bdstohvc7pvot" path="res://textures/cursor_click.tres" id="1_h0do2"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://buxws7r3kn0d7" path="res://textures/cursor_grab_01.tres" id="3_fj3w4"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://pbahcjllgjjq" path="res://textures/cursor_grab_02.tres" id="4_153q8"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://6fajq480n7se" path="res://textures/cursor_grab_03.tres" id="5_tsejy"]
|
||||||
|
|
||||||
|
[sub_resource type="GDScript" id="GDScript_h2l04"]
|
||||||
|
script/source = "extends Node2D
|
||||||
|
|
||||||
|
const Speed:float = 900
|
||||||
|
|
||||||
|
var spaceState
|
||||||
|
var query
|
||||||
|
var CastResult
|
||||||
|
var old_result
|
||||||
|
var selectedSticker
|
||||||
|
enum CURSOR_STATE {DEFAULT, CLICK, GRAB, GRABBED}
|
||||||
|
var currentCursorState:CURSOR_STATE
|
||||||
|
var oldCursorState:CURSOR_STATE
|
||||||
|
|
||||||
|
# Called when the node enters the scene tree for the first time.
|
||||||
|
func _ready():
|
||||||
|
if not OS.is_debug_build():
|
||||||
|
Input.set_mouse_mode(Input.MOUSE_MODE_CONFINED_HIDDEN)
|
||||||
|
query = PhysicsPointQueryParameters2D.new()
|
||||||
|
spaceState = get_world_2d()
|
||||||
|
|
||||||
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
|
func _process(delta):
|
||||||
|
|
||||||
|
#region Mouse Position
|
||||||
|
position = get_global_mouse_position()
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
pointcast()
|
||||||
|
cursor_look()
|
||||||
|
|
||||||
|
|
||||||
|
func isSticker(selectedObject:Node):
|
||||||
|
var _isSticker:bool = false
|
||||||
|
var _tags = getTags(selectedObject)
|
||||||
|
if (_tags.size() > 0):
|
||||||
|
if (_tags.find(\"sticker\") != -1):
|
||||||
|
_isSticker = true
|
||||||
|
|
||||||
|
return _isSticker
|
||||||
|
|
||||||
|
func getTags(selectedObject:Node):
|
||||||
|
var _tags: Array
|
||||||
|
if (selectedObject.has_meta(\"tags\")):
|
||||||
|
_tags = selectedObject.get_meta(\"tags\")
|
||||||
|
return _tags
|
||||||
|
else:
|
||||||
|
printerr(\"no tags inside %\",selectedObject)
|
||||||
|
return _tags
|
||||||
|
|
||||||
|
|
||||||
|
func pointcast():
|
||||||
|
query.collide_with_areas = true
|
||||||
|
query.position = get_global_mouse_position()
|
||||||
|
CastResult = spaceState.direct_space_state.intersect_point(query)
|
||||||
|
if ( (CastResult.size() > 0) and (old_result != CastResult) ):
|
||||||
|
old_result = CastResult
|
||||||
|
if (CastResult.size()> 2):
|
||||||
|
breakpoint # should not detect multiple areas
|
||||||
|
for _result in CastResult:
|
||||||
|
if (_result.collider.input_pickable == true):
|
||||||
|
selectedSticker = _result.collider.get_parent()
|
||||||
|
if (isSticker(selectedSticker)):
|
||||||
|
print(\"selected sticker %\",selectedSticker)
|
||||||
|
else:
|
||||||
|
selectedSticker = null
|
||||||
|
if (CastResult.size() == 0 ):
|
||||||
|
CastResult.clear()
|
||||||
|
old_result = null
|
||||||
|
selectedSticker = null
|
||||||
|
|
||||||
|
func cursor_look():
|
||||||
|
|
||||||
|
if (Input.is_action_pressed(\"select\")):
|
||||||
|
if (selectedSticker):
|
||||||
|
currentCursorState = CURSOR_STATE.GRABBED
|
||||||
|
else:
|
||||||
|
currentCursorState = CURSOR_STATE.CLICK
|
||||||
|
else:
|
||||||
|
if (selectedSticker):
|
||||||
|
currentCursorState = CURSOR_STATE.GRAB
|
||||||
|
else:
|
||||||
|
currentCursorState = CURSOR_STATE.DEFAULT
|
||||||
|
|
||||||
|
if (currentCursorState != oldCursorState):
|
||||||
|
oldCursorState = currentCursorState
|
||||||
|
match oldCursorState:
|
||||||
|
CURSOR_STATE.DEFAULT:
|
||||||
|
$AnimatedSprite2D.play(\"default\")
|
||||||
|
CURSOR_STATE.CLICK:
|
||||||
|
$AnimatedSprite2D.play(\"click\")
|
||||||
|
CURSOR_STATE.GRAB:
|
||||||
|
$AnimatedSprite2D.play(\"grab_intro\")
|
||||||
|
CURSOR_STATE.GRABBED:
|
||||||
|
$AnimatedSprite2D.play(\"grab\")
|
||||||
|
"
|
||||||
|
|
||||||
|
[sub_resource type="SpriteFrames" id="SpriteFrames_u3xkr"]
|
||||||
|
resource_local_to_scene = true
|
||||||
|
animations = [{
|
||||||
|
"frames": [{
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": ExtResource("1_h0do2")
|
||||||
|
}],
|
||||||
|
"loop": true,
|
||||||
|
"name": &"click",
|
||||||
|
"speed": 5.0
|
||||||
|
}, {
|
||||||
|
"frames": [{
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": ExtResource("1_50ts1")
|
||||||
|
}],
|
||||||
|
"loop": true,
|
||||||
|
"name": &"default",
|
||||||
|
"speed": 5.0
|
||||||
|
}, {
|
||||||
|
"frames": [{
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": ExtResource("3_fj3w4")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": ExtResource("4_153q8")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": ExtResource("5_tsejy")
|
||||||
|
}],
|
||||||
|
"loop": false,
|
||||||
|
"name": &"grab",
|
||||||
|
"speed": 7.0
|
||||||
|
}, {
|
||||||
|
"frames": [{
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": ExtResource("3_fj3w4")
|
||||||
|
}],
|
||||||
|
"loop": true,
|
||||||
|
"name": &"grab_intro",
|
||||||
|
"speed": 5.0
|
||||||
|
}]
|
||||||
|
|
||||||
|
[node name="Cursor" type="Node2D"]
|
||||||
|
top_level = true
|
||||||
|
script = SubResource("GDScript_h2l04")
|
||||||
|
|
||||||
|
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
|
||||||
|
scale = Vector2(1.5, 1.5)
|
||||||
|
sprite_frames = SubResource("SpriteFrames_u3xkr")
|
||||||
|
animation = &"grab"
|
||||||
|
autoplay = "grab"
|
||||||
|
frame = 2
|
||||||
|
frame_progress = 1.0
|
||||||
|
centered = false
|
||||||
|
offset = Vector2(-80, -190)
|
23
core/Sticker.gd
Normal file
23
core/Sticker.gd
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
extends Node
|
||||||
|
|
||||||
|
|
||||||
|
# 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 _on_area_2d_mouse_entered():
|
||||||
|
pass # Replace with function body.
|
||||||
|
|
||||||
|
|
||||||
|
func _on_area_2d_mouse_exited():
|
||||||
|
pass # Replace with function body.
|
||||||
|
|
||||||
|
|
||||||
|
func _on_tree_entered():
|
||||||
|
pass # Replace with function body.
|
30
core/Sticker.tscn
Normal file
30
core/Sticker.tscn
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
[gd_scene load_steps=2 format=3 uid="uid://kbso0l2uk2n7"]
|
||||||
|
|
||||||
|
[sub_resource type="GDScript" id="GDScript_4kxk0"]
|
||||||
|
script/source = "extends Area2D
|
||||||
|
|
||||||
|
|
||||||
|
# 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 _on_mouse_entered():
|
||||||
|
pass # Replace with function body.
|
||||||
|
|
||||||
|
|
||||||
|
func _on_mouse_exited():
|
||||||
|
pass # Replace with function body.
|
||||||
|
"
|
||||||
|
|
||||||
|
[node name="StickerDetection" type="Area2D"]
|
||||||
|
monitoring = false
|
||||||
|
script = SubResource("GDScript_4kxk0")
|
||||||
|
|
||||||
|
[connection signal="mouse_entered" from="." to="." method="_on_mouse_entered"]
|
||||||
|
[connection signal="mouse_exited" from="." to="." method="_on_mouse_exited"]
|
|
@ -5,7 +5,7 @@ extends CharacterBody2D
|
||||||
@export var CurrentHat: CanvasTexture
|
@export var CurrentHat: CanvasTexture
|
||||||
|
|
||||||
const SPEED = 1000.0
|
const SPEED = 1000.0
|
||||||
|
const MOUSESPEED = 10.0
|
||||||
func teleport(location:Transform2D , direction:float = 1):
|
func teleport(location:Transform2D , direction:float = 1):
|
||||||
transform = location
|
transform = location
|
||||||
scale = Vector2(direction,1)
|
scale = Vector2(direction,1)
|
||||||
|
@ -25,6 +25,8 @@ func changeSkin(NewSkin:CanvasTexture,_NewHat:CanvasTexture = null):
|
||||||
func get_input():
|
func get_input():
|
||||||
var directionX = Input.get_axis("move_left", "move_right")
|
var directionX = Input.get_axis("move_left", "move_right")
|
||||||
var directionY = Input.get_axis("move_up", "move_down")
|
var directionY = Input.get_axis("move_up", "move_down")
|
||||||
|
var mouseDirectionX = Input.get_axis("mouse_left", "mouse_right")
|
||||||
|
var mouseDirectionY = Input.get_axis("mouse_up", "mouse_down")
|
||||||
#region Movement
|
#region Movement
|
||||||
## Get the input direction and handle the movement/deceleration.
|
## Get the input direction and handle the movement/deceleration.
|
||||||
if directionX :
|
if directionX :
|
||||||
|
@ -36,6 +38,8 @@ func get_input():
|
||||||
else:
|
else:
|
||||||
velocity.y = move_toward(velocity.y, 0, SPEED)
|
velocity.y = move_toward(velocity.y, 0, SPEED)
|
||||||
#endregion
|
#endregion
|
||||||
|
var wantedMousePosition = get_viewport().get_mouse_position()+(Vector2(mouseDirectionX,mouseDirectionY)*MOUSESPEED)
|
||||||
|
get_viewport().warp_mouse(wantedMousePosition)
|
||||||
#region Animation
|
#region Animation
|
||||||
if (directionX < 0):
|
if (directionX < 0):
|
||||||
$Skeleton2D/root/Hips.set_scale(Vector2(1, 1))
|
$Skeleton2D/root/Hips.set_scale(Vector2(1, 1))
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
extends Node2D
|
extends Node2D
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@export var InitialPlayer :PackedScene
|
@export var InitialPlayer :PackedScene
|
||||||
@export var InitialMap :PackedScene
|
@export var InitialMap :PackedScene
|
||||||
|
|
||||||
|
@ -20,7 +22,7 @@ func transition_to_scene(new_scene: PackedScene, spawn_location = Vector2(0,0),
|
||||||
player = $CurrentScene.find_child("player",true)
|
player = $CurrentScene.find_child("player",true)
|
||||||
if (player):
|
if (player):
|
||||||
player.teleport(spawn_location, spawn_direction)
|
player.teleport(spawn_location, spawn_direction)
|
||||||
else:
|
else: #Spawn the player if there is none
|
||||||
if (InitialPlayer):
|
if (InitialPlayer):
|
||||||
player = InitialPlayer.instantiate()
|
player = InitialPlayer.instantiate()
|
||||||
player.set_name("player")
|
player.set_name("player")
|
||||||
|
@ -31,3 +33,4 @@ func transition_to_scene(new_scene: PackedScene, spawn_location = Vector2(0,0),
|
||||||
|
|
||||||
func _on_ready():
|
func _on_ready():
|
||||||
transition_to_scene(InitialMap,Vector2(0,0),1)
|
transition_to_scene(InitialMap,Vector2(0,0),1)
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
[gd_scene load_steps=9 format=3 uid="uid://wlqsvbqpcbh"]
|
[gd_scene load_steps=14 format=3 uid="uid://wlqsvbqpcbh"]
|
||||||
|
|
||||||
[ext_resource type="Texture2D" uid="uid://cacwy4tka88k1" path="res://maps/map1.tres" id="1_pt5vq"]
|
[ext_resource type="Texture2D" uid="uid://cacwy4tka88k1" path="res://maps/map1.tres" id="1_pt5vq"]
|
||||||
[ext_resource type="Texture2D" uid="uid://cxharyv0ajr37" path="res://textures/atlas/DioramaEntrance_All_01_SPRT.png" id="2_n7y5f"]
|
[ext_resource type="Texture2D" uid="uid://cxharyv0ajr37" path="res://textures/atlas/DioramaEntrance_All_01_SPRT.png" id="2_n7y5f"]
|
||||||
[ext_resource type="Texture2D" uid="uid://c5bd2ta3esnib" path="res://extracted/4010-A Tiny Sticker Tale review pic 1.jpg" id="3_yh2wy"]
|
[ext_resource type="Texture2D" uid="uid://c5bd2ta3esnib" path="res://extracted/4010-A Tiny Sticker Tale review pic 1.jpg" id="3_yh2wy"]
|
||||||
[ext_resource type="PackedScene" uid="uid://bddcriwo55x8k" path="res://prefab/prefab_woddenbridge.tscn" id="4_okpsn"]
|
[ext_resource type="PackedScene" uid="uid://bddcriwo55x8k" path="res://prefab/prefab_woddenbridge.tscn" id="4_okpsn"]
|
||||||
[ext_resource type="Texture2D" uid="uid://dx8jpmxtm2cdx" path="res://textures/pattern/Pattern_Forest.png" id="5_i137q"]
|
[ext_resource type="Texture2D" uid="uid://dx8jpmxtm2cdx" path="res://textures/pattern/Pattern_Forest.png" id="5_i137q"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://cun14l52f477p" path="res://textures/atlas/Bushes_All_01_SPRT.png" id="5_xmosd"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://domcpxdf6lqpb" path="res://prefab/prefab_bush1.tscn" id="6_3fkbm"]
|
||||||
|
|
||||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_js06g"]
|
[sub_resource type="ShaderMaterial" id="ShaderMaterial_js06g"]
|
||||||
|
|
||||||
|
@ -16,7 +18,21 @@ region = Rect2(252, 16, 108, 256)
|
||||||
atlas = ExtResource("2_n7y5f")
|
atlas = ExtResource("2_n7y5f")
|
||||||
region = Rect2(12, 96, 216, 112)
|
region = Rect2(12, 96, 216, 112)
|
||||||
|
|
||||||
|
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_lfx7b"]
|
||||||
|
radius = 80.0
|
||||||
|
height = 254.0
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_rn40i"]
|
||||||
|
atlas = ExtResource("5_xmosd")
|
||||||
|
region = Rect2(736, 96, 224, 160)
|
||||||
|
|
||||||
|
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_b3366"]
|
||||||
|
radius = 50.0
|
||||||
|
height = 160.0
|
||||||
|
|
||||||
[node name="Map1" type="Node2D"]
|
[node name="Map1" type="Node2D"]
|
||||||
|
z_as_relative = false
|
||||||
|
y_sort_enabled = true
|
||||||
material = SubResource("ShaderMaterial_js06g")
|
material = SubResource("ShaderMaterial_js06g")
|
||||||
|
|
||||||
[node name="Container" type="Control" parent="."]
|
[node name="Container" type="Control" parent="."]
|
||||||
|
@ -56,6 +72,8 @@ texture = ExtResource("5_i137q")
|
||||||
stretch_mode = 1
|
stretch_mode = 1
|
||||||
|
|
||||||
[node name="Floors05Sprt" type="Sprite2D" parent="."]
|
[node name="Floors05Sprt" type="Sprite2D" parent="."]
|
||||||
|
z_index = -1
|
||||||
|
z_as_relative = false
|
||||||
scale = Vector2(6, 6)
|
scale = Vector2(6, 6)
|
||||||
texture = ExtResource("1_pt5vq")
|
texture = ExtResource("1_pt5vq")
|
||||||
region_rect = Rect2(0, 0, 1024, 992)
|
region_rect = Rect2(0, 0, 1024, 992)
|
||||||
|
@ -96,3 +114,40 @@ top_level = true
|
||||||
position = Vector2(78, -148)
|
position = Vector2(78, -148)
|
||||||
scale = Vector2(6.15, 6.15)
|
scale = Vector2(6.15, 6.15)
|
||||||
texture = ExtResource("3_yh2wy")
|
texture = ExtResource("3_yh2wy")
|
||||||
|
|
||||||
|
[node name="Bush1" parent="." instance=ExtResource("6_3fkbm")]
|
||||||
|
position = Vector2(-2161, 1140)
|
||||||
|
Shape = SubResource("CapsuleShape2D_lfx7b")
|
||||||
|
|
||||||
|
[node name="Bush6" parent="." instance=ExtResource("6_3fkbm")]
|
||||||
|
position = Vector2(-1556, 293)
|
||||||
|
Shape = SubResource("CapsuleShape2D_lfx7b")
|
||||||
|
|
||||||
|
[node name="Bush7" parent="." instance=ExtResource("6_3fkbm")]
|
||||||
|
position = Vector2(712, 293)
|
||||||
|
Shape = SubResource("CapsuleShape2D_lfx7b")
|
||||||
|
|
||||||
|
[node name="Bush9" parent="." instance=ExtResource("6_3fkbm")]
|
||||||
|
position = Vector2(1004, -2257)
|
||||||
|
Shape = SubResource("CapsuleShape2D_lfx7b")
|
||||||
|
|
||||||
|
[node name="Bush8" parent="." instance=ExtResource("6_3fkbm")]
|
||||||
|
position = Vector2(-1616, -1651)
|
||||||
|
offset = Vector2(-137.285, -179.785)
|
||||||
|
flip_h = true
|
||||||
|
Shape = SubResource("CapsuleShape2D_lfx7b")
|
||||||
|
|
||||||
|
[node name="Bush10" parent="." instance=ExtResource("6_3fkbm")]
|
||||||
|
position = Vector2(-2063, -2116)
|
||||||
|
texture = SubResource("AtlasTexture_rn40i")
|
||||||
|
offset = Vector2(-108.615, -141.38)
|
||||||
|
flip_h = true
|
||||||
|
Shape = SubResource("CapsuleShape2D_b3366")
|
||||||
|
Position = Vector2(0, -48.95)
|
||||||
|
|
||||||
|
[node name="Bush11" parent="." instance=ExtResource("6_3fkbm")]
|
||||||
|
position = Vector2(2208, 2337)
|
||||||
|
texture = SubResource("AtlasTexture_rn40i")
|
||||||
|
offset = Vector2(-108.615, -141.38)
|
||||||
|
Shape = SubResource("CapsuleShape2D_b3366")
|
||||||
|
Position = Vector2(0, -48.95)
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
[gd_scene load_steps=4 format=3 uid="uid://d382cexpr4075"]
|
[gd_scene load_steps=5 format=3 uid="uid://d382cexpr4075"]
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://core/sceneInstance.gd" id="1_p0vo1"]
|
[ext_resource type="Script" path="res://core/sceneInstance.gd" id="1_p0vo1"]
|
||||||
[ext_resource type="PackedScene" uid="uid://0m1hk2nu4bps" path="res://core/player.tscn" id="2_fyjh8"]
|
[ext_resource type="PackedScene" uid="uid://0m1hk2nu4bps" path="res://core/player.tscn" id="2_fyjh8"]
|
||||||
[ext_resource type="PackedScene" uid="uid://wlqsvbqpcbh" path="res://maps/map1.tscn" id="2_qgqfi"]
|
[ext_resource type="PackedScene" uid="uid://wlqsvbqpcbh" path="res://maps/map1.tscn" id="2_qgqfi"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://524sv8spw6go" path="res://core/Cursor.tscn" id="4_uwedi"]
|
||||||
|
|
||||||
[node name="MapManager" type="Node2D"]
|
[node name="MapManager" type="Node2D"]
|
||||||
script = ExtResource("1_p0vo1")
|
script = ExtResource("1_p0vo1")
|
||||||
|
@ -11,4 +12,6 @@ InitialMap = ExtResource("2_qgqfi")
|
||||||
|
|
||||||
[node name="CurrentScene" type="Node2D" parent="."]
|
[node name="CurrentScene" type="Node2D" parent="."]
|
||||||
|
|
||||||
|
[node name="Cursor" parent="." instance=ExtResource("4_uwedi")]
|
||||||
|
|
||||||
[connection signal="ready" from="." to="." method="_on_ready"]
|
[connection signal="ready" from="." to="." method="_on_ready"]
|
||||||
|
|
60
prefab/prefab_bush1.tscn
Normal file
60
prefab/prefab_bush1.tscn
Normal file
|
@ -0,0 +1,60 @@
|
||||||
|
[gd_scene load_steps=4 format=3 uid="uid://domcpxdf6lqpb"]
|
||||||
|
|
||||||
|
[ext_resource type="Texture2D" uid="uid://cun14l52f477p" path="res://textures/atlas/Bushes_All_01_SPRT.png" id="1_1wk1p"]
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_2wdar"]
|
||||||
|
atlas = ExtResource("1_1wk1p")
|
||||||
|
region = Rect2(384, 64, 288, 224)
|
||||||
|
|
||||||
|
[sub_resource type="GDScript" id="GDScript_uqtu8"]
|
||||||
|
script/source = "@tool
|
||||||
|
extends Sprite2D
|
||||||
|
|
||||||
|
@export_group(\"Collision Shape\")
|
||||||
|
@export var Shape :Shape2D:
|
||||||
|
set(new_shape):
|
||||||
|
Shape = new_shape
|
||||||
|
$Area2D/CollisionShape2D.shape = Shape
|
||||||
|
$Area2D/CollisionShape2D.queue_redraw()
|
||||||
|
@export var Position :Vector2:
|
||||||
|
set(new_position):
|
||||||
|
Position = new_position
|
||||||
|
$Area2D/CollisionShape2D.position = Position
|
||||||
|
$Area2D/CollisionShape2D.queue_redraw()
|
||||||
|
@export var Rotation :Vector2:
|
||||||
|
set(new_rotation):
|
||||||
|
Rotation = new_rotation
|
||||||
|
$Area2D/CollisionShape2D.rotation = Rotation
|
||||||
|
$Area2D/CollisionShape2D.queue_redraw()
|
||||||
|
|
||||||
|
# Called when the node enters the scene tree for the first time.
|
||||||
|
func _ready():
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
|
func _process(delta):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
"
|
||||||
|
|
||||||
|
[node name="Bush1" type="Sprite2D"]
|
||||||
|
scale = Vector2(3.80334, 3.95089)
|
||||||
|
texture = SubResource("AtlasTexture_2wdar")
|
||||||
|
centered = false
|
||||||
|
offset = Vector2(-161.055, -179.785)
|
||||||
|
script = SubResource("GDScript_uqtu8")
|
||||||
|
metadata/tags = ["sticker"]
|
||||||
|
|
||||||
|
[node name="Area2D" type="Area2D" parent="."]
|
||||||
|
collision_layer = 3
|
||||||
|
monitoring = false
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"]
|
||||||
|
position = Vector2(-4.46976, -71.6294)
|
||||||
|
rotation = 1.5708
|
||||||
|
|
||||||
|
[connection signal="property_list_changed" from="." to="." method="_on_property_list_changed"]
|
|
@ -10,6 +10,7 @@ region = Rect2(72, 1392, 216, 272)
|
||||||
[node name="WoodenBridge" type="Sprite2D"]
|
[node name="WoodenBridge" type="Sprite2D"]
|
||||||
scale = Vector2(5.71296, 5.71296)
|
scale = Vector2(5.71296, 5.71296)
|
||||||
texture = SubResource("AtlasTexture_nkyhf")
|
texture = SubResource("AtlasTexture_nkyhf")
|
||||||
|
metadata/tags = ["sticker"]
|
||||||
|
|
||||||
[node name="BridgeNode" parent="." instance=ExtResource("2_te8ug")]
|
[node name="BridgeNode" parent="." instance=ExtResource("2_te8ug")]
|
||||||
position = Vector2(1788, 788)
|
position = Vector2(1788, 788)
|
||||||
|
|
|
@ -76,6 +76,26 @@ menu={
|
||||||
, 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":4194305,"key_label":0,"unicode":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":4194305,"key_label":0,"unicode":0,"echo":false,"script":null)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
mouse_up={
|
||||||
|
"deadzone": 0.5,
|
||||||
|
"events": [Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":3,"axis_value":-1.0,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
mouse_down={
|
||||||
|
"deadzone": 0.5,
|
||||||
|
"events": [Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":3,"axis_value":1.0,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
mouse_left={
|
||||||
|
"deadzone": 0.5,
|
||||||
|
"events": [Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":2,"axis_value":-1.0,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
mouse_right={
|
||||||
|
"deadzone": 0.5,
|
||||||
|
"events": [Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":2,"axis_value":1.0,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
[layer_names]
|
[layer_names]
|
||||||
|
|
||||||
|
|
|
@ -3,15 +3,15 @@
|
||||||
importer="texture"
|
importer="texture"
|
||||||
type="CompressedTexture2D"
|
type="CompressedTexture2D"
|
||||||
uid="uid://docoki1q4vvfh"
|
uid="uid://docoki1q4vvfh"
|
||||||
path="res://.godot/imported/SPRT_Hand.png-10f10cc13ae4b0331523734719309ebe.ctex"
|
path="res://.godot/imported/SPRT_Hand.png-f682339cd646a6350ee80c8d3fc09b3b.ctex"
|
||||||
metadata={
|
metadata={
|
||||||
"vram_texture": false
|
"vram_texture": false
|
||||||
}
|
}
|
||||||
|
|
||||||
[deps]
|
[deps]
|
||||||
|
|
||||||
source_file="res://extracted/Texture2D/SPRT_Hand.png"
|
source_file="res://textures/atlas/SPRT_Hand.png"
|
||||||
dest_files=["res://.godot/imported/SPRT_Hand.png-10f10cc13ae4b0331523734719309ebe.ctex"]
|
dest_files=["res://.godot/imported/SPRT_Hand.png-f682339cd646a6350ee80c8d3fc09b3b.ctex"]
|
||||||
|
|
||||||
[params]
|
[params]
|
||||||
|
|
9
textures/cursor_click.tres
Normal file
9
textures/cursor_click.tres
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
[gd_resource type="AtlasTexture" load_steps=2 format=3 uid="uid://bdstohvc7pvot"]
|
||||||
|
|
||||||
|
[ext_resource type="Texture2D" uid="uid://docoki1q4vvfh" path="res://textures/atlas/SPRT_Hand.png" id="1_2ch11"]
|
||||||
|
|
||||||
|
[resource]
|
||||||
|
atlas = ExtResource("1_2ch11")
|
||||||
|
region = Rect2(0, 0, 256, 256)
|
||||||
|
margin = Rect2(-5, 5, 5, 5)
|
||||||
|
filter_clip = true
|
7
textures/cursor_default.tres
Normal file
7
textures/cursor_default.tres
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
[gd_resource type="AtlasTexture" load_steps=2 format=3 uid="uid://q1rdbr8uh78r"]
|
||||||
|
|
||||||
|
[ext_resource type="Texture2D" uid="uid://docoki1q4vvfh" path="res://textures/atlas/SPRT_Hand.png" id="1_n6y0a"]
|
||||||
|
|
||||||
|
[resource]
|
||||||
|
atlas = ExtResource("1_n6y0a")
|
||||||
|
region = Rect2(0, 0, 256, 256)
|
21
textures/cursor_grab.tres
Normal file
21
textures/cursor_grab.tres
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
[gd_resource type="AnimatedTexture" load_steps=5 format=3 uid="uid://sgwck5ca17s1"]
|
||||||
|
|
||||||
|
[ext_resource type="Texture2D" uid="uid://q1rdbr8uh78r" path="res://textures/cursor_default.tres" id="1_k7xih"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://docoki1q4vvfh" path="res://textures/atlas/SPRT_Hand.png" id="1_ltia2"]
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_gpt2k"]
|
||||||
|
atlas = ExtResource("1_ltia2")
|
||||||
|
region = Rect2(0, 256, 256, 256)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_hq7jx"]
|
||||||
|
atlas = ExtResource("1_ltia2")
|
||||||
|
region = Rect2(256, 256, 256, 256)
|
||||||
|
|
||||||
|
[resource]
|
||||||
|
frames = 3
|
||||||
|
frame_0/texture = ExtResource("1_k7xih")
|
||||||
|
frame_0/duration = 0.5
|
||||||
|
frame_1/texture = SubResource("AtlasTexture_gpt2k")
|
||||||
|
frame_1/duration = 0.5
|
||||||
|
frame_2/texture = SubResource("AtlasTexture_hq7jx")
|
||||||
|
frame_2/duration = 0.5
|
7
textures/cursor_grab_01.tres
Normal file
7
textures/cursor_grab_01.tres
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
[gd_resource type="AtlasTexture" load_steps=2 format=3 uid="uid://buxws7r3kn0d7"]
|
||||||
|
|
||||||
|
[ext_resource type="Texture2D" uid="uid://docoki1q4vvfh" path="res://textures/atlas/SPRT_Hand.png" id="1_xhy8h"]
|
||||||
|
|
||||||
|
[resource]
|
||||||
|
atlas = ExtResource("1_xhy8h")
|
||||||
|
region = Rect2(256, 0, 256, 256)
|
7
textures/cursor_grab_02.tres
Normal file
7
textures/cursor_grab_02.tres
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
[gd_resource type="AtlasTexture" load_steps=2 format=3 uid="uid://pbahcjllgjjq"]
|
||||||
|
|
||||||
|
[ext_resource type="Texture2D" uid="uid://docoki1q4vvfh" path="res://textures/atlas/SPRT_Hand.png" id="1_it2wc"]
|
||||||
|
|
||||||
|
[resource]
|
||||||
|
atlas = ExtResource("1_it2wc")
|
||||||
|
region = Rect2(0, 256, 256, 256)
|
7
textures/cursor_grab_03.tres
Normal file
7
textures/cursor_grab_03.tres
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
[gd_resource type="AtlasTexture" load_steps=2 format=3 uid="uid://6fajq480n7se"]
|
||||||
|
|
||||||
|
[ext_resource type="Texture2D" uid="uid://docoki1q4vvfh" path="res://textures/atlas/SPRT_Hand.png" id="1_r8woc"]
|
||||||
|
|
||||||
|
[resource]
|
||||||
|
atlas = ExtResource("1_r8woc")
|
||||||
|
region = Rect2(256, 256, 256, 256)
|
Loading…
Reference in a new issue