Compare commits
10 commits
fa1870bb3c
...
04838a55c7
Author | SHA1 | Date | |
---|---|---|---|
04838a55c7 | |||
ce684dafbf | |||
721f2e8297 | |||
2eef87c163 | |||
bf0ddce8a5 | |||
17ea850cce | |||
06184afcb8 | |||
e4e21741c1 | |||
0d315e3f90 | |||
|
454c15f146 |
11 changed files with 371 additions and 114 deletions
35
.forgejo/actions/build-godot.yaml
Normal file
35
.forgejo/actions/build-godot.yaml
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
name: "Build Godot"
|
||||||
|
description: "Build a Godot project for multiple platforms"
|
||||||
|
author: josephbmanley
|
||||||
|
inputs:
|
||||||
|
name:
|
||||||
|
description: 'Name of the exported binary'
|
||||||
|
required: true
|
||||||
|
preset:
|
||||||
|
description: 'Name of the preset in `export_presets.cfg` to use'
|
||||||
|
required: true
|
||||||
|
subdirectory:
|
||||||
|
description: 'Optional name of the subdirectory to put exported project in'
|
||||||
|
default: ""
|
||||||
|
package:
|
||||||
|
description: 'Set true to output an artifact zip file'
|
||||||
|
default: false
|
||||||
|
projectDir:
|
||||||
|
description: 'Location of Godot project in repository'
|
||||||
|
default: "."
|
||||||
|
debugMode:
|
||||||
|
description: 'Whether or not to use `--export-debug`'
|
||||||
|
default: false
|
||||||
|
runs:
|
||||||
|
using: docker
|
||||||
|
image: Dockerfile
|
||||||
|
args:
|
||||||
|
- ${{ inputs.name }}
|
||||||
|
- ${{ inputs.preset }}
|
||||||
|
- ${{ inputs.subdirectory }}
|
||||||
|
- ${{ inputs.package }}
|
||||||
|
- ${{ inputs.projectDir }}
|
||||||
|
- ${{ inputs.debugMode }}
|
||||||
|
branding:
|
||||||
|
icon: loader
|
||||||
|
color: blue
|
39
.forgejo/actions/entrypoint.sh
Normal file
39
.forgejo/actions/entrypoint.sh
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
#!/bin/sh
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# Move godot templates already installed from the docker image to home
|
||||||
|
mkdir -v -p ~/.local/share/godot/export_templates
|
||||||
|
cp -a /root/.local/share/godot/export_templates/. ~/.local/share/godot/export_templates/
|
||||||
|
|
||||||
|
|
||||||
|
if [ "$3" != "" ]
|
||||||
|
then
|
||||||
|
SubDirectoryLocation="$3/"
|
||||||
|
fi
|
||||||
|
|
||||||
|
mode="export-release"
|
||||||
|
if [ "$6" = "true" ]
|
||||||
|
then
|
||||||
|
echo "Exporting in debug mode!"
|
||||||
|
mode="export-debug"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Export for project
|
||||||
|
echo "Building $1 for $2"
|
||||||
|
mkdir -p $GITHUB_WORKSPACE/build/${SubDirectoryLocation:-""}
|
||||||
|
cd "$GITHUB_WORKSPACE/$5"
|
||||||
|
godot --headless --${mode} "$2" $GITHUB_WORKSPACE/build/${SubDirectoryLocation:-""}$1
|
||||||
|
echo "Build Done"
|
||||||
|
|
||||||
|
echo ::set-output name=build::build/${SubDirectoryLocation:-""}
|
||||||
|
|
||||||
|
|
||||||
|
if [ "$4" = "true" ]
|
||||||
|
then
|
||||||
|
echo "Packing Build"
|
||||||
|
mkdir -p $GITHUB_WORKSPACE/package
|
||||||
|
cd $GITHUB_WORKSPACE/build
|
||||||
|
zip $GITHUB_WORKSPACE/package/artifact.zip ${SubDirectoryLocation:-"."} -r
|
||||||
|
echo ::set-output name=artifact::package/artifact.zip
|
||||||
|
echo "Done"
|
||||||
|
fi
|
40
.forgejo/workflows/build.yaml
Normal file
40
.forgejo/workflows/build.yaml
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- "v*"
|
||||||
|
jobs:
|
||||||
|
# job id, can be anything
|
||||||
|
export_game:
|
||||||
|
# Always use ubuntu-latest for this action
|
||||||
|
runs-on: linux_amd64
|
||||||
|
# Add permission for release creation. Can be made narrower according to your needs
|
||||||
|
permissions: write-all
|
||||||
|
# Job name, can be anything
|
||||||
|
name: Export Game
|
||||||
|
steps:
|
||||||
|
# Always include the checkout step so that
|
||||||
|
# your project is available for Godot to export
|
||||||
|
- name: checkout
|
||||||
|
uses: actions/checkout@v3.3.0
|
||||||
|
|
||||||
|
- name: export game
|
||||||
|
id: export
|
||||||
|
# Use latest version (see releases for all versions)
|
||||||
|
uses: https://github.com/firebelley/godot-export@v5.2.1
|
||||||
|
with:
|
||||||
|
# Defining all the required inputs
|
||||||
|
godot_executable_download_url: https://downloads.tuxfamily.org/godotengine/4.2/Godot_v4.2-stable_linux.x86_64.zip
|
||||||
|
godot_export_templates_download_url: https://downloads.tuxfamily.org/godotengine/4.2/Godot_v4.2-stable_export_templates.tpz
|
||||||
|
relative_project_path: ./
|
||||||
|
archive_output: true
|
||||||
|
cache: true
|
||||||
|
|
||||||
|
# This release action has worked well for me. However, you can most likely use any release action of your choosing.
|
||||||
|
# https://github.com/ncipollo/release-action
|
||||||
|
- name: create release
|
||||||
|
uses: https://github.com/ncipollo/release-action@v1.12.0
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
generateReleaseNotes: true
|
||||||
|
tag: ${{ github.ref_name }}
|
||||||
|
artifacts: ${{ steps.export.outputs.archive_directory }}/*
|
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,2 +1,3 @@
|
||||||
# Godot 4+ specific ignores
|
# Godot 4+ specific ignores
|
||||||
.godot/
|
.godot/
|
||||||
|
*.TMP
|
||||||
|
|
173
core/Cursor.gd
Normal file
173
core/Cursor.gd
Normal file
|
@ -0,0 +1,173 @@
|
||||||
|
extends Node2D
|
||||||
|
|
||||||
|
var spaceState
|
||||||
|
var query : PhysicsPointQueryParameters2D
|
||||||
|
var CastResult : Array
|
||||||
|
|
||||||
|
var hoveredObjects : Array
|
||||||
|
var hoveredObject
|
||||||
|
var hoveredSticker
|
||||||
|
var grabbedSticker
|
||||||
|
|
||||||
|
enum CURSOR_STATE {DEFAULT, CLICK, GRAB, GRABBED}
|
||||||
|
var currentCursorState:CURSOR_STATE = CURSOR_STATE.DEFAULT
|
||||||
|
var oldCursorState:CURSOR_STATE = CURSOR_STATE.DEFAULT
|
||||||
|
var cursorPlaying:bool
|
||||||
|
|
||||||
|
# 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 Cursor 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():
|
||||||
|
resetCast()
|
||||||
|
query.collide_with_areas = true
|
||||||
|
query.position = get_global_mouse_position()
|
||||||
|
CastResult = spaceState.direct_space_state.intersect_point(query)
|
||||||
|
# CastResult is not reliable. Objects are added randomly in the array
|
||||||
|
# so we need to filter/sort the trace result
|
||||||
|
if ( CastResult.size() > 0 and (grabbedSticker == null)):
|
||||||
|
|
||||||
|
#region Fill HoveredObjects
|
||||||
|
for _object in CastResult:
|
||||||
|
if(_object.collider.input_pickable == true):
|
||||||
|
hoveredObjects.append(_object.collider.get_parent())
|
||||||
|
#endregion
|
||||||
|
if (hoveredObjects.size() > 0):
|
||||||
|
if (hoveredObjects.size() >= 2):
|
||||||
|
sortByPosY(hoveredObjects,false)
|
||||||
|
if (hoveredObjects[0] != hoveredObject):
|
||||||
|
if (hoveredObject and hoveredObject.has_method("on_unhover")):
|
||||||
|
hoveredObject.on_unhover()
|
||||||
|
hoveredObject = hoveredObjects[0]
|
||||||
|
if (hoveredObject and hoveredObject.has_method("on_hover")):
|
||||||
|
hoveredObject.on_hover()
|
||||||
|
print("Current hovered object :", hoveredObject)
|
||||||
|
if (isSticker(hoveredObject)):
|
||||||
|
hoveredSticker = hoveredObject
|
||||||
|
print("Current hovered sticker :", hoveredSticker)
|
||||||
|
else:
|
||||||
|
hoveredSticker = null
|
||||||
|
else:
|
||||||
|
resetCast(true)
|
||||||
|
else:
|
||||||
|
resetCast(true)
|
||||||
|
|
||||||
|
func resetCast(bFull = false):
|
||||||
|
CastResult.clear()
|
||||||
|
hoveredObjects.clear()
|
||||||
|
if bFull:
|
||||||
|
if (hoveredObject and hoveredObject.has_method("on_unhover")):
|
||||||
|
hoveredObject.on_unhover()
|
||||||
|
hoveredObject = null
|
||||||
|
hoveredSticker = null
|
||||||
|
|
||||||
|
func sortByPosY(objects: Array, ascending_order: bool = true):
|
||||||
|
var _tempArray :Array
|
||||||
|
_tempArray = objects
|
||||||
|
# Inline comparison function
|
||||||
|
_tempArray.sort_custom(comparePosY)
|
||||||
|
# Reverse if descending order is required
|
||||||
|
if not ascending_order:
|
||||||
|
_tempArray.reverse()
|
||||||
|
objects = _tempArray
|
||||||
|
|
||||||
|
func comparePosY(a, b):
|
||||||
|
#print("Compare ",a," at ",a.position.y, " and ",b," at ",b.position.y )
|
||||||
|
return a.position.y < b.position.y
|
||||||
|
|
||||||
|
|
||||||
|
func _input(rawInputEvent:InputEvent):
|
||||||
|
if (rawInputEvent.is_action_pressed("select")):
|
||||||
|
cursorClick()
|
||||||
|
$GrabTimer.start()
|
||||||
|
if (rawInputEvent.is_action_released("select")):
|
||||||
|
$GrabTimer.stop()
|
||||||
|
if (grabbedSticker):
|
||||||
|
grab_end()
|
||||||
|
|
||||||
|
func grab_start():
|
||||||
|
if (hoveredSticker):
|
||||||
|
grabbedSticker = hoveredSticker
|
||||||
|
print("Grabbed ", grabbedSticker)
|
||||||
|
|
||||||
|
func grab_end():
|
||||||
|
grabbedSticker.on_released()
|
||||||
|
|
||||||
|
print("stopg grabbin at ",query.position )
|
||||||
|
DebugDraw.points.append(query.position)
|
||||||
|
DebugDraw.drawPoints()
|
||||||
|
#TODO: Drop the sticker or maybe he will auto-drop ?
|
||||||
|
|
||||||
|
grabbedSticker = null
|
||||||
|
|
||||||
|
func cursorClick():
|
||||||
|
if (hoveredObject and hoveredObject.has_method("on_click")):
|
||||||
|
hoveredObject.on_click()
|
||||||
|
|
||||||
|
func cursor_look():
|
||||||
|
if (grabbedSticker ):
|
||||||
|
currentCursorState = CURSOR_STATE.GRABBED
|
||||||
|
elif (hoveredSticker):
|
||||||
|
if (!($GrabTimer.is_stopped())):
|
||||||
|
currentCursorState = CURSOR_STATE.GRABBED
|
||||||
|
else:
|
||||||
|
currentCursorState = CURSOR_STATE.GRAB
|
||||||
|
elif (!($GrabTimer.is_stopped())):
|
||||||
|
currentCursorState = CURSOR_STATE.CLICK
|
||||||
|
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")
|
||||||
|
|
||||||
|
|
||||||
|
func _on_grab_timer_timeout():
|
||||||
|
grab_start()
|
||||||
|
|
||||||
|
|
||||||
|
func _on_animated_sprite_2d_animation_changed():
|
||||||
|
cursorPlaying = true
|
||||||
|
|
||||||
|
|
||||||
|
func _on_animated_sprite_2d_animation_finished():
|
||||||
|
cursorPlaying = false
|
118
core/Cursor.tscn
118
core/Cursor.tscn
|
@ -1,108 +1,12 @@
|
||||||
[gd_scene load_steps=8 format=3 uid="uid://524sv8spw6go"]
|
[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://q1rdbr8uh78r" path="res://textures/cursor_default.tres" id="1_50ts1"]
|
||||||
|
[ext_resource type="Script" path="res://core/Cursor.gd" id="1_b5uuj"]
|
||||||
[ext_resource type="Texture2D" uid="uid://bdstohvc7pvot" path="res://textures/cursor_click.tres" id="1_h0do2"]
|
[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://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://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"]
|
[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"]
|
[sub_resource type="SpriteFrames" id="SpriteFrames_u3xkr"]
|
||||||
resource_local_to_scene = true
|
resource_local_to_scene = true
|
||||||
animations = [{
|
animations = [{
|
||||||
|
@ -110,7 +14,7 @@ animations = [{
|
||||||
"duration": 1.0,
|
"duration": 1.0,
|
||||||
"texture": ExtResource("1_h0do2")
|
"texture": ExtResource("1_h0do2")
|
||||||
}],
|
}],
|
||||||
"loop": true,
|
"loop": false,
|
||||||
"name": &"click",
|
"name": &"click",
|
||||||
"speed": 5.0
|
"speed": 5.0
|
||||||
}, {
|
}, {
|
||||||
|
@ -118,7 +22,7 @@ animations = [{
|
||||||
"duration": 1.0,
|
"duration": 1.0,
|
||||||
"texture": ExtResource("1_50ts1")
|
"texture": ExtResource("1_50ts1")
|
||||||
}],
|
}],
|
||||||
"loop": true,
|
"loop": false,
|
||||||
"name": &"default",
|
"name": &"default",
|
||||||
"speed": 5.0
|
"speed": 5.0
|
||||||
}, {
|
}, {
|
||||||
|
@ -140,21 +44,25 @@ animations = [{
|
||||||
"duration": 1.0,
|
"duration": 1.0,
|
||||||
"texture": ExtResource("3_fj3w4")
|
"texture": ExtResource("3_fj3w4")
|
||||||
}],
|
}],
|
||||||
"loop": true,
|
"loop": false,
|
||||||
"name": &"grab_intro",
|
"name": &"grab_intro",
|
||||||
"speed": 5.0
|
"speed": 5.0
|
||||||
}]
|
}]
|
||||||
|
|
||||||
[node name="Cursor" type="Node2D"]
|
[node name="Cursor" type="Node2D"]
|
||||||
top_level = true
|
top_level = true
|
||||||
script = SubResource("GDScript_h2l04")
|
script = ExtResource("1_b5uuj")
|
||||||
|
|
||||||
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
|
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
|
||||||
scale = Vector2(1.5, 1.5)
|
scale = Vector2(1.5, 1.5)
|
||||||
sprite_frames = SubResource("SpriteFrames_u3xkr")
|
sprite_frames = SubResource("SpriteFrames_u3xkr")
|
||||||
animation = &"grab"
|
|
||||||
autoplay = "grab"
|
|
||||||
frame = 2
|
|
||||||
frame_progress = 1.0
|
|
||||||
centered = false
|
centered = false
|
||||||
offset = Vector2(-80, -190)
|
offset = Vector2(-80, -190)
|
||||||
|
|
||||||
|
[node name="GrabTimer" type="Timer" parent="."]
|
||||||
|
wait_time = 0.5
|
||||||
|
one_shot = true
|
||||||
|
|
||||||
|
[connection signal="animation_changed" from="AnimatedSprite2D" to="." method="_on_animated_sprite_2d_animation_changed"]
|
||||||
|
[connection signal="animation_finished" from="AnimatedSprite2D" to="." method="_on_animated_sprite_2d_animation_finished"]
|
||||||
|
[connection signal="timeout" from="GrabTimer" to="." method="_on_grab_timer_timeout"]
|
||||||
|
|
42
core/debugDraw.tscn
Normal file
42
core/debugDraw.tscn
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
[gd_scene load_steps=2 format=3 uid="uid://c8ncblufqk10x"]
|
||||||
|
|
||||||
|
[sub_resource type="GDScript" id="GDScript_t63le"]
|
||||||
|
script/source = "extends Node2D
|
||||||
|
|
||||||
|
@export var points:Array
|
||||||
|
@export var duration:float = 1
|
||||||
|
var radius
|
||||||
|
var color
|
||||||
|
|
||||||
|
func _draw():
|
||||||
|
for _point in points:
|
||||||
|
draw_circle(_point,radius,color)
|
||||||
|
|
||||||
|
func drawPoints(_points:Array = points,_radius:float = 50.0,_color:Color = Color.CRIMSON,_duration:float = 1):
|
||||||
|
if(_points):
|
||||||
|
points = _points
|
||||||
|
duration = _duration
|
||||||
|
radius = _radius
|
||||||
|
color = _color
|
||||||
|
$Timer.wait_time = duration
|
||||||
|
$Timer.start()
|
||||||
|
queue_redraw()
|
||||||
|
|
||||||
|
|
||||||
|
func _on_timer_timeout():
|
||||||
|
points.clear()
|
||||||
|
queue_redraw()
|
||||||
|
|
||||||
|
|
||||||
|
func _on_draw():
|
||||||
|
pass # Replace with function body.
|
||||||
|
"
|
||||||
|
|
||||||
|
[node name="DebugDraw" type="Node2D"]
|
||||||
|
script = SubResource("GDScript_t63le")
|
||||||
|
|
||||||
|
[node name="Timer" type="Timer" parent="."]
|
||||||
|
one_shot = true
|
||||||
|
|
||||||
|
[connection signal="draw" from="." to="." method="_on_draw"]
|
||||||
|
[connection signal="timeout" from="Timer" to="." method="_on_timer_timeout"]
|
|
@ -5,8 +5,8 @@ platform="Windows Desktop"
|
||||||
runnable=true
|
runnable=true
|
||||||
dedicated_server=false
|
dedicated_server=false
|
||||||
custom_features=""
|
custom_features=""
|
||||||
export_filter="scenes"
|
export_filter="resources"
|
||||||
export_files=PackedStringArray("res://maps/mainMenu.tscn", "res://maps/map1.tscn", "res://maps/mapManager.tscn")
|
export_files=PackedStringArray("res://maps/mainMenu.tscn", "res://maps/map1.tscn", "res://maps/mapManager.tscn", "res://shaders/shaderMaterial_Outline.tres", "res://shaders/shader_outline3.gdshader", "res://shaders/shader_outline2.gdshader", "res://shaders/shader_outline.gdshader", "res://core/bridgeNode.tscn", "res://core/Cursor.gd", "res://core/Cursor.tscn", "res://core/debugDraw.tscn", "res://core/player.gd", "res://core/player.tscn", "res://core/sceneInstance.gd", "res://core/Sticker.gd", "res://core/Sticker.tscn")
|
||||||
include_filter=""
|
include_filter=""
|
||||||
exclude_filter=""
|
exclude_filter=""
|
||||||
export_path="builds/stickerClone.exe"
|
export_path="builds/stickerClone.exe"
|
||||||
|
@ -32,7 +32,7 @@ codesign/timestamp_server_url=""
|
||||||
codesign/digest_algorithm=1
|
codesign/digest_algorithm=1
|
||||||
codesign/description=""
|
codesign/description=""
|
||||||
codesign/custom_options=PackedStringArray()
|
codesign/custom_options=PackedStringArray()
|
||||||
application/modify_resources=true
|
application/modify_resources=false
|
||||||
application/icon=""
|
application/icon=""
|
||||||
application/console_wrapper_icon=""
|
application/console_wrapper_icon=""
|
||||||
application/icon_interpolation=4
|
application/icon_interpolation=4
|
||||||
|
|
|
@ -187,7 +187,7 @@ texture = ExtResource("7_gygvy")
|
||||||
offset = Vector2(-251.145, -512)
|
offset = Vector2(-251.145, -512)
|
||||||
Shape = SubResource("CapsuleShape2D_dqo8w")
|
Shape = SubResource("CapsuleShape2D_dqo8w")
|
||||||
Position = Vector2(0, -253.27)
|
Position = Vector2(0, -253.27)
|
||||||
Rotation = 0.0
|
Rotation = 0.01
|
||||||
|
|
||||||
[node name="Tree2" parent="." instance=ExtResource("6_3fkbm")]
|
[node name="Tree2" parent="." instance=ExtResource("6_3fkbm")]
|
||||||
position = Vector2(-2399, -55)
|
position = Vector2(-2399, -55)
|
||||||
|
@ -195,7 +195,7 @@ texture = ExtResource("7_gygvy")
|
||||||
offset = Vector2(-251.145, -512)
|
offset = Vector2(-251.145, -512)
|
||||||
Shape = SubResource("CapsuleShape2D_dqo8w")
|
Shape = SubResource("CapsuleShape2D_dqo8w")
|
||||||
Position = Vector2(0, -253.27)
|
Position = Vector2(0, -253.27)
|
||||||
Rotation = 0.0
|
Rotation = 0.01
|
||||||
|
|
||||||
[node name="Tree3" parent="." instance=ExtResource("6_3fkbm")]
|
[node name="Tree3" parent="." instance=ExtResource("6_3fkbm")]
|
||||||
position = Vector2(-763, -2021)
|
position = Vector2(-763, -2021)
|
||||||
|
@ -203,7 +203,7 @@ texture = ExtResource("7_gygvy")
|
||||||
offset = Vector2(-251.145, -512)
|
offset = Vector2(-251.145, -512)
|
||||||
Shape = SubResource("CapsuleShape2D_dqo8w")
|
Shape = SubResource("CapsuleShape2D_dqo8w")
|
||||||
Position = Vector2(0, -253.27)
|
Position = Vector2(0, -253.27)
|
||||||
Rotation = 0.0
|
Rotation = 0.01
|
||||||
|
|
||||||
[node name="Tree4" parent="." instance=ExtResource("6_3fkbm")]
|
[node name="Tree4" parent="." instance=ExtResource("6_3fkbm")]
|
||||||
position = Vector2(2365, -2258)
|
position = Vector2(2365, -2258)
|
||||||
|
@ -211,7 +211,7 @@ texture = ExtResource("7_gygvy")
|
||||||
offset = Vector2(-251.145, -512)
|
offset = Vector2(-251.145, -512)
|
||||||
Shape = SubResource("CapsuleShape2D_dqo8w")
|
Shape = SubResource("CapsuleShape2D_dqo8w")
|
||||||
Position = Vector2(0, -253.27)
|
Position = Vector2(0, -253.27)
|
||||||
Rotation = 0.0
|
Rotation = 0.01
|
||||||
|
|
||||||
[node name="Bush6" parent="." instance=ExtResource("6_3fkbm")]
|
[node name="Bush6" parent="." instance=ExtResource("6_3fkbm")]
|
||||||
position = Vector2(-1556, 293)
|
position = Vector2(-1556, 293)
|
||||||
|
|
|
@ -10,6 +10,8 @@ region = Rect2(384, 64, 288, 224)
|
||||||
script/source = "@tool
|
script/source = "@tool
|
||||||
extends Sprite2D
|
extends Sprite2D
|
||||||
|
|
||||||
|
var OutlineMat:ShaderMaterial = preload(\"res://shaders/shaderMaterial_Outline.tres\")
|
||||||
|
|
||||||
@export_group(\"Sticker Detection Shape\")
|
@export_group(\"Sticker Detection Shape\")
|
||||||
@export var Shape :Shape2D:
|
@export var Shape :Shape2D:
|
||||||
set(new_shape):
|
set(new_shape):
|
||||||
|
@ -27,6 +29,20 @@ extends Sprite2D
|
||||||
$Area2D/CollisionShape2D.rotation = Rotation
|
$Area2D/CollisionShape2D.rotation = Rotation
|
||||||
$Area2D/CollisionShape2D.queue_redraw()
|
$Area2D/CollisionShape2D.queue_redraw()
|
||||||
|
|
||||||
|
|
||||||
|
func on_released():
|
||||||
|
print(self,\" released\")
|
||||||
|
|
||||||
|
func on_click():
|
||||||
|
print(self,\" clicked\")
|
||||||
|
|
||||||
|
func on_hover():
|
||||||
|
material = OutlineMat
|
||||||
|
queue_redraw()
|
||||||
|
|
||||||
|
func on_unhover():
|
||||||
|
material = null
|
||||||
|
queue_redraw()
|
||||||
"
|
"
|
||||||
|
|
||||||
[node name="FreeSticker1" type="Sprite2D"]
|
[node name="FreeSticker1" type="Sprite2D"]
|
||||||
|
@ -35,7 +51,6 @@ texture = SubResource("AtlasTexture_2wdar")
|
||||||
centered = false
|
centered = false
|
||||||
offset = Vector2(-161.055, -179.785)
|
offset = Vector2(-161.055, -179.785)
|
||||||
script = SubResource("GDScript_uqtu8")
|
script = SubResource("GDScript_uqtu8")
|
||||||
Rotation = Vector2(0, 0)
|
|
||||||
metadata/tags = ["sticker"]
|
metadata/tags = ["sticker"]
|
||||||
|
|
||||||
[node name="Area2D" type="Area2D" parent="."]
|
[node name="Area2D" type="Area2D" parent="."]
|
||||||
|
|
|
@ -17,6 +17,10 @@ config/features=PackedStringArray("4.2", "Mobile")
|
||||||
config/icon="res://extracted/Texture2D/Map.png"
|
config/icon="res://extracted/Texture2D/Map.png"
|
||||||
config/windows_native_icon="res://extracted/Texture2D/Map.png"
|
config/windows_native_icon="res://extracted/Texture2D/Map.png"
|
||||||
|
|
||||||
|
[autoload]
|
||||||
|
|
||||||
|
DebugDraw="*res://core/debugDraw.tscn"
|
||||||
|
|
||||||
[editor_plugins]
|
[editor_plugins]
|
||||||
|
|
||||||
enabled=PackedStringArray("res://addons/Todo_Manager/plugin.cfg")
|
enabled=PackedStringArray("res://addons/Todo_Manager/plugin.cfg")
|
||||||
|
@ -60,7 +64,7 @@ sticker_mode={
|
||||||
select={
|
select={
|
||||||
"deadzone": 0.5,
|
"deadzone": 0.5,
|
||||||
"events": [Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":0,"pressure":0.0,"pressed":true,"script":null)
|
"events": [Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":0,"pressure":0.0,"pressed":true,"script":null)
|
||||||
, Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":1,"position":Vector2(143, 14),"global_position":Vector2(147, 55),"factor":1.0,"button_index":1,"canceled":false,"pressed":true,"double_click":false,"script":null)
|
, Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":1,"position":Vector2(111, 16),"global_position":Vector2(115, 57),"factor":1.0,"button_index":1,"canceled":false,"pressed":true,"double_click":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":4194309,"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":4194309,"key_label":0,"unicode":0,"echo":false,"script":null)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue