Compare commits
241 Commits
3.0-219783
...
3.1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ea5b868fc7 | ||
|
|
a6ae6f64be | ||
|
|
507b8c6cf6 | ||
|
|
e59d96ef7a | ||
|
|
19584aae6a | ||
|
|
342f27e327 | ||
|
|
4d10544dd9 | ||
|
|
86944d5236 | ||
|
|
827d67b2ab | ||
|
|
177884ff19 | ||
|
|
87f42b77e0 | ||
|
|
b0e1cc0227 | ||
|
|
7af4d281b9 | ||
|
|
c270db0635 | ||
|
|
746928b623 | ||
|
|
b0b63e80f5 | ||
|
|
7421736568 | ||
|
|
db6967868f | ||
|
|
49a01d6f87 | ||
|
|
ff10a807d0 | ||
|
|
704ebeec81 | ||
|
|
60f515eaf9 | ||
|
|
3eeba859b1 | ||
|
|
9218f88723 | ||
|
|
375d5d13d2 | ||
|
|
c9d3646d45 | ||
|
|
9975c95065 | ||
|
|
c90a251445 | ||
|
|
cd7c652975 | ||
|
|
e5ee4a5971 | ||
|
|
729be3461d | ||
|
|
abf9d68bf4 | ||
|
|
67a490ab50 | ||
|
|
f07c7091fc | ||
|
|
ac882369bc | ||
|
|
6899d44615 | ||
|
|
84c8d6ef69 | ||
|
|
691f1d94d6 | ||
|
|
cb5906aea3 | ||
|
|
237a8654b0 | ||
|
|
4f5f0ec1a9 | ||
|
|
e3fd4c662c | ||
|
|
ff93de81bb | ||
|
|
28c3103132 | ||
|
|
958f686e12 | ||
|
|
edb8372db8 | ||
|
|
de57f45049 | ||
|
|
4ec9d7921b | ||
|
|
a5b8cd11d9 | ||
|
|
0746c063b4 | ||
|
|
9e197b8c20 | ||
|
|
2afbeef96f | ||
|
|
9c17c25343 | ||
|
|
357620b336 | ||
|
|
33494c4592 | ||
|
|
76d43cf23a | ||
|
|
97f9632be4 | ||
|
|
463da9948f | ||
|
|
04d86775da | ||
|
|
c6922db2a1 | ||
|
|
43dcf5c1e7 | ||
|
|
d19c746231 | ||
|
|
aca3ea4749 | ||
|
|
a45b84a5ad | ||
|
|
5bdd178d85 | ||
|
|
b93d9028a9 | ||
|
|
566c7e15f8 | ||
|
|
eb814782c6 | ||
|
|
029706d4fb | ||
|
|
f922bcb8c7 | ||
|
|
2490d9ae45 | ||
|
|
f9b9b86949 | ||
|
|
79f7554bc3 | ||
|
|
7e96ba1a6a | ||
|
|
861f0418f0 | ||
|
|
8a6b1f87ba | ||
|
|
c5a37ea618 | ||
|
|
c0f4bad011 | ||
|
|
7658e62636 | ||
|
|
b1953be73f | ||
|
|
5bc48e2080 | ||
|
|
2c6df4ed79 | ||
|
|
015cb6e64c | ||
|
|
617896737e | ||
|
|
50d5a118c9 | ||
|
|
e5e20a57a1 | ||
|
|
72ff4543c8 | ||
|
|
f863ebe52c | ||
|
|
4ce086a745 | ||
|
|
6a1fe3b48a | ||
|
|
990042e3c5 | ||
|
|
53fc37e64e | ||
|
|
de309f0544 | ||
|
|
c101b13b27 | ||
|
|
54ae746654 | ||
|
|
1ca3204e0a | ||
|
|
d191bf5558 | ||
|
|
61ea666d69 | ||
|
|
ebdb732fc8 | ||
|
|
ee3dac1635 | ||
|
|
c34a2b423b | ||
|
|
98e60d4ff6 | ||
|
|
85afe1bc9a | ||
|
|
1ae9f1b549 | ||
|
|
d29b987235 | ||
|
|
1e44578b1e | ||
|
|
61ea89e836 | ||
|
|
0d40b69c19 | ||
|
|
9b2da1fa2f | ||
|
|
36c9ecdfa8 | ||
|
|
359ef78ee0 | ||
|
|
e9f02ff05f | ||
|
|
949a9428eb | ||
|
|
974e506371 | ||
|
|
3bf7046184 | ||
|
|
a2e7bf2b36 | ||
|
|
fa09138422 | ||
|
|
c2d2718cca | ||
|
|
38bfaba92d | ||
|
|
85f36d6b3b | ||
|
|
bee90f6bd7 | ||
|
|
e691f98c18 | ||
|
|
99f6e67d40 | ||
|
|
2c5b4a48d0 | ||
|
|
82d9684caf | ||
|
|
a527318768 | ||
|
|
7e37b4162f | ||
|
|
9adc81ce7f | ||
|
|
092cf6fc03 | ||
|
|
2a57c64c30 | ||
|
|
0bbe5ef586 | ||
|
|
0db440bb55 | ||
|
|
184b0fe5f8 | ||
|
|
6a9bb96ebd | ||
|
|
4bb717c59f | ||
|
|
f83706d306 | ||
|
|
7ad43829ef | ||
|
|
7f41a74a98 | ||
|
|
11425f2a6a | ||
|
|
626b9178bb | ||
|
|
47be86af93 | ||
|
|
61c03933e4 | ||
|
|
1cfb3ee621 | ||
|
|
39590fadd3 | ||
|
|
d21936b32d | ||
|
|
d9a4d21e16 | ||
|
|
b9bca13221 | ||
|
|
19c4d7311f | ||
|
|
27727fdde5 | ||
|
|
ceefc33fe4 | ||
|
|
e22a46f301 | ||
|
|
c819e3b276 | ||
|
|
56a2b28c53 | ||
|
|
55d1deeeac | ||
|
|
cc0b002e6e | ||
|
|
17e80079e3 | ||
|
|
961c71d003 | ||
|
|
1a5517ae1a | ||
|
|
63392a3574 | ||
|
|
2fb80980b9 | ||
|
|
81441c42b7 | ||
|
|
cfcc0f3964 | ||
|
|
a38b315064 | ||
|
|
faae60ac2f | ||
|
|
bded14a506 | ||
|
|
a6ce6dbf4c | ||
|
|
916c9c933c | ||
|
|
974dbd6b88 | ||
|
|
eb27a35a2d | ||
|
|
453405031c | ||
|
|
77f7afaba4 | ||
|
|
da618f4f95 | ||
|
|
bcc8f64d7a | ||
|
|
3541aabc8e | ||
|
|
eac8dfd6ed | ||
|
|
7206f2d1f4 | ||
|
|
db411004b5 | ||
|
|
01d2f78c13 | ||
|
|
765ca64680 | ||
|
|
8cb1dcdb91 | ||
|
|
c972af3aab | ||
|
|
a318ea10a2 | ||
|
|
bbaca235b8 | ||
|
|
2c260e0103 | ||
|
|
5b01dccc82 | ||
|
|
471b813911 | ||
|
|
2709ddeb28 | ||
|
|
c6b481aaf0 | ||
|
|
35f628e0a4 | ||
|
|
ab07f94911 | ||
|
|
cfe4b0ec4e | ||
|
|
ed08f6aeca | ||
|
|
1970ba4b68 | ||
|
|
1ef5373c4f | ||
|
|
b355e3937a | ||
|
|
954b6f4990 | ||
|
|
11af6c77c7 | ||
|
|
5b744fa1e6 | ||
|
|
4f40b0940c | ||
|
|
c81540aa23 | ||
|
|
86bf5060b3 | ||
|
|
65ea563d57 | ||
|
|
334426403c | ||
|
|
d09cc6af8b | ||
|
|
532fbb4858 | ||
|
|
840777aee3 | ||
|
|
8d93b177e6 | ||
|
|
3e47fcd6c4 | ||
|
|
2c2c8e7e73 | ||
|
|
de24bae61d | ||
|
|
01abbff26d | ||
|
|
85c72987fc | ||
|
|
38bb189b9f | ||
|
|
c61351cad9 | ||
|
|
fc08eda45b | ||
|
|
d5d7382a27 | ||
|
|
b24ee4a44a | ||
|
|
ff4da36c17 | ||
|
|
b8fc28b0cd | ||
|
|
7f969fca7a | ||
|
|
7cc8afbd1f | ||
|
|
03afee161a | ||
|
|
245d72ca1f | ||
|
|
2b68f9bdb0 | ||
|
|
0db64f6ea2 | ||
|
|
14b6f3587b | ||
|
|
9d66e8f2ef | ||
|
|
1c2ec4c2e8 | ||
|
|
b6b75c67f3 | ||
|
|
40e1ee39f3 | ||
|
|
d9a6635c11 | ||
|
|
0252492b78 | ||
|
|
d53dd01897 | ||
|
|
2da82c7a90 | ||
|
|
d69cc10a0b | ||
|
|
c307520d41 | ||
|
|
3606b2621e | ||
|
|
f8cb21c366 | ||
|
|
c76125babf | ||
|
|
bdd014c021 | ||
|
|
a159361a2f |
6
.editorconfig
Normal file
@@ -0,0 +1,6 @@
|
||||
# Top-most EditorConfig file.
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
2
.gitattributes
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
# Normalize EOL for all files that Git considers text files.
|
||||
* text=auto eol=lf
|
||||
2
.github/FUNDING.yml
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
patreon: godotengine
|
||||
custom: https://godotengine.org/donate
|
||||
18
.github/ISSUE_TEMPLATE.md
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
<!-- Please search existing issues for potential duplicates before filing yours:
|
||||
https://github.com/godotengine/godot-demo-projects/issues?q=is%3Aissue
|
||||
-->
|
||||
|
||||
**Which demo project is affected:**
|
||||
<!-- Specify the project name or path. -->
|
||||
|
||||
|
||||
**OS/device including version:**
|
||||
<!-- Specify GPU model and drivers if graphics-related. -->
|
||||
|
||||
|
||||
**Issue description:**
|
||||
<!-- What happened, and what was expected. -->
|
||||
|
||||
|
||||
**Screenshots of issue:**
|
||||
<!-- Drag in an image, or link in the form of "![]()". If not relevant, remove this section. -->
|
||||
19
.github/workflows/static_checks.yml
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
name: Static Checks
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
format:
|
||||
name: File formatting (file_format.sh)
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v5
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt-get update -qq
|
||||
sudo apt-get install -qq dos2unix recode
|
||||
|
||||
- name: File formatting checks (file_format.sh)
|
||||
run: |
|
||||
bash ./file_format.sh
|
||||
11
.gitignore
vendored
@@ -1,11 +1,22 @@
|
||||
# Godot 4+ specific ignores
|
||||
.godot/
|
||||
|
||||
# Godot-specific ignores
|
||||
.import/
|
||||
export.cfg
|
||||
export_presets.cfg
|
||||
# Dummy HTML5 export presets file for continuous integration
|
||||
!.github/dist/export_presets.cfg
|
||||
|
||||
# Imported translations (automatically generated from CSV files)
|
||||
*.translation
|
||||
|
||||
# Mono-specific ignores
|
||||
.mono/
|
||||
data_*/
|
||||
mono_crash.*.json
|
||||
|
||||
# System/tool-specific ignores
|
||||
.directory
|
||||
.DS_Store
|
||||
*~
|
||||
|
||||
2
2d/dodge_the_creeps/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
.import
|
||||
logs/
|
||||
30
2d/dodge_the_creeps/HUD.gd
Normal file
@@ -0,0 +1,30 @@
|
||||
extends CanvasLayer
|
||||
|
||||
signal start_game
|
||||
|
||||
func show_message(text):
|
||||
$MessageLabel.text = text
|
||||
$MessageLabel.show()
|
||||
$MessageTimer.start()
|
||||
|
||||
|
||||
func show_game_over():
|
||||
show_message("Game Over")
|
||||
yield($MessageTimer, "timeout")
|
||||
$MessageLabel.text = "Dodge the\nCreeps"
|
||||
$MessageLabel.show()
|
||||
yield(get_tree().create_timer(1), 'timeout')
|
||||
$StartButton.show()
|
||||
|
||||
|
||||
func update_score(score):
|
||||
$ScoreLabel.text = str(score)
|
||||
|
||||
|
||||
func _on_StartButton_pressed():
|
||||
$StartButton.hide()
|
||||
emit_signal("start_game")
|
||||
|
||||
|
||||
func _on_MessageTimer_timeout():
|
||||
$MessageLabel.hide()
|
||||
57
2d/dodge_the_creeps/HUD.tscn
Normal file
@@ -0,0 +1,57 @@
|
||||
[gd_scene load_steps=7 format=2]
|
||||
|
||||
[ext_resource path="res://HUD.gd" type="Script" id=1]
|
||||
[ext_resource path="res://fonts/Xolonium-Regular.ttf" type="DynamicFontData" id=2]
|
||||
|
||||
[sub_resource type="DynamicFont" id=1]
|
||||
size = 64
|
||||
font_data = ExtResource( 2 )
|
||||
|
||||
[sub_resource type="DynamicFont" id=2]
|
||||
size = 64
|
||||
font_data = ExtResource( 2 )
|
||||
|
||||
[sub_resource type="InputEventAction" id=3]
|
||||
action = "ui_select"
|
||||
|
||||
[sub_resource type="ShortCut" id=4]
|
||||
shortcut = SubResource( 3 )
|
||||
|
||||
[node name="HUD" type="CanvasLayer"]
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="ScoreLabel" type="Label" parent="."]
|
||||
anchor_right = 1.0
|
||||
margin_bottom = 78.0
|
||||
custom_fonts/font = SubResource( 1 )
|
||||
text = "0"
|
||||
align = 1
|
||||
|
||||
[node name="MessageLabel" type="Label" parent="."]
|
||||
anchor_top = 0.5
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 0.5
|
||||
margin_top = -79.5
|
||||
margin_bottom = 79.5
|
||||
custom_fonts/font = SubResource( 1 )
|
||||
text = "Dodge the
|
||||
Creeps"
|
||||
align = 1
|
||||
|
||||
[node name="StartButton" type="Button" parent="."]
|
||||
anchor_left = 0.5
|
||||
anchor_top = 1.0
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 1.0
|
||||
margin_left = -90.0
|
||||
margin_top = -200.0
|
||||
margin_right = 90.0
|
||||
margin_bottom = -100.0
|
||||
custom_fonts/font = SubResource( 2 )
|
||||
shortcut = SubResource( 4 )
|
||||
text = "Start"
|
||||
|
||||
[node name="MessageTimer" type="Timer" parent="."]
|
||||
one_shot = true
|
||||
[connection signal="pressed" from="StartButton" to="." method="_on_StartButton_pressed"]
|
||||
[connection signal="timeout" from="MessageTimer" to="." method="_on_MessageTimer_timeout"]
|
||||
21
2d/dodge_the_creeps/LICENSE
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2017 KidsCanCode
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
45
2d/dodge_the_creeps/Main.gd
Normal file
@@ -0,0 +1,45 @@
|
||||
extends Node
|
||||
|
||||
export (PackedScene) var Mob
|
||||
var score
|
||||
|
||||
func _ready():
|
||||
randomize()
|
||||
|
||||
|
||||
func game_over():
|
||||
$ScoreTimer.stop()
|
||||
$MobTimer.stop()
|
||||
$HUD.show_game_over()
|
||||
$Music.stop()
|
||||
$DeathSound.play()
|
||||
|
||||
|
||||
func new_game():
|
||||
score = 0
|
||||
$Player.start($StartPosition.position)
|
||||
$StartTimer.start()
|
||||
$HUD.update_score(score)
|
||||
$HUD.show_message("Get Ready")
|
||||
$Music.play()
|
||||
|
||||
|
||||
func _on_MobTimer_timeout():
|
||||
$MobPath/MobSpawnLocation.offset = randi()
|
||||
var mob = Mob.instance()
|
||||
add_child(mob)
|
||||
var direction = $MobPath/MobSpawnLocation.rotation + PI / 2
|
||||
mob.position = $MobPath/MobSpawnLocation.position
|
||||
direction += rand_range(-PI / 4, PI / 4)
|
||||
mob.rotation = direction
|
||||
mob.linear_velocity = Vector2(rand_range(mob.min_speed, mob.max_speed), 0).rotated(direction)
|
||||
|
||||
|
||||
func _on_ScoreTimer_timeout():
|
||||
score += 1
|
||||
$HUD.update_score(score)
|
||||
|
||||
|
||||
func _on_StartTimer_timeout():
|
||||
$MobTimer.start()
|
||||
$ScoreTimer.start()
|
||||
54
2d/dodge_the_creeps/Main.tscn
Normal file
@@ -0,0 +1,54 @@
|
||||
[gd_scene load_steps=8 format=2]
|
||||
|
||||
[ext_resource path="res://Main.gd" type="Script" id=1]
|
||||
[ext_resource path="res://Mob.tscn" type="PackedScene" id=2]
|
||||
[ext_resource path="res://Player.tscn" type="PackedScene" id=3]
|
||||
[ext_resource path="res://HUD.tscn" type="PackedScene" id=4]
|
||||
[ext_resource path="res://art/House In a Forest Loop.ogg" type="AudioStream" id=5]
|
||||
[ext_resource path="res://art/gameover.wav" type="AudioStream" id=6]
|
||||
|
||||
[sub_resource type="Curve2D" id=1]
|
||||
_data = {
|
||||
"points": PoolVector2Array( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 480, 0, 0, 0, 0, 0, 480, 720, 0, 0, 0, 0, 0, 720, 0, 0, 0, 0, 0, 0 )
|
||||
}
|
||||
|
||||
[node name="Main" type="Node"]
|
||||
script = ExtResource( 1 )
|
||||
Mob = ExtResource( 2 )
|
||||
|
||||
[node name="ColorRect" type="ColorRect" parent="."]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
color = Color( 0.219608, 0.372549, 0.380392, 1 )
|
||||
|
||||
[node name="Player" parent="." instance=ExtResource( 3 )]
|
||||
|
||||
[node name="MobTimer" type="Timer" parent="."]
|
||||
wait_time = 0.5
|
||||
|
||||
[node name="ScoreTimer" type="Timer" parent="."]
|
||||
|
||||
[node name="StartTimer" type="Timer" parent="."]
|
||||
wait_time = 2.0
|
||||
one_shot = true
|
||||
|
||||
[node name="StartPosition" type="Position2D" parent="."]
|
||||
position = Vector2( 240, 450 )
|
||||
|
||||
[node name="MobPath" type="Path2D" parent="."]
|
||||
curve = SubResource( 1 )
|
||||
|
||||
[node name="MobSpawnLocation" type="PathFollow2D" parent="MobPath"]
|
||||
|
||||
[node name="HUD" parent="." instance=ExtResource( 4 )]
|
||||
|
||||
[node name="Music" type="AudioStreamPlayer" parent="."]
|
||||
stream = ExtResource( 5 )
|
||||
|
||||
[node name="DeathSound" type="AudioStreamPlayer" parent="."]
|
||||
stream = ExtResource( 6 )
|
||||
[connection signal="hit" from="Player" to="." method="game_over"]
|
||||
[connection signal="timeout" from="MobTimer" to="." method="_on_MobTimer_timeout"]
|
||||
[connection signal="timeout" from="ScoreTimer" to="." method="_on_ScoreTimer_timeout"]
|
||||
[connection signal="timeout" from="StartTimer" to="." method="_on_StartTimer_timeout"]
|
||||
[connection signal="start_game" from="HUD" to="." method="new_game"]
|
||||
13
2d/dodge_the_creeps/Mob.gd
Normal file
@@ -0,0 +1,13 @@
|
||||
extends RigidBody2D
|
||||
|
||||
#warning-ignore-all:unused_class_variable
|
||||
export var min_speed = 150
|
||||
export var max_speed = 250
|
||||
var mob_types = ["walk", "swim", "fly"]
|
||||
|
||||
func _ready():
|
||||
$AnimatedSprite.animation = mob_types[randi() % mob_types.size()]
|
||||
|
||||
|
||||
func _on_VisibilityNotifier2D_screen_exited():
|
||||
queue_free()
|
||||
53
2d/dodge_the_creeps/Mob.tscn
Normal file
@@ -0,0 +1,53 @@
|
||||
[gd_scene load_steps=10 format=2]
|
||||
|
||||
[ext_resource path="res://Mob.gd" type="Script" id=1]
|
||||
[ext_resource path="res://art/enemyFlyingAlt_1.png" type="Texture" id=2]
|
||||
[ext_resource path="res://art/enemyFlyingAlt_2.png" type="Texture" id=3]
|
||||
[ext_resource path="res://art/enemyWalking_1.png" type="Texture" id=4]
|
||||
[ext_resource path="res://art/enemyWalking_2.png" type="Texture" id=5]
|
||||
[ext_resource path="res://art/enemySwimming_1.png" type="Texture" id=6]
|
||||
[ext_resource path="res://art/enemySwimming_2.png" type="Texture" id=7]
|
||||
|
||||
[sub_resource type="SpriteFrames" id=1]
|
||||
animations = [ {
|
||||
"frames": [ ExtResource( 2 ), ExtResource( 3 ) ],
|
||||
"loop": true,
|
||||
"name": "fly",
|
||||
"speed": 3.0
|
||||
}, {
|
||||
"frames": [ ExtResource( 4 ), ExtResource( 5 ) ],
|
||||
"loop": true,
|
||||
"name": "walk",
|
||||
"speed": 4.0
|
||||
}, {
|
||||
"frames": [ ExtResource( 6 ), ExtResource( 7 ) ],
|
||||
"loop": true,
|
||||
"name": "swim",
|
||||
"speed": 4.0
|
||||
} ]
|
||||
|
||||
[sub_resource type="CapsuleShape2D" id=2]
|
||||
radius = 35.2706
|
||||
height = 23.3281
|
||||
|
||||
[node name="Mob" type="RigidBody2D"]
|
||||
collision_mask = 0
|
||||
gravity_scale = 0.0
|
||||
script = ExtResource( 1 )
|
||||
__meta__ = {
|
||||
"_edit_group_": true
|
||||
}
|
||||
|
||||
[node name="AnimatedSprite" type="AnimatedSprite" parent="."]
|
||||
scale = Vector2( 0.75, 0.75 )
|
||||
frames = SubResource( 1 )
|
||||
animation = "walk"
|
||||
frame = 1
|
||||
playing = true
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
rotation = 1.5708
|
||||
shape = SubResource( 2 )
|
||||
|
||||
[node name="VisibilityNotifier2D" type="VisibilityNotifier2D" parent="."]
|
||||
[connection signal="screen_exited" from="VisibilityNotifier2D" to="." method="_on_VisibilityNotifier2D_screen_exited"]
|
||||
45
2d/dodge_the_creeps/Player.gd
Normal file
@@ -0,0 +1,45 @@
|
||||
extends Area2D
|
||||
|
||||
signal hit
|
||||
|
||||
export var speed = 400
|
||||
var screen_size
|
||||
|
||||
func _ready():
|
||||
screen_size = get_viewport_rect().size
|
||||
hide()
|
||||
|
||||
|
||||
func _process(delta):
|
||||
var velocity = Vector2()
|
||||
velocity.x = Input.get_action_strength("move_right") - Input.get_action_strength("move_left")
|
||||
velocity.y = Input.get_action_strength("move_down") - Input.get_action_strength("move_up")
|
||||
|
||||
if velocity.length() > 0:
|
||||
velocity = velocity.normalized() * speed
|
||||
$AnimatedSprite.play()
|
||||
else:
|
||||
$AnimatedSprite.stop()
|
||||
position += velocity * delta
|
||||
position.x = clamp(position.x, 0, screen_size.x)
|
||||
position.y = clamp(position.y, 0, screen_size.y)
|
||||
|
||||
if velocity.x != 0:
|
||||
$AnimatedSprite.animation = "right"
|
||||
$AnimatedSprite.flip_v = false
|
||||
$AnimatedSprite.flip_h = velocity.x < 0
|
||||
elif velocity.y != 0:
|
||||
$AnimatedSprite.animation = "up"
|
||||
$AnimatedSprite.flip_v = velocity.y > 0
|
||||
|
||||
|
||||
func start(pos):
|
||||
position = pos
|
||||
show()
|
||||
$CollisionShape2D.disabled = false
|
||||
|
||||
|
||||
func _on_Player_body_entered(_body):
|
||||
hide()
|
||||
emit_signal("hit")
|
||||
$CollisionShape2D.set_deferred("disabled", true)
|
||||
70
2d/dodge_the_creeps/Player.tscn
Normal file
@@ -0,0 +1,70 @@
|
||||
[gd_scene load_steps=13 format=2]
|
||||
|
||||
[ext_resource path="res://Player.gd" type="Script" id=1]
|
||||
[ext_resource path="res://art/playerGrey_walk1.png" type="Texture" id=2]
|
||||
[ext_resource path="res://art/playerGrey_walk2.png" type="Texture" id=3]
|
||||
[ext_resource path="res://art/playerGrey_up1.png" type="Texture" id=4]
|
||||
[ext_resource path="res://art/playerGrey_up2.png" type="Texture" id=5]
|
||||
|
||||
[sub_resource type="SpriteFrames" id=1]
|
||||
animations = [ {
|
||||
"frames": [ ExtResource( 2 ), ExtResource( 3 ) ],
|
||||
"loop": true,
|
||||
"name": "right",
|
||||
"speed": 5.0
|
||||
}, {
|
||||
"frames": [ ExtResource( 4 ), ExtResource( 5 ) ],
|
||||
"loop": true,
|
||||
"name": "up",
|
||||
"speed": 5.0
|
||||
} ]
|
||||
|
||||
[sub_resource type="CapsuleShape2D" id=2]
|
||||
radius = 26.1701
|
||||
height = 14.822
|
||||
|
||||
[sub_resource type="Gradient" id=3]
|
||||
colors = PoolColorArray( 1, 1, 1, 0.501961, 1, 1, 1, 0 )
|
||||
|
||||
[sub_resource type="GradientTexture" id=4]
|
||||
gradient = SubResource( 3 )
|
||||
|
||||
[sub_resource type="Curve" id=5]
|
||||
_data = [ Vector2( 0.00501098, 0.5 ), 0.0, 0.0, 0, 0, Vector2( 0.994989, 0.324 ), 0.0, 0.0, 0, 0 ]
|
||||
|
||||
[sub_resource type="CurveTexture" id=6]
|
||||
curve = SubResource( 5 )
|
||||
|
||||
[sub_resource type="ParticlesMaterial" id=7]
|
||||
flag_disable_z = true
|
||||
gravity = Vector3( 0, 0, 0 )
|
||||
initial_velocity = 1.0
|
||||
orbit_velocity = 0.0
|
||||
orbit_velocity_random = 0.0
|
||||
scale = 0.75
|
||||
scale_curve = SubResource( 6 )
|
||||
color_ramp = SubResource( 4 )
|
||||
|
||||
[node name="Player" type="Area2D"]
|
||||
z_index = 10
|
||||
script = ExtResource( 1 )
|
||||
__meta__ = {
|
||||
"_edit_group_": true
|
||||
}
|
||||
|
||||
[node name="AnimatedSprite" type="AnimatedSprite" parent="."]
|
||||
scale = Vector2( 0.5, 0.5 )
|
||||
frames = SubResource( 1 )
|
||||
animation = "right"
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
shape = SubResource( 2 )
|
||||
|
||||
[node name="Trail" type="Particles2D" parent="."]
|
||||
z_index = -1
|
||||
amount = 10
|
||||
speed_scale = 2.0
|
||||
local_coords = false
|
||||
process_material = SubResource( 7 )
|
||||
texture = ExtResource( 2 )
|
||||
[connection signal="body_entered" from="." to="." method="_on_Player_body_entered"]
|
||||
BIN
2d/dodge_the_creeps/art/House In a Forest Loop.ogg
Normal file
15
2d/dodge_the_creeps/art/House In a Forest Loop.ogg.import
Normal file
@@ -0,0 +1,15 @@
|
||||
[remap]
|
||||
|
||||
importer="ogg_vorbis"
|
||||
type="AudioStreamOGGVorbis"
|
||||
path="res://.import/House In a Forest Loop.ogg-1a6a72ae843ad792b7039931227e8d50.oggstr"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://art/House In a Forest Loop.ogg"
|
||||
dest_files=[ "res://.import/House In a Forest Loop.ogg-1a6a72ae843ad792b7039931227e8d50.oggstr" ]
|
||||
|
||||
[params]
|
||||
|
||||
loop=true
|
||||
loop_offset=0
|
||||
BIN
2d/dodge_the_creeps/art/enemyFlyingAlt_1.png
Normal file
|
After Width: | Height: | Size: 2.0 KiB |
34
2d/dodge_the_creeps/art/enemyFlyingAlt_1.png.import
Normal file
@@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/enemyFlyingAlt_1.png-559f599b16c69b112c1b53f6332e9489.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://art/enemyFlyingAlt_1.png"
|
||||
dest_files=[ "res://.import/enemyFlyingAlt_1.png-559f599b16c69b112c1b53f6332e9489.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=false
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
||||
BIN
2d/dodge_the_creeps/art/enemyFlyingAlt_2.png
Normal file
|
After Width: | Height: | Size: 2.0 KiB |
34
2d/dodge_the_creeps/art/enemyFlyingAlt_2.png.import
Normal file
@@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/enemyFlyingAlt_2.png-31dc7310eda6e1b721224f3cd932c076.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://art/enemyFlyingAlt_2.png"
|
||||
dest_files=[ "res://.import/enemyFlyingAlt_2.png-31dc7310eda6e1b721224f3cd932c076.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=false
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
||||
BIN
2d/dodge_the_creeps/art/enemySwimming_1.png
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
34
2d/dodge_the_creeps/art/enemySwimming_1.png.import
Normal file
@@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/enemySwimming_1.png-dd0e11759dc3d624c8a704f6e98a3d80.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://art/enemySwimming_1.png"
|
||||
dest_files=[ "res://.import/enemySwimming_1.png-dd0e11759dc3d624c8a704f6e98a3d80.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=false
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
||||
BIN
2d/dodge_the_creeps/art/enemySwimming_2.png
Normal file
|
After Width: | Height: | Size: 2.0 KiB |
34
2d/dodge_the_creeps/art/enemySwimming_2.png.import
Normal file
@@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/enemySwimming_2.png-4c0cbc0732264c4ea3290340bd4a0a62.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://art/enemySwimming_2.png"
|
||||
dest_files=[ "res://.import/enemySwimming_2.png-4c0cbc0732264c4ea3290340bd4a0a62.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=false
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
||||
BIN
2d/dodge_the_creeps/art/enemyWalking_1.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
34
2d/dodge_the_creeps/art/enemyWalking_1.png.import
Normal file
@@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/enemyWalking_1.png-5af6eedbe61b701677d490ffdc1e6471.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://art/enemyWalking_1.png"
|
||||
dest_files=[ "res://.import/enemyWalking_1.png-5af6eedbe61b701677d490ffdc1e6471.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=false
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
||||
BIN
2d/dodge_the_creeps/art/enemyWalking_2.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
34
2d/dodge_the_creeps/art/enemyWalking_2.png.import
Normal file
@@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/enemyWalking_2.png-67c480ed60c35e95f5acb0436246b935.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://art/enemyWalking_2.png"
|
||||
dest_files=[ "res://.import/enemyWalking_2.png-67c480ed60c35e95f5acb0436246b935.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=false
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
||||
BIN
2d/dodge_the_creeps/art/gameover.wav
Normal file
21
2d/dodge_the_creeps/art/gameover.wav.import
Normal file
@@ -0,0 +1,21 @@
|
||||
[remap]
|
||||
|
||||
importer="wav"
|
||||
type="AudioStreamSample"
|
||||
path="res://.import/gameover.wav-98c95c744b35280048c2bd093cf8a356.sample"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://art/gameover.wav"
|
||||
dest_files=[ "res://.import/gameover.wav-98c95c744b35280048c2bd093cf8a356.sample" ]
|
||||
|
||||
[params]
|
||||
|
||||
force/8_bit=false
|
||||
force/mono=false
|
||||
force/max_rate=false
|
||||
force/max_rate_hz=44100
|
||||
edit/trim=true
|
||||
edit/normalize=true
|
||||
edit/loop=false
|
||||
compress/mode=0
|
||||
BIN
2d/dodge_the_creeps/art/playerGrey_up1.png
Normal file
|
After Width: | Height: | Size: 2.7 KiB |
34
2d/dodge_the_creeps/art/playerGrey_up1.png.import
Normal file
@@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/playerGrey_up1.png-6bd114d0a6beac91f48e3a7314d44564.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://art/playerGrey_up1.png"
|
||||
dest_files=[ "res://.import/playerGrey_up1.png-6bd114d0a6beac91f48e3a7314d44564.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=false
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
||||
BIN
2d/dodge_the_creeps/art/playerGrey_up2.png
Normal file
|
After Width: | Height: | Size: 2.7 KiB |
34
2d/dodge_the_creeps/art/playerGrey_up2.png.import
Normal file
@@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/playerGrey_up2.png-d6aba85f5f2675ebc7045efa7552ee79.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://art/playerGrey_up2.png"
|
||||
dest_files=[ "res://.import/playerGrey_up2.png-d6aba85f5f2675ebc7045efa7552ee79.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=false
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
||||
BIN
2d/dodge_the_creeps/art/playerGrey_walk1.png
Normal file
|
After Width: | Height: | Size: 2.7 KiB |
34
2d/dodge_the_creeps/art/playerGrey_walk1.png.import
Normal file
@@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/playerGrey_walk1.png-c4773fe7a7bf85d7ab732eb4458c2742.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://art/playerGrey_walk1.png"
|
||||
dest_files=[ "res://.import/playerGrey_walk1.png-c4773fe7a7bf85d7ab732eb4458c2742.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=false
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
||||
BIN
2d/dodge_the_creeps/art/playerGrey_walk2.png
Normal file
|
After Width: | Height: | Size: 2.9 KiB |
34
2d/dodge_the_creeps/art/playerGrey_walk2.png.import
Normal file
@@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/playerGrey_walk2.png-34d2d916366100182d08037c51884043.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://art/playerGrey_walk2.png"
|
||||
dest_files=[ "res://.import/playerGrey_walk2.png-34d2d916366100182d08037c51884043.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=false
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
||||
BIN
2d/dodge_the_creeps/art/set3_tiles.png
Executable file
|
After Width: | Height: | Size: 5.8 KiB |
34
2d/dodge_the_creeps/art/set3_tiles.png.import
Normal file
@@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/set3_tiles.png-7dd06b1fc0bcfaa06e9dd732f61382a2.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://art/set3_tiles.png"
|
||||
dest_files=[ "res://.import/set3_tiles.png-7dd06b1fc0bcfaa06e9dd732f61382a2.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=false
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
||||
2
2d/dodge_the_creeps/attributions.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
"Abstract Platformer" by kenney.nl is licensed under http://creativecommons.org/publicdomain/zero/1.0/
|
||||
"House in a Forest Loop" by https://opengameart.org/users/horrorpen is licensed under http://creativecommons.org/licenses/by/3.0/
|
||||
7
2d/dodge_the_creeps/default_env.tres
Normal file
@@ -0,0 +1,7 @@
|
||||
[gd_resource type="Environment" load_steps=2 format=2]
|
||||
|
||||
[sub_resource type="ProceduralSky" id=1]
|
||||
|
||||
[resource]
|
||||
background_mode = 2
|
||||
background_sky = SubResource( 1 )
|
||||
253
2d/dodge_the_creeps/fonts/FONTLOG.txt
Executable file
@@ -0,0 +1,253 @@
|
||||
Please distribute this file along with the Xolonium fonts when possible.
|
||||
|
||||
|
||||
Source
|
||||
|
||||
Find the sourcefiles of Xolonium at
|
||||
<gitlab.com/sev/xolonium>
|
||||
|
||||
|
||||
Credits
|
||||
|
||||
Xolonium is created with FontForge <fontforge.org>,
|
||||
Inkscape <inkscape.org>, Python <python.org>, and
|
||||
FontTools <github.com/fonttools>.
|
||||
|
||||
It originated as a custom font for the open-source
|
||||
game Xonotic <xonotic.org>. With many thanks to the
|
||||
Xonotic community for your support.
|
||||
|
||||
|
||||
Supported OpenType features
|
||||
|
||||
case Provides case sensitive placement of punctuation,
|
||||
brackets, and math symbols for uppercase text.
|
||||
frac Replaces number/number sequences with diagonal fractions.
|
||||
Numbers that touch a slash should not exceed 10 digits.
|
||||
kern Provides kerning for Latin, Greek, and Cyrillic scripts.
|
||||
locl Dutch: Replaces j with a stressed version if it follows í.
|
||||
Sami: Replaces n-form Eng with the preferred N-form version.
|
||||
Romanian and Moldovan: Replaces ŞşŢţ with the preferred ȘșȚț.
|
||||
pnum Replaces monospaced digits with proportional versions.
|
||||
sinf Replaces digits with scientific inferiors below the baseline.
|
||||
subs Replaces digits with subscript versions on the baseline.
|
||||
sups Replaces digits with superscript versions.
|
||||
zero Replaces zero with a slashed version.
|
||||
|
||||
|
||||
Supported glyph sets
|
||||
|
||||
Adobe Latin 3
|
||||
OpenType W1G
|
||||
ISO 8859-1 Western European
|
||||
ISO 8859-2 Central European
|
||||
ISO 8859-3 South European
|
||||
ISO 8859-4 North European
|
||||
ISO 8859-5 Cyrillic
|
||||
ISO 8859-7 Greek
|
||||
ISO 8859-9 Turkish
|
||||
ISO 8859-10 Nordic
|
||||
ISO 8859-13 Baltic Rim
|
||||
ISO 8859-14 Celtic
|
||||
ISO 8859-15 Western European
|
||||
ISO 8859-16 South-Eastern European
|
||||
|
||||
|
||||
Available glyphs
|
||||
|
||||
!"#$%&'()*+,-./0123456789:;<=>?
|
||||
@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_
|
||||
`abcdefghijklmnopqrstuvwxyz{|}~
|
||||
|
||||
¡¢£¤¥¦§¨©ª«¬ ®¯°±²³´µ¶·¸¹º»¼½¾¿
|
||||
ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞß
|
||||
àáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ
|
||||
ĀāĂ㥹ĆćĈĉĊċČčĎďĐđĒēĔĕĖėĘęĚěĜĝĞğ
|
||||
ĠġĢģĤĥĦħĨĩĪīĬĭĮįİıIJijĴĵĶķĸĹĺĻļĽľ
|
||||
ĿŀŁłŃńŅņŇňŊŋŌōŎŏŐőŒœŔŕŖŗŘřŚśŜŝŞş
|
||||
ŠšŢţŤťŦŧŨũŪūŬŭŮůŰűŲųŴŵŶŷŸŹźŻżŽž
|
||||
ƒǺǻǼǽǾǿȘșȚțȷ
|
||||
|
||||
ˆˇˉ˘˙˚˛˜˝
|
||||
|
||||
ͺ;΄΅Ά·ΈΉΊΌΎΏΐ
|
||||
ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩΪΫάέήίΰ
|
||||
αβγδεζηθικλμνξοπρςστυφχψωϊϋόύώ
|
||||
|
||||
ЀЁЂЃЄЅІЇЈЉЊЋЌЍЎЏАБВГДЕЖЗИЙКЛМНОП
|
||||
РСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмноп
|
||||
рстуфхцчшщъыьэюяѐёђѓєѕіїјљњћќѝўџ
|
||||
ѢѣѲѳѴѵҐґҒғҔҕҖҗҘҙҚқҜҝҞҟҠҡҢңҤҥҦҧҨҩ
|
||||
ҪҫҬҭҮүҰұҲҳҴҵҶҷҸҹҺһҼҽӀӁӂӇӈӋӌӏӐӑӒӓ
|
||||
ӔӕӖӗӘәӜӝӞӟӠӡӢӣӤӥӦӧӨөӮӯӰӱӲӳӴӵӶӷӸӹ
|
||||
Ԥԥ
|
||||
|
||||
ḂḃḊḋḞḟṀṁṖṗṠṡṪṫẀẁẂẃẄẅẞỲỳ
|
||||
|
||||
‒–—―‘’‚‛“”„‟†‡•…‰′″‹›‽‾⁄
|
||||
⁰⁴⁵⁶⁷⁸⁹⁺⁻⁼⁽⁾ⁿ₀₁₂₃₄₅₆₇₈₉₊₋₌₍₎
|
||||
₤₦₩₫€₯₱₹₺₽₿
|
||||
℅ℓ№℗™Ω℮
|
||||
⅛⅜⅝⅞
|
||||
←↑→↓
|
||||
∂∆∏∑−∕∙√∞∟∫≈≠≤≥
|
||||
⌖
|
||||
■▬▮▰▲▶▼◀◆◊●◢◣◤◥
|
||||
☄★☠☢☣⚙⚛⚠⚡⛔
|
||||
❇❈❌❤❰❱❲❳
|
||||
fffiflffiffl
|
||||
🌌🌍🌎🌏👽💣🔥🔫
|
||||
😁😃😄😆😇😈😉😊😎😐😒😕😘
|
||||
😛😝😞😟😠😣😭😮😲😴😵
|
||||
🚀
|
||||
|
||||
|
||||
Debugging glyphs
|
||||
|
||||
U+EFFD Font version
|
||||
U+F000 Font hinting indicator
|
||||
|
||||
|
||||
Changelog
|
||||
|
||||
Xolonium 4.1 2016-11-22 Severin Meyer <sev.ch@web.de>
|
||||
Reverted frac OpenType feature to a more stable implementation
|
||||
|
||||
Xolonium 4.0 2016-10-08 Severin Meyer <sev.ch@web.de>
|
||||
Decreased width of most glyphs
|
||||
Thinner vertical stems in Xolonium-Regular
|
||||
Thicker horizontal stems in Xolonium-Bold
|
||||
Revised diagonal stems
|
||||
Lowered middle bars
|
||||
Revised diacritical bars
|
||||
Added glyphs:
|
||||
ӏẞ₿
|
||||
U+2007 U+2008 U+2009 U+200A U+202F
|
||||
U+EFFD U+F000
|
||||
Revised glyphs:
|
||||
$&,JKQRXkwxy~¢¤ßǻ˜ζκλμξφЖУжћѴѵ∕₱₺₦₩€ℓ№≈ffffiffl
|
||||
❤🌍🌎🌏😁😄😇😈😉😊😘😭😮😴🚀
|
||||
Removed uncommon glyphs:
|
||||
ʼnſʼҌҍҎҏҾҿӃӄӇӈӚӛӪӫӬӭ
|
||||
U+0312 U+0313 U+0326
|
||||
Simplified OpenType features pnum, zero, and case
|
||||
Removed OpenType feature dlig
|
||||
Revised vertical metrics
|
||||
Merged outlines of composite glyphs in otf version
|
||||
Added ttf version with custom outlines and instructions
|
||||
Added woff and woff2 version
|
||||
|
||||
Xolonium 3.1 2015-06-10 Severin Meyer <sev.ch@web.de>
|
||||
Added currency glyphs:
|
||||
₦₩₫₱₹₺₽
|
||||
Revised glyph:
|
||||
₯
|
||||
Relicensed public release under the SIL Open Font License 1.1
|
||||
|
||||
Xolonium 3.0 2015-05-04 Severin Meyer <sev.ch@web.de>
|
||||
Decreased width of glyphs
|
||||
Decreased descender height
|
||||
Increased height of super/subscript glyphs
|
||||
Revised width of dashes, underscore, and overscore
|
||||
Sharper bends with more circular proportions
|
||||
Decreased stroke thickness of mathematical glyphs
|
||||
Revised diacritical marks
|
||||
Revised diacritical bars
|
||||
Revised Cyrillic hooks
|
||||
Revised glyphs:
|
||||
GQRYjmuwßŊŒſƒǻfffiffiffl
|
||||
ΞΨΩδζιξπςστυφω
|
||||
ЉЄДЛУЭЯбдлэяєљђєћѢѣҨҩҼҽӃӄӘә
|
||||
#$&'()*,/69?@[]{}~¡£¤¥§©®¿
|
||||
‹›₤€₯ℓ№℗℮←↑→↓∂∏∑∞≈▰☄❈❰❱❲❳😝
|
||||
Raised vertical position of mathematical glyphs
|
||||
Unified advance width of numeral and monetary glyphs
|
||||
Unified advance width of mathematical glyphs
|
||||
Revised bearings
|
||||
Rewrote kern feature
|
||||
Bolder Xolonium-Bold with improved proportions
|
||||
Updated glyph names to conform to the AGLFN 1.7
|
||||
Revised hints and PS Private Dictionary
|
||||
Added glyphs:
|
||||
ӶӷԤԥ
|
||||
Added OpenType features:
|
||||
case frac liga locl pnum sinf subs sups zero
|
||||
|
||||
Xolonium 2.4 2014-12-23 Severin Meyer <sev.ch@web.de>
|
||||
Added dingbats:
|
||||
⛔💣🔥
|
||||
Revised size and design of emoticons
|
||||
Revised dingbats:
|
||||
⌖☄☠☣⚙⚛⚠⚡❇❈🌌🌍🌎🌏🔫
|
||||
Removed dingbat:
|
||||
💥
|
||||
|
||||
Xolonium 2.3 2014-08-14 Severin Meyer <sev.ch@web.de>
|
||||
Bugfixed ε and έ, thanks to bowzee for the feedback
|
||||
|
||||
Xolonium 2.2 2014-03-01 Severin Meyer <sev.ch@web.de>
|
||||
Added dingbats:
|
||||
⌖◆●❌💥
|
||||
Revised dingbats:
|
||||
•←↑→↓◊☄★☠☣⚙⚛⚠⚡❇❈❤🌌🌍🌎🌏👽🔫🚀
|
||||
Removed dingbats:
|
||||
♻✪💡📡🔋🔧🔭
|
||||
|
||||
Xolonium 2.1 2013-10-20 Severin Meyer <sev.ch@web.de>
|
||||
Added dingbats:
|
||||
←↑→↓❰❱❲❳■▬▮▰▲▶▼◀◢◣◤◥
|
||||
☄★☠☢☣♻⚙⚛⚠⚡✪❇❈❤
|
||||
🌌🌍🌎🌏👽💡📡🔋🔧🔫🔭🚀
|
||||
😁😃😄😆😇😈😉😊😎😐😒😕
|
||||
😘😛😝😞😟😠😣😭😮😲😴😵
|
||||
|
||||
Xolonium 2.0.1 2013-07-12 Severin Meyer <sev.ch@web.de>
|
||||
Reorganised and simplified files
|
||||
|
||||
Xolonium 2.0 2012-08-11 Severin Meyer <sev.ch@web.de>
|
||||
Revised bends
|
||||
Revised thickness of uppercase diagonal stems
|
||||
Revised diacritical marks
|
||||
Revised hints and PS Private Dictionary
|
||||
Revised glyphs:
|
||||
*1469@DPRly{}§©®¶ÐÞƒΘΞαεζνξνυЄЉЊ
|
||||
ЏБЗЛУЧЪЫЬЭЯбзлчъыьэяєљњџ•€∂∙√∞∫≠
|
||||
Completed glyph sets:
|
||||
Adobe Latin 3
|
||||
OpenType World Glyph Set 1 (W1G)
|
||||
Ghostscript Standard (ghostscript-fonts-std-8.11)
|
||||
Added OpenType kern feature
|
||||
Added Xolonium-Bold
|
||||
|
||||
Xolonium 1.2 2011-02-12 Severin Meyer <sev.ch@web.de>
|
||||
Revised glyphs:
|
||||
D·Ðı
|
||||
Completed glyph sets:
|
||||
ISO 8859-7 (Greek)
|
||||
Unicode Latin Extended-A block
|
||||
Added glyphs:
|
||||
†‡•…‰⁄™∂∑−√∞≠≤≥
|
||||
|
||||
Xolonium 1.1 2011-01-17 Severin Meyer <sev.ch@web.de>
|
||||
Revised placement of cedilla and ogonek in accented glyphs
|
||||
Revised glyphs:
|
||||
,;DKTjkvwxy¥§Ð˛€
|
||||
Completed glyph sets:
|
||||
ISO 8859-2 (Central European)
|
||||
ISO 8859-3 (South European, Esperanto)
|
||||
ISO 8859-4 (North European)
|
||||
ISO 8859-5 (Cyrillic)
|
||||
ISO 8859-9 (Turkish)
|
||||
ISO 8859-10 (Nordic)
|
||||
ISO 8859-13 (Baltic Rim)
|
||||
ISO 8859-14 (Celtic)
|
||||
ISO 8859-16 (South-Eastern European)
|
||||
Added glyphs:
|
||||
ȷʼ̒ ЀЍѐѝ‒–—‘’‚‛“”„‟‹›
|
||||
|
||||
Xolonium 1.0 2011-01-04 Severin Meyer <sev.ch@web.de>
|
||||
Completed glyph sets:
|
||||
ISO 8859-1 (Western European)
|
||||
ISO 8859-15 (Western European)
|
||||
Added glyphs:
|
||||
ĄĆĘŁŃŚŹŻąćęłńśźżıˆˇ˙˚˛˜
|
||||
94
2d/dodge_the_creeps/fonts/LICENSE.txt
Normal file
@@ -0,0 +1,94 @@
|
||||
Copyright 2011-2016 Severin Meyer <sev.ch@web.de>,
|
||||
with Reserved Font Name Xolonium.
|
||||
|
||||
This Font Software is licensed under the SIL Open Font License,
|
||||
Version 1.1. This license is copied below, and is also available
|
||||
with a FAQ at <http://scripts.sil.org/OFL>
|
||||
|
||||
|
||||
-----------------------------------------------------------
|
||||
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
||||
-----------------------------------------------------------
|
||||
|
||||
PREAMBLE
|
||||
The goals of the Open Font License (OFL) are to stimulate worldwide
|
||||
development of collaborative font projects, to support the font creation
|
||||
efforts of academic and linguistic communities, and to provide a free and
|
||||
open framework in which fonts may be shared and improved in partnership
|
||||
with others.
|
||||
|
||||
The OFL allows the licensed fonts to be used, studied, modified and
|
||||
redistributed freely as long as they are not sold by themselves. The
|
||||
fonts, including any derivative works, can be bundled, embedded,
|
||||
redistributed and/or sold with any software provided that any reserved
|
||||
names are not used by derivative works. The fonts and derivatives,
|
||||
however, cannot be released under any other type of license. The
|
||||
requirement for fonts to remain under this license does not apply
|
||||
to any document created using the fonts or their derivatives.
|
||||
|
||||
DEFINITIONS
|
||||
"Font Software" refers to the set of files released by the Copyright
|
||||
Holder(s) under this license and clearly marked as such. This may
|
||||
include source files, build scripts and documentation.
|
||||
|
||||
"Reserved Font Name" refers to any names specified as such after the
|
||||
copyright statement(s).
|
||||
|
||||
"Original Version" refers to the collection of Font Software components as
|
||||
distributed by the Copyright Holder(s).
|
||||
|
||||
"Modified Version" refers to any derivative made by adding to, deleting,
|
||||
or substituting -- in part or in whole -- any of the components of the
|
||||
Original Version, by changing formats or by porting the Font Software to a
|
||||
new environment.
|
||||
|
||||
"Author" refers to any designer, engineer, programmer, technical
|
||||
writer or other person who contributed to the Font Software.
|
||||
|
||||
PERMISSION & CONDITIONS
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
||||
redistribute, and sell modified and unmodified copies of the Font
|
||||
Software, subject to the following conditions:
|
||||
|
||||
1) Neither the Font Software nor any of its individual components,
|
||||
in Original or Modified Versions, may be sold by itself.
|
||||
|
||||
2) Original or Modified Versions of the Font Software may be bundled,
|
||||
redistributed and/or sold with any software, provided that each copy
|
||||
contains the above copyright notice and this license. These can be
|
||||
included either as stand-alone text files, human-readable headers or
|
||||
in the appropriate machine-readable metadata fields within text or
|
||||
binary files as long as those fields can be easily viewed by the user.
|
||||
|
||||
3) No Modified Version of the Font Software may use the Reserved Font
|
||||
Name(s) unless explicit written permission is granted by the corresponding
|
||||
Copyright Holder. This restriction only applies to the primary font name as
|
||||
presented to the users.
|
||||
|
||||
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
||||
Software shall not be used to promote, endorse or advertise any
|
||||
Modified Version, except to acknowledge the contribution(s) of the
|
||||
Copyright Holder(s) and the Author(s) or with their explicit written
|
||||
permission.
|
||||
|
||||
5) The Font Software, modified or unmodified, in part or in whole,
|
||||
must be distributed entirely under this license, and must not be
|
||||
distributed under any other license. The requirement for fonts to
|
||||
remain under this license does not apply to any document created
|
||||
using the Font Software.
|
||||
|
||||
TERMINATION
|
||||
This license becomes null and void if any of the above conditions are
|
||||
not met.
|
||||
|
||||
DISCLAIMER
|
||||
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
||||
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
||||
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
||||
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
||||
OTHER DEALINGS IN THE FONT SOFTWARE.
|
||||
BIN
2d/dodge_the_creeps/fonts/Xolonium-Regular.ttf
Normal file
BIN
2d/dodge_the_creeps/icon.png
Normal file
|
After Width: | Height: | Size: 2.2 KiB |
@@ -3,20 +3,21 @@
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://icon.png"
|
||||
source_md5="49c0855bb2f599fd216190fb14eac778"
|
||||
|
||||
dest_files=[ "res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex" ]
|
||||
dest_md5="ef5bb91cdcf00e1ad730573fc7704640"
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=true
|
||||
@@ -26,6 +27,7 @@ flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
63
2d/dodge_the_creeps/project.godot
Normal file
@@ -0,0 +1,63 @@
|
||||
; 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=4
|
||||
|
||||
_global_script_classes=[ ]
|
||||
_global_script_class_icons={
|
||||
}
|
||||
|
||||
[application]
|
||||
|
||||
config/name="Dodge the Creeps"
|
||||
run/main_scene="res://Main.tscn"
|
||||
config/icon="res://icon.png"
|
||||
|
||||
[display]
|
||||
|
||||
window/size/width=480
|
||||
window/size/height=720
|
||||
|
||||
[input]
|
||||
|
||||
move_left={
|
||||
"deadzone": 0.5,
|
||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777231,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":65,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":14,"pressure":0.0,"pressed":false,"script":null)
|
||||
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":0,"axis_value":-1.0,"script":null)
|
||||
]
|
||||
}
|
||||
move_right={
|
||||
"deadzone": 0.5,
|
||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777233,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":68,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":15,"pressure":0.0,"pressed":false,"script":null)
|
||||
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":0,"axis_value":1.0,"script":null)
|
||||
]
|
||||
}
|
||||
move_up={
|
||||
"deadzone": 0.5,
|
||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777232,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":87,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":12,"pressure":0.0,"pressed":false,"script":null)
|
||||
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":1,"axis_value":-1.0,"script":null)
|
||||
]
|
||||
}
|
||||
move_down={
|
||||
"deadzone": 0.5,
|
||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777234,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":83,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":13,"pressure":0.0,"pressed":false,"script":null)
|
||||
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":1,"axis_value":1.0,"script":null)
|
||||
]
|
||||
}
|
||||
|
||||
[rendering]
|
||||
|
||||
environment/default_environment="res://default_env.tres"
|
||||
25
2d/finite_state_machine/Demo.tscn
Normal file
@@ -0,0 +1,25 @@
|
||||
[gd_scene load_steps=5 format=2]
|
||||
|
||||
[ext_resource path="res://player/Player.tscn" type="PackedScene" id=1]
|
||||
[ext_resource path="res://debug/Explanations.tscn" type="PackedScene" id=2]
|
||||
[ext_resource path="res://debug/StatesStackDiplayer.tscn" type="PackedScene" id=3]
|
||||
[ext_resource path="res://debug/ControlsPanel.tscn" type="PackedScene" id=4]
|
||||
|
||||
[node name="Demo" type="Node"]
|
||||
|
||||
[node name="Player" parent="." instance=ExtResource( 1 )]
|
||||
|
||||
[node name="Explanations" parent="." instance=ExtResource( 2 )]
|
||||
|
||||
[node name="Control" type="Control" parent="."]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="StatesStackDiplayer" parent="Control" instance=ExtResource( 3 )]
|
||||
|
||||
[node name="ControlsPanel" parent="Control" instance=ExtResource( 4 )]
|
||||
|
||||
[editable path="Player"]
|
||||
41
2d/finite_state_machine/debug/ControlsPanel.tscn
Normal file
@@ -0,0 +1,41 @@
|
||||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://fonts/source_code_pro_explanations.tres" type="DynamicFont" id=1]
|
||||
|
||||
[node name="ControlsPanel" type="Panel"]
|
||||
anchor_left = 1.0
|
||||
anchor_right = 1.0
|
||||
margin_left = -220.0
|
||||
margin_bottom = 170.0
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="Keys" type="Label" parent="."]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_left = 10.0
|
||||
margin_top = 10.0
|
||||
margin_right = -10.0
|
||||
margin_bottom = -10.0
|
||||
custom_fonts/font = ExtResource( 1 )
|
||||
text = "Shoot:
|
||||
Attack:
|
||||
Stagger:
|
||||
Jump:
|
||||
Sprint:"
|
||||
|
||||
[node name="Keys2" type="Label" parent="."]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_left = 10.0
|
||||
margin_top = 10.0
|
||||
margin_right = -10.0
|
||||
margin_bottom = -10.0
|
||||
custom_fonts/font = ExtResource( 1 )
|
||||
text = "R
|
||||
F
|
||||
X
|
||||
Space
|
||||
Shift"
|
||||
align = 2
|
||||
39
2d/finite_state_machine/debug/Explanations.tscn
Normal file
@@ -0,0 +1,39 @@
|
||||
[gd_scene load_steps=3 format=2]
|
||||
|
||||
[ext_resource path="res://fonts/source_code_pro_explanations_bold.tres" type="DynamicFont" id=1]
|
||||
[ext_resource path="res://fonts/source_code_pro_explanations.tres" type="DynamicFont" id=2]
|
||||
|
||||
[node name="Explanations" type="RichTextLabel"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_left = 10.0
|
||||
margin_top = -370.0
|
||||
margin_right = -10.0
|
||||
margin_bottom = -730.0
|
||||
rect_clip_content = false
|
||||
mouse_filter = 2
|
||||
size_flags_vertical = 4
|
||||
custom_fonts/bold_font = ExtResource( 1 )
|
||||
custom_fonts/normal_font = ExtResource( 2 )
|
||||
bbcode_enabled = true
|
||||
bbcode_text = "This example shows how to apply the State programming pattern in GDscript, including Hierarchical States, and a pushdown automaton.
|
||||
|
||||
States are common in games. You can use the pattern to:
|
||||
|
||||
1. Separate each behavior and transitions between behaviors, thus make scripts shorter and easier to manage
|
||||
2. Respect the Single Responsibility Principle. Each State object represents [b]one[/b] action
|
||||
3. Improve your code's structure. Look at the scene tree and FileSystem tab: without looking at the code, you'll know what the Player can or cannot do.
|
||||
|
||||
You can read more about States in the excellent [url=http://gameprogrammingpatterns.com/state.html]Game Programming Patterns ebook[/url]."
|
||||
text = "This example shows how to apply the State programming pattern in GDscript, including Hierarchical States, and a pushdown automaton.
|
||||
|
||||
States are common in games. You can use the pattern to:
|
||||
|
||||
1. Separate each behavior and transitions between behaviors, thus make scripts shorter and easier to manage
|
||||
2. Respect the Single Responsibility Principle. Each State object represents one action
|
||||
3. Improve your code's structure. Look at the scene tree and FileSystem tab: without looking at the code, you'll know what the Player can or cannot do.
|
||||
|
||||
You can read more about States in the excellent Game Programming Patterns ebook."
|
||||
__meta__ = {
|
||||
"_edit_lock_": true
|
||||
}
|
||||
48
2d/finite_state_machine/debug/StatesStackDiplayer.tscn
Normal file
@@ -0,0 +1,48 @@
|
||||
[gd_scene load_steps=4 format=2]
|
||||
|
||||
[ext_resource path="res://debug/states_stack_displayer.gd" type="Script" id=1]
|
||||
[ext_resource path="res://fonts/SourceCodePro-Bold.ttf" type="DynamicFontData" id=2]
|
||||
|
||||
[sub_resource type="DynamicFont" id=1]
|
||||
size = 20
|
||||
use_filter = true
|
||||
font_data = ExtResource( 2 )
|
||||
|
||||
[node name="StatesStackDiplayer" type="Panel"]
|
||||
margin_right = 210.0
|
||||
margin_bottom = 170.0
|
||||
script = ExtResource( 1 )
|
||||
__meta__ = {
|
||||
"_edit_group_": true
|
||||
}
|
||||
|
||||
[node name="Title" type="Label" parent="."]
|
||||
anchor_left = 0.5
|
||||
anchor_right = 0.5
|
||||
margin_left = -105.0
|
||||
margin_right = 105.0
|
||||
margin_bottom = 40.0
|
||||
custom_fonts/font = SubResource( 1 )
|
||||
text = "Pushown"
|
||||
align = 1
|
||||
valign = 1
|
||||
uppercase = true
|
||||
|
||||
[node name="States" type="Label" parent="."]
|
||||
margin_left = 20.0
|
||||
margin_top = 50.0
|
||||
margin_right = 190.0
|
||||
margin_bottom = 170.0
|
||||
custom_fonts/font = SubResource( 1 )
|
||||
text = "Jump
|
||||
Test"
|
||||
align = 1
|
||||
|
||||
[node name="Numbers" type="Label" parent="."]
|
||||
margin_left = 20.0
|
||||
margin_top = 50.0
|
||||
margin_right = 190.0
|
||||
margin_bottom = 170.0
|
||||
custom_fonts/font = SubResource( 1 )
|
||||
text = "1.
|
||||
2."
|
||||
14
2d/finite_state_machine/debug/states_stack_displayer.gd
Normal file
@@ -0,0 +1,14 @@
|
||||
extends Panel
|
||||
|
||||
onready var fsm_node = get_node("../../Player/StateMachine")
|
||||
|
||||
func _process(_delta):
|
||||
var states_names = ""
|
||||
var numbers = ""
|
||||
var index = 0
|
||||
for state in fsm_node.states_stack:
|
||||
states_names += state.get_name() + '\n'
|
||||
numbers += str(index) + '\n'
|
||||
index += 1
|
||||
$States.text = states_names
|
||||
$Numbers.text = numbers
|
||||
13
2d/finite_state_machine/default_env.tres
Normal file
@@ -0,0 +1,13 @@
|
||||
[gd_resource type="Environment" load_steps=2 format=2]
|
||||
|
||||
[sub_resource type="ProceduralSky" id=1]
|
||||
sky_top_color = Color( 0.0470588, 0.454902, 0.976471, 1 )
|
||||
sky_horizon_color = Color( 0.556863, 0.823529, 0.909804, 1 )
|
||||
sky_curve = 0.25
|
||||
ground_bottom_color = Color( 0.101961, 0.145098, 0.188235, 1 )
|
||||
ground_horizon_color = Color( 0.482353, 0.788235, 0.952941, 1 )
|
||||
ground_curve = 0.01
|
||||
|
||||
[resource]
|
||||
background_mode = 2
|
||||
background_sky = SubResource( 1 )
|
||||
BIN
2d/finite_state_machine/fonts/SourceCodePro-Black.ttf
Normal file
BIN
2d/finite_state_machine/fonts/SourceCodePro-Bold.ttf
Normal file
@@ -0,0 +1,12 @@
|
||||
[gd_resource type="DynamicFont" load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://fonts/SourceCodePro-Bold.ttf" type="DynamicFontData" id=1]
|
||||
|
||||
[resource]
|
||||
|
||||
size = 20
|
||||
use_mipmaps = false
|
||||
use_filter = true
|
||||
font_data = ExtResource( 1 )
|
||||
_sections_unfolded = [ "Font", "Settings" ]
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
[gd_resource type="DynamicFont" load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://fonts/SourceCodePro-Black.ttf" type="DynamicFontData" id=1]
|
||||
|
||||
[resource]
|
||||
|
||||
size = 24
|
||||
use_mipmaps = false
|
||||
use_filter = true
|
||||
font_data = ExtResource( 1 )
|
||||
_sections_unfolded = [ "Font", "Settings" ]
|
||||
|
||||
BIN
2d/finite_state_machine/icon.png
Normal file
|
After Width: | Height: | Size: 2.2 KiB |
@@ -3,20 +3,21 @@
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://icon.png"
|
||||
source_md5="9be177e863d37787c0836d64924b3503"
|
||||
|
||||
dest_files=[ "res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex" ]
|
||||
dest_md5="6339016da0f704252e68ba6dd6477388"
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=true
|
||||
@@ -26,6 +27,7 @@ flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
121
2d/finite_state_machine/player/Player.tscn
Normal file
@@ -0,0 +1,121 @@
|
||||
[gd_scene load_steps=20 format=2]
|
||||
|
||||
[ext_resource path="res://player/player_controller.gd" type="Script" id=1]
|
||||
[ext_resource path="res://player/player_state_machine.gd" type="Script" id=2]
|
||||
[ext_resource path="res://player/states/motion/on_ground/idle.gd" type="Script" id=3]
|
||||
[ext_resource path="res://player/states/motion/on_ground/move.gd" type="Script" id=4]
|
||||
[ext_resource path="res://player/states/motion/in_air/jump.gd" type="Script" id=5]
|
||||
[ext_resource path="res://player/states/combat/stagger.gd" type="Script" id=6]
|
||||
[ext_resource path="res://player/states/combat/attack.gd" type="Script" id=7]
|
||||
[ext_resource path="res://player/states/die.gd" type="Script" id=8]
|
||||
[ext_resource path="res://player/shadow.png" type="Texture" id=9]
|
||||
[ext_resource path="res://player/body.png" type="Texture" id=10]
|
||||
[ext_resource path="res://player/bullet/bullet_spawner.gd" type="Script" id=11]
|
||||
[ext_resource path="res://player/weapon/weapon_pivot.gd" type="Script" id=12]
|
||||
[ext_resource path="res://player/weapon/Sword.tscn" type="PackedScene" id=13]
|
||||
[ext_resource path="res://fonts/SourceCodePro-Bold.ttf" type="DynamicFontData" id=14]
|
||||
[ext_resource path="res://player/states/debug/state_name_displayer.gd" type="Script" id=15]
|
||||
|
||||
[sub_resource type="Animation" id=1]
|
||||
|
||||
[sub_resource type="Animation" id=2]
|
||||
length = 0.6
|
||||
tracks/0/type = "value"
|
||||
tracks/0/path = NodePath("BodyPivot/Body:modulate")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/keys = {
|
||||
"times": PoolRealArray( 0, 0.05, 0.1, 0.15, 0.2, 0.25, 0.4 ),
|
||||
"transitions": PoolRealArray( 1, 1, 1, 1, 1, 1, 1 ),
|
||||
"update": 0,
|
||||
"values": [ Color( 1, 1, 1, 1 ), Color( 1, 0, 0, 1 ), Color( 1, 1, 1, 1 ), Color( 1, 0, 0, 1 ), Color( 1, 1, 1, 1 ), Color( 1, 0, 0, 1 ), Color( 1, 1, 1, 1 ) ]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id=3]
|
||||
|
||||
[sub_resource type="DynamicFont" id=4]
|
||||
size = 20
|
||||
use_filter = true
|
||||
font_data = ExtResource( 14 )
|
||||
|
||||
[node name="Player" type="KinematicBody2D"]
|
||||
position = Vector2( 628.826, 391.266 )
|
||||
script = ExtResource( 1 )
|
||||
__meta__ = {
|
||||
"_edit_horizontal_guides_": [ ]
|
||||
}
|
||||
|
||||
[node name="StateMachine" type="Node" parent="."]
|
||||
script = ExtResource( 2 )
|
||||
|
||||
[node name="Idle" type="Node" parent="StateMachine"]
|
||||
script = ExtResource( 3 )
|
||||
|
||||
[node name="Move" type="Node" parent="StateMachine"]
|
||||
script = ExtResource( 4 )
|
||||
|
||||
[node name="Jump" type="Node" parent="StateMachine"]
|
||||
script = ExtResource( 5 )
|
||||
|
||||
[node name="Stagger" type="Node" parent="StateMachine"]
|
||||
script = ExtResource( 6 )
|
||||
|
||||
[node name="Attack" type="Node" parent="StateMachine"]
|
||||
script = ExtResource( 7 )
|
||||
|
||||
[node name="Die" type="Node" parent="StateMachine"]
|
||||
script = ExtResource( 8 )
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||
anims/idle = SubResource( 1 )
|
||||
anims/stagger = SubResource( 2 )
|
||||
anims/walk = SubResource( 3 )
|
||||
|
||||
[node name="Shadow" type="Sprite" parent="."]
|
||||
self_modulate = Color( 1, 1, 1, 0.361098 )
|
||||
position = Vector2( 0, -4 )
|
||||
texture = ExtResource( 9 )
|
||||
|
||||
[node name="BodyPivot" type="Position2D" parent="."]
|
||||
|
||||
[node name="Body" type="Sprite" parent="BodyPivot"]
|
||||
position = Vector2( 0, -58.8242 )
|
||||
texture = ExtResource( 10 )
|
||||
|
||||
[node name="BulletSpawn" type="Node2D" parent="BodyPivot"]
|
||||
position = Vector2( 1.17401, -61.266 )
|
||||
script = ExtResource( 11 )
|
||||
|
||||
[node name="CooldownTimer" type="Timer" parent="BodyPivot/BulletSpawn"]
|
||||
wait_time = 0.2
|
||||
one_shot = true
|
||||
|
||||
[node name="WeaponPivot" type="Position2D" parent="BodyPivot"]
|
||||
position = Vector2( 1.17401, -61.266 )
|
||||
script = ExtResource( 12 )
|
||||
|
||||
[node name="Offset" type="Position2D" parent="BodyPivot/WeaponPivot"]
|
||||
position = Vector2( 110, 0 )
|
||||
|
||||
[node name="Sword" parent="BodyPivot/WeaponPivot/Offset" instance=ExtResource( 13 )]
|
||||
|
||||
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="."]
|
||||
polygon = PoolVector2Array( -20, 0, -20, -20, 20, -20, 20, 0 )
|
||||
|
||||
[node name="StateNameDisplayer" type="Label" parent="."]
|
||||
margin_left = -109.0
|
||||
margin_top = -172.0
|
||||
margin_right = 110.0
|
||||
margin_bottom = -138.0
|
||||
custom_fonts/font = SubResource( 4 )
|
||||
text = "Test"
|
||||
align = 1
|
||||
valign = 1
|
||||
uppercase = true
|
||||
script = ExtResource( 15 )
|
||||
[connection signal="state_changed" from="StateMachine" to="BodyPivot/WeaponPivot/Offset/Sword" method="_on_StateMachine_state_changed"]
|
||||
[connection signal="state_changed" from="StateMachine" to="StateNameDisplayer" method="_on_StateMachine_state_changed"]
|
||||
[connection signal="animation_finished" from="AnimationPlayer" to="StateMachine" method="_on_animation_finished"]
|
||||
[connection signal="attack_finished" from="BodyPivot/WeaponPivot/Offset/Sword" to="StateMachine/Attack" method="_on_Sword_attack_finished"]
|
||||
BIN
2d/finite_state_machine/player/body.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
@@ -2,21 +2,22 @@
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/path.png-03249d8c3f5af613913d0eb997e480a3.stex"
|
||||
path="res://.import/body.png-313f6363670a5852a7b7126ab476d8b1.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://path.png"
|
||||
source_md5="e72fbffb80ea739cf373a488a6d0ab27"
|
||||
|
||||
dest_files=[ "res://.import/path.png-03249d8c3f5af613913d0eb997e480a3.stex" ]
|
||||
dest_md5="9b012237e342f634293969fed09b3966"
|
||||
source_file="res://player/body.png"
|
||||
dest_files=[ "res://.import/body.png-313f6363670a5852a7b7126ab476d8b1.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=true
|
||||
@@ -26,6 +27,7 @@ flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
14
2d/finite_state_machine/player/bullet/Bullet.tscn
Normal file
@@ -0,0 +1,14 @@
|
||||
[gd_scene load_steps=3 format=2]
|
||||
|
||||
[ext_resource path="res://player/bullet/bullet.gd" type="Script" id=1]
|
||||
|
||||
[sub_resource type="CircleShape2D" id=1]
|
||||
radius = 12.0
|
||||
|
||||
[node name="Bullet" type="KinematicBody2D"]
|
||||
collision_layer = 2
|
||||
collision_mask = 2
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
shape = SubResource( 1 )
|
||||
26
2d/finite_state_machine/player/bullet/bullet.gd
Normal file
@@ -0,0 +1,26 @@
|
||||
extends KinematicBody2D
|
||||
|
||||
var direction = Vector2()
|
||||
export(float) var speed = 1000.0
|
||||
|
||||
func _ready():
|
||||
set_as_toplevel(true)
|
||||
|
||||
|
||||
func _physics_process(delta):
|
||||
if is_outside_view_bounds():
|
||||
queue_free()
|
||||
|
||||
var motion = direction * speed * delta
|
||||
var collision_info = move_and_collide(motion)
|
||||
if collision_info:
|
||||
queue_free()
|
||||
|
||||
|
||||
func is_outside_view_bounds():
|
||||
return position.x > OS.get_screen_size().x or position.x < 0.0 \
|
||||
or position.y > OS.get_screen_size().y or position.y < 0.0
|
||||
|
||||
|
||||
func _draw():
|
||||
draw_circle(Vector2(), $CollisionShape2D.shape.radius, Color.white)
|
||||
17
2d/finite_state_machine/player/bullet/bullet_spawner.gd
Normal file
@@ -0,0 +1,17 @@
|
||||
extends Node2D
|
||||
|
||||
var bullet = preload("Bullet.tscn")
|
||||
|
||||
func _input(event):
|
||||
if event.is_action_pressed("fire"):
|
||||
fire(owner.look_direction)
|
||||
|
||||
|
||||
func fire(direction):
|
||||
if not $CooldownTimer.is_stopped():
|
||||
return
|
||||
|
||||
$CooldownTimer.start()
|
||||
var new_bullet = bullet.instance()
|
||||
new_bullet.direction = direction
|
||||
add_child(new_bullet)
|
||||
25
2d/finite_state_machine/player/player_controller.gd
Normal file
@@ -0,0 +1,25 @@
|
||||
extends KinematicBody2D
|
||||
# The Player is a KinematicBody2D, in other words a physics-driven object.
|
||||
# It can move, collide with the world, etc...
|
||||
# The player has a state machine, but the body and the state machine are separate.
|
||||
|
||||
signal direction_changed(new_direction)
|
||||
|
||||
var look_direction = Vector2.RIGHT setget set_look_direction
|
||||
|
||||
func take_damage(attacker, amount, effect = null):
|
||||
if is_a_parent_of(attacker):
|
||||
return
|
||||
$States/Stagger.knockback_direction = (attacker.global_position - global_position).normalized()
|
||||
$Health.take_damage(amount, effect)
|
||||
|
||||
|
||||
func set_dead(value):
|
||||
set_process_input(not value)
|
||||
set_physics_process(not value)
|
||||
$CollisionPolygon2D.disabled = value
|
||||
|
||||
|
||||
func set_look_direction(value):
|
||||
look_direction = value
|
||||
emit_signal("direction_changed", value)
|
||||
32
2d/finite_state_machine/player/player_state_machine.gd
Normal file
@@ -0,0 +1,32 @@
|
||||
extends "res://state_machine/state_machine.gd"
|
||||
|
||||
func _ready():
|
||||
states_map = {
|
||||
"idle": $Idle,
|
||||
"move": $Move,
|
||||
"jump": $Jump,
|
||||
"stagger": $Stagger,
|
||||
"attack": $Attack,
|
||||
}
|
||||
|
||||
|
||||
func _change_state(state_name):
|
||||
# The base state_machine interface this node extends does most of the work.
|
||||
if not _active:
|
||||
return
|
||||
if state_name in ["stagger", "jump", "attack"]:
|
||||
states_stack.push_front(states_map[state_name])
|
||||
if state_name == "jump" and current_state == $Move:
|
||||
$Jump.initialize($Move.speed, $Move.velocity)
|
||||
._change_state(state_name)
|
||||
|
||||
|
||||
func _input(event):
|
||||
# Here we only handle input that can interrupt states, attacking in this case,
|
||||
# otherwise we let the state node handle it.
|
||||
if event.is_action_pressed("attack"):
|
||||
if current_state in [$Attack, $Stagger]:
|
||||
return
|
||||
_change_state("attack")
|
||||
return
|
||||
current_state.handle_input(event)
|
||||
BIN
2d/finite_state_machine/player/shadow.png
Normal file
|
After Width: | Height: | Size: 765 B |
34
2d/finite_state_machine/player/shadow.png.import
Normal file
@@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/shadow.png-493c4635eca1ce8bdece629560617dc7.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://player/shadow.png"
|
||||
dest_files=[ "res://.import/shadow.png-493c4635eca1ce8bdece629560617dc7.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=true
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
||||
8
2d/finite_state_machine/player/states/combat/attack.gd
Normal file
@@ -0,0 +1,8 @@
|
||||
extends "res://state_machine/state.gd"
|
||||
|
||||
func enter():
|
||||
owner.get_node("AnimationPlayer").play("idle")
|
||||
|
||||
|
||||
func _on_Sword_attack_finished():
|
||||
emit_signal("finished", "previous")
|
||||
12
2d/finite_state_machine/player/states/combat/stagger.gd
Normal file
@@ -0,0 +1,12 @@
|
||||
extends "res://state_machine/state.gd"
|
||||
# The stagger state end with the stagger animation from the AnimationPlayer.
|
||||
# The animation only affects the Body Sprite's modulate property so it
|
||||
# could stack with other animations if we had two AnimationPlayer nodes.
|
||||
|
||||
func enter():
|
||||
owner.get_node("AnimationPlayer").play("stagger")
|
||||
|
||||
|
||||
func _on_animation_finished(anim_name):
|
||||
assert(anim_name == "stagger")
|
||||
emit_signal("finished", "previous")
|
||||
@@ -0,0 +1,14 @@
|
||||
extends Label
|
||||
|
||||
var start_position = Vector2()
|
||||
|
||||
func _ready():
|
||||
start_position = rect_position
|
||||
|
||||
|
||||
func _physics_process(_delta):
|
||||
rect_position = $"../BodyPivot".position + start_position
|
||||
|
||||
|
||||
func _on_StateMachine_state_changed(current_state):
|
||||
text = current_state.get_name()
|
||||
10
2d/finite_state_machine/player/states/die.gd
Normal file
@@ -0,0 +1,10 @@
|
||||
extends "res://state_machine/state.gd"
|
||||
|
||||
# Initialize the state. E.g. change the animation.
|
||||
func enter():
|
||||
owner.set_dead(true)
|
||||
owner.get_node("AnimationPlayer").play("die")
|
||||
|
||||
|
||||
func _on_animation_finished(_anim_name):
|
||||
emit_signal("finished", "dead")
|
||||
61
2d/finite_state_machine/player/states/motion/in_air/jump.gd
Normal file
@@ -0,0 +1,61 @@
|
||||
extends "../motion.gd"
|
||||
|
||||
export(float) var base_max_horizontal_speed = 400.0
|
||||
|
||||
export(float) var air_acceleration = 1000.0
|
||||
export(float) var air_deceleration = 2000.0
|
||||
export(float) var air_steering_power = 50.0
|
||||
|
||||
export(float) var gravity = 1600.0
|
||||
|
||||
var enter_velocity = Vector2()
|
||||
|
||||
var max_horizontal_speed = 0.0
|
||||
var horizontal_speed = 0.0
|
||||
var horizontal_velocity = Vector2()
|
||||
|
||||
var vertical_speed = 0.0
|
||||
var height = 0.0
|
||||
|
||||
func initialize(speed, velocity):
|
||||
horizontal_speed = speed
|
||||
max_horizontal_speed = speed if speed > 0.0 else base_max_horizontal_speed
|
||||
enter_velocity = velocity
|
||||
|
||||
func enter():
|
||||
var input_direction = get_input_direction()
|
||||
update_look_direction(input_direction)
|
||||
|
||||
horizontal_velocity = enter_velocity if input_direction else Vector2()
|
||||
vertical_speed = 600.0
|
||||
|
||||
owner.get_node("AnimationPlayer").play("idle")
|
||||
|
||||
func update(delta):
|
||||
var input_direction = get_input_direction()
|
||||
update_look_direction(input_direction)
|
||||
|
||||
move_horizontally(delta, input_direction)
|
||||
animate_jump_height(delta)
|
||||
if height <= 0.0:
|
||||
emit_signal("finished", "previous")
|
||||
|
||||
func move_horizontally(delta, direction):
|
||||
if direction:
|
||||
horizontal_speed += air_acceleration * delta
|
||||
else:
|
||||
horizontal_speed -= air_deceleration * delta
|
||||
horizontal_speed = clamp(horizontal_speed, 0, max_horizontal_speed)
|
||||
|
||||
var target_velocity = horizontal_speed * direction.normalized()
|
||||
var steering_velocity = (target_velocity - horizontal_velocity).normalized() * air_steering_power
|
||||
horizontal_velocity += steering_velocity
|
||||
|
||||
owner.move_and_slide(horizontal_velocity)
|
||||
|
||||
func animate_jump_height(delta):
|
||||
vertical_speed -= gravity * delta
|
||||
height += vertical_speed * delta
|
||||
height = max(0.0, height)
|
||||
|
||||
owner.get_node("BodyPivot").position.y = -height
|
||||
18
2d/finite_state_machine/player/states/motion/motion.gd
Normal file
@@ -0,0 +1,18 @@
|
||||
extends "res://state_machine/state.gd"
|
||||
# Collection of important methods to handle direction and animation.
|
||||
|
||||
func handle_input(event):
|
||||
if event.is_action_pressed("simulate_damage"):
|
||||
emit_signal("finished", "stagger")
|
||||
|
||||
|
||||
func get_input_direction():
|
||||
var input_direction = Vector2()
|
||||
input_direction.x = Input.get_action_strength("move_right") - Input.get_action_strength("move_left")
|
||||
input_direction.y = Input.get_action_strength("move_down") - Input.get_action_strength("move_up")
|
||||
return input_direction
|
||||
|
||||
|
||||
func update_look_direction(direction):
|
||||
if direction and owner.look_direction != direction:
|
||||
owner.look_direction = direction
|
||||
@@ -0,0 +1,14 @@
|
||||
extends "on_ground.gd"
|
||||
|
||||
func enter():
|
||||
owner.get_node("AnimationPlayer").play("idle")
|
||||
|
||||
|
||||
func handle_input(event):
|
||||
return .handle_input(event)
|
||||
|
||||
|
||||
func update(_delta):
|
||||
var input_direction = get_input_direction()
|
||||
if input_direction:
|
||||
emit_signal("finished", "move")
|
||||
@@ -0,0 +1,38 @@
|
||||
extends "on_ground.gd"
|
||||
|
||||
export(float) var max_walk_speed = 450
|
||||
export(float) var max_run_speed = 700
|
||||
|
||||
func enter():
|
||||
speed = 0.0
|
||||
velocity = Vector2()
|
||||
|
||||
var input_direction = get_input_direction()
|
||||
update_look_direction(input_direction)
|
||||
owner.get_node("AnimationPlayer").play("walk")
|
||||
|
||||
|
||||
func handle_input(event):
|
||||
return .handle_input(event)
|
||||
|
||||
|
||||
func update(_delta):
|
||||
var input_direction = get_input_direction()
|
||||
if not input_direction:
|
||||
emit_signal("finished", "idle")
|
||||
update_look_direction(input_direction)
|
||||
|
||||
speed = max_run_speed if Input.is_action_pressed("run") else max_walk_speed
|
||||
var collision_info = move(speed, input_direction)
|
||||
if not collision_info:
|
||||
return
|
||||
if speed == max_run_speed and collision_info.collider.is_in_group("environment"):
|
||||
return null
|
||||
|
||||
|
||||
func move(speed, direction):
|
||||
velocity = direction.normalized() * speed
|
||||
owner.move_and_slide(velocity, Vector2(), 5, 2)
|
||||
if owner.get_slide_count() == 0:
|
||||
return
|
||||
return owner.get_slide_collision(0)
|
||||
@@ -0,0 +1,10 @@
|
||||
extends "../motion.gd"
|
||||
|
||||
# warning-ignore-all:unused_class_variable
|
||||
var speed = 0.0
|
||||
var velocity = Vector2()
|
||||
|
||||
func handle_input(event):
|
||||
if event.is_action_pressed("jump"):
|
||||
emit_signal("finished", "jump")
|
||||
return .handle_input(event)
|
||||
243
2d/finite_state_machine/player/weapon/Sword.tscn
Normal file
@@ -0,0 +1,243 @@
|
||||
[gd_scene load_steps=8 format=2]
|
||||
|
||||
[ext_resource path="res://player/weapon/sword.gd" type="Script" id=1]
|
||||
[ext_resource path="res://player/weapon/sword.png" type="Texture" id=2]
|
||||
|
||||
[sub_resource type="Animation" id=1]
|
||||
resource_name = "SETUP"
|
||||
tracks/0/type = "value"
|
||||
tracks/0/path = NodePath(".:rotation_degrees")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/keys = {
|
||||
"times": PoolRealArray( 0 ),
|
||||
"transitions": PoolRealArray( 1 ),
|
||||
"update": 0,
|
||||
"values": [ 0.0 ]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/path = NodePath(".:scale")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/keys = {
|
||||
"times": PoolRealArray( 0 ),
|
||||
"transitions": PoolRealArray( 1 ),
|
||||
"update": 0,
|
||||
"values": [ Vector2( 1, 1 ) ]
|
||||
}
|
||||
tracks/2/type = "value"
|
||||
tracks/2/path = NodePath(".:visible")
|
||||
tracks/2/interp = 1
|
||||
tracks/2/loop_wrap = true
|
||||
tracks/2/imported = false
|
||||
tracks/2/enabled = true
|
||||
tracks/2/keys = {
|
||||
"times": PoolRealArray( 0 ),
|
||||
"transitions": PoolRealArray( 1 ),
|
||||
"update": 1,
|
||||
"values": [ true ]
|
||||
}
|
||||
tracks/3/type = "value"
|
||||
tracks/3/path = NodePath(".:monitoring")
|
||||
tracks/3/interp = 1
|
||||
tracks/3/loop_wrap = true
|
||||
tracks/3/imported = false
|
||||
tracks/3/enabled = true
|
||||
tracks/3/keys = {
|
||||
"times": PoolRealArray( 0 ),
|
||||
"transitions": PoolRealArray( 1 ),
|
||||
"update": 1,
|
||||
"values": [ true ]
|
||||
}
|
||||
tracks/4/type = "value"
|
||||
tracks/4/path = NodePath(".:monitorable")
|
||||
tracks/4/interp = 1
|
||||
tracks/4/loop_wrap = true
|
||||
tracks/4/imported = false
|
||||
tracks/4/enabled = true
|
||||
tracks/4/keys = {
|
||||
"times": PoolRealArray( 0 ),
|
||||
"transitions": PoolRealArray( 1 ),
|
||||
"update": 1,
|
||||
"values": [ false ]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id=2]
|
||||
resource_name = "attack_circular"
|
||||
length = 0.3
|
||||
step = 0.05
|
||||
tracks/0/type = "value"
|
||||
tracks/0/path = NodePath(".:rotation_degrees")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/keys = {
|
||||
"times": PoolRealArray( 0, 0.15, 0.2 ),
|
||||
"transitions": PoolRealArray( 0.439427, 1, 1 ),
|
||||
"update": 0,
|
||||
"values": [ -100.0, 100.0, 90.0 ]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/path = NodePath(".:scale")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/keys = {
|
||||
"times": PoolRealArray( 0, 0.05, 0.15, 0.2 ),
|
||||
"transitions": PoolRealArray( 1, 2.50795, 1, 1 ),
|
||||
"update": 0,
|
||||
"values": [ Vector2( 1, 1 ), Vector2( 1, 1.3 ), Vector2( 1, 1 ), Vector2( 1, 1 ) ]
|
||||
}
|
||||
tracks/2/type = "value"
|
||||
tracks/2/path = NodePath(".:visible")
|
||||
tracks/2/interp = 1
|
||||
tracks/2/loop_wrap = true
|
||||
tracks/2/imported = false
|
||||
tracks/2/enabled = true
|
||||
tracks/2/keys = {
|
||||
"times": PoolRealArray( 0 ),
|
||||
"transitions": PoolRealArray( 1 ),
|
||||
"update": 1,
|
||||
"values": [ true ]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id=3]
|
||||
length = 0.45
|
||||
step = 0.05
|
||||
tracks/0/type = "value"
|
||||
tracks/0/path = NodePath(".:rotation_degrees")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/keys = {
|
||||
"times": PoolRealArray( 0, 0.15, 0.2 ),
|
||||
"transitions": PoolRealArray( 0.439427, 1, 1 ),
|
||||
"update": 0,
|
||||
"values": [ -80.0, 85.0, 75.0 ]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/path = NodePath(".:scale")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/keys = {
|
||||
"times": PoolRealArray( 0, 0.05, 0.15, 0.2 ),
|
||||
"transitions": PoolRealArray( 1, 2.50795, 1, 1 ),
|
||||
"update": 0,
|
||||
"values": [ Vector2( 1, 1 ), Vector2( 1, 1.3 ), Vector2( 1, 1 ), Vector2( 1, 1 ) ]
|
||||
}
|
||||
tracks/2/type = "value"
|
||||
tracks/2/path = NodePath(".:visible")
|
||||
tracks/2/interp = 1
|
||||
tracks/2/loop_wrap = true
|
||||
tracks/2/imported = false
|
||||
tracks/2/enabled = true
|
||||
tracks/2/keys = {
|
||||
"times": PoolRealArray( 0 ),
|
||||
"transitions": PoolRealArray( 1 ),
|
||||
"update": 1,
|
||||
"values": [ true ]
|
||||
}
|
||||
tracks/3/type = "method"
|
||||
tracks/3/path = NodePath(".")
|
||||
tracks/3/interp = 1
|
||||
tracks/3/loop_wrap = true
|
||||
tracks/3/imported = false
|
||||
tracks/3/enabled = true
|
||||
tracks/3/keys = {
|
||||
"times": PoolRealArray( 0.1, 0.25 ),
|
||||
"transitions": PoolRealArray( 1, 1 ),
|
||||
"values": [ {
|
||||
"args": [ ],
|
||||
"method": "set_attack_input_listening"
|
||||
}, {
|
||||
"args": [ ],
|
||||
"method": "set_ready_for_next_attack"
|
||||
} ]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id=4]
|
||||
resource_name = "attack_medium"
|
||||
length = 0.5
|
||||
step = 0.05
|
||||
tracks/0/type = "value"
|
||||
tracks/0/path = NodePath(".:rotation_degrees")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/keys = {
|
||||
"times": PoolRealArray( 0.05, 0.25, 0.35 ),
|
||||
"transitions": PoolRealArray( 0.439427, 1, 1 ),
|
||||
"update": 0,
|
||||
"values": [ 95.0, -95.0, -90.0 ]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/path = NodePath(".:scale")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/keys = {
|
||||
"times": PoolRealArray( 0, 0.1, 0.2, 0.25 ),
|
||||
"transitions": PoolRealArray( 1, 2.50795, 1, 1 ),
|
||||
"update": 0,
|
||||
"values": [ Vector2( 1, 1 ), Vector2( 1, 1.3 ), Vector2( 1, 1 ), Vector2( 1, 1 ) ]
|
||||
}
|
||||
tracks/2/type = "value"
|
||||
tracks/2/path = NodePath(".:visible")
|
||||
tracks/2/interp = 1
|
||||
tracks/2/loop_wrap = true
|
||||
tracks/2/imported = false
|
||||
tracks/2/enabled = true
|
||||
tracks/2/keys = {
|
||||
"times": PoolRealArray( 0 ),
|
||||
"transitions": PoolRealArray( 1 ),
|
||||
"update": 1,
|
||||
"values": [ true ]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id=5]
|
||||
length = 0.01
|
||||
tracks/0/type = "value"
|
||||
tracks/0/path = NodePath(".:visible")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/keys = {
|
||||
"times": PoolRealArray( 0 ),
|
||||
"transitions": PoolRealArray( 1 ),
|
||||
"update": 1,
|
||||
"values": [ false ]
|
||||
}
|
||||
|
||||
[node name="Sword" type="Area2D"]
|
||||
input_pickable = false
|
||||
monitorable = false
|
||||
collision_layer = 16
|
||||
collision_mask = 3
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||
anims/SETUP = SubResource( 1 )
|
||||
anims/attack_circular = SubResource( 2 )
|
||||
anims/attack_fast = SubResource( 3 )
|
||||
anims/attack_medium = SubResource( 4 )
|
||||
anims/idle = SubResource( 5 )
|
||||
|
||||
[node name="Sword" type="Sprite" parent="."]
|
||||
position = Vector2( 4, 0 )
|
||||
texture = ExtResource( 2 )
|
||||
offset = Vector2( 67, 0 )
|
||||
|
||||
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="."]
|
||||
polygon = PoolVector2Array( 28.0001, -15.9999, 136, -15.9995, 160, 0, 136, 16.0005, 27.9999, 16.0001 )
|
||||
113
2d/finite_state_machine/player/weapon/sword.gd
Normal file
@@ -0,0 +1,113 @@
|
||||
extends Area2D
|
||||
|
||||
signal attack_finished
|
||||
|
||||
enum States { IDLE, ATTACK }
|
||||
var state = null
|
||||
|
||||
enum AttackInputStates { IDLE, LISTENING, REGISTERED }
|
||||
var attack_input_state = AttackInputStates.IDLE
|
||||
var ready_for_next_attack = false
|
||||
const MAX_COMBO_COUNT = 3
|
||||
var combo_count = 0
|
||||
|
||||
var attack_current = {}
|
||||
var combo = [{
|
||||
"damage": 1,
|
||||
"animation": "attack_fast",
|
||||
"effect": null
|
||||
},
|
||||
{
|
||||
"damage": 1,
|
||||
"animation": "attack_fast",
|
||||
"effect": null
|
||||
},
|
||||
{
|
||||
"damage": 3,
|
||||
"animation": "attack_medium",
|
||||
"effect": null
|
||||
}]
|
||||
|
||||
var hit_objects = []
|
||||
|
||||
func _ready():
|
||||
# warning-ignore:return_value_discarded
|
||||
$AnimationPlayer.connect("animation_finished", self, "_on_animation_finished")
|
||||
# warning-ignore:return_value_discarded
|
||||
self.connect("body_entered", self, "_on_body_entered")
|
||||
_change_state(States.IDLE)
|
||||
|
||||
|
||||
func _change_state(new_state):
|
||||
match state:
|
||||
States.ATTACK:
|
||||
hit_objects = []
|
||||
attack_input_state = AttackInputStates.LISTENING
|
||||
ready_for_next_attack = false
|
||||
|
||||
match new_state:
|
||||
States.IDLE:
|
||||
combo_count = 0
|
||||
$AnimationPlayer.stop()
|
||||
visible = false
|
||||
monitoring = false
|
||||
States.ATTACK:
|
||||
attack_current = combo[combo_count -1]
|
||||
$AnimationPlayer.play(attack_current["animation"])
|
||||
visible = true
|
||||
monitoring = true
|
||||
state = new_state
|
||||
|
||||
|
||||
func _input(event):
|
||||
if not state == States.ATTACK:
|
||||
return
|
||||
if attack_input_state != AttackInputStates.LISTENING:
|
||||
return
|
||||
if event.is_action_pressed("attack"):
|
||||
attack_input_state = AttackInputStates.REGISTERED
|
||||
|
||||
|
||||
func _physics_process(_delta):
|
||||
if attack_input_state == AttackInputStates.REGISTERED and ready_for_next_attack:
|
||||
attack()
|
||||
|
||||
|
||||
func attack():
|
||||
combo_count += 1
|
||||
_change_state(States.ATTACK)
|
||||
|
||||
|
||||
# Use with AnimationPlayer func track.
|
||||
func set_attack_input_listening():
|
||||
attack_input_state = AttackInputStates.LISTENING
|
||||
|
||||
|
||||
# Use with AnimationPlayer func track.
|
||||
func set_ready_for_next_attack():
|
||||
ready_for_next_attack = true
|
||||
|
||||
|
||||
func _on_body_entered(body):
|
||||
if not body.has_node("Health"):
|
||||
return
|
||||
if body.get_rid().get_id() in hit_objects:
|
||||
return
|
||||
hit_objects.append(body.get_rid().get_id())
|
||||
body.take_damage(self, attack_current["damage"], attack_current["effect"])
|
||||
|
||||
|
||||
func _on_animation_finished(_name):
|
||||
if not attack_current:
|
||||
return
|
||||
|
||||
if attack_input_state == AttackInputStates.REGISTERED and combo_count < MAX_COMBO_COUNT:
|
||||
attack()
|
||||
else:
|
||||
_change_state(States.IDLE)
|
||||
emit_signal("attack_finished")
|
||||
|
||||
|
||||
func _on_StateMachine_state_changed(current_state):
|
||||
if current_state.name == "Attack":
|
||||
attack()
|
||||
BIN
2d/finite_state_machine/player/weapon/sword.png
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
@@ -2,21 +2,22 @@
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/agent.png-22bdd448030a3457042db97db7630b4c.stex"
|
||||
path="res://.import/sword.png-fc7f0084cdf333c826eda2b33f2ec3cc.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://agent.png"
|
||||
source_md5="c7937b15f89b021d3c888c677b1e1677"
|
||||
|
||||
dest_files=[ "res://.import/agent.png-22bdd448030a3457042db97db7630b4c.stex" ]
|
||||
dest_md5="fd0675f788288554927ef3a6c9686573"
|
||||
source_file="res://player/weapon/sword.png"
|
||||
dest_files=[ "res://.import/sword.png-fc7f0084cdf333c826eda2b33f2ec3cc.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=true
|
||||
@@ -26,6 +27,7 @@ flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
17
2d/finite_state_machine/player/weapon/weapon_pivot.gd
Normal file
@@ -0,0 +1,17 @@
|
||||
extends Position2D
|
||||
|
||||
var z_index_start = 0
|
||||
|
||||
func _ready():
|
||||
#warning-ignore:return_value_discarded
|
||||
owner.connect("direction_changed", self, "_on_Parent_direction_changed")
|
||||
z_index_start = z_index
|
||||
|
||||
|
||||
func _on_Parent_direction_changed(direction):
|
||||
rotation = direction.angle()
|
||||
match direction:
|
||||
Vector2.UP:
|
||||
z_index = z_index_start - 1
|
||||
_:
|
||||
z_index = z_index_start
|
||||
99
2d/finite_state_machine/project.godot
Normal file
@@ -0,0 +1,99 @@
|
||||
; 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=4
|
||||
|
||||
_global_script_classes=[ ]
|
||||
_global_script_class_icons={
|
||||
}
|
||||
|
||||
[application]
|
||||
|
||||
config/name="Hierarchical Finite State Machine example"
|
||||
run/main_scene="res://Demo.tscn"
|
||||
config/icon="res://icon.png"
|
||||
|
||||
[display]
|
||||
|
||||
window/size/width=1280
|
||||
window/size/height=720
|
||||
window/stretch/mode="2d"
|
||||
window/stretch/aspect="expand"
|
||||
|
||||
[gdnative]
|
||||
|
||||
singletons=[ ]
|
||||
|
||||
[input]
|
||||
|
||||
move_left={
|
||||
"deadzone": 0.5,
|
||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777231,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":65,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":0,"axis_value":-1.0,"script":null)
|
||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":14,"pressure":0.0,"pressed":false,"script":null)
|
||||
]
|
||||
}
|
||||
move_up={
|
||||
"deadzone": 0.5,
|
||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777232,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":87,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":1,"axis_value":-1.0,"script":null)
|
||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":12,"pressure":0.0,"pressed":false,"script":null)
|
||||
]
|
||||
}
|
||||
move_right={
|
||||
"deadzone": 0.5,
|
||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777233,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":68,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":0,"axis_value":1.0,"script":null)
|
||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":15,"pressure":0.0,"pressed":false,"script":null)
|
||||
]
|
||||
}
|
||||
move_down={
|
||||
"deadzone": 0.5,
|
||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777234,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":83,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":1,"axis_value":1.0,"script":null)
|
||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":13,"pressure":0.0,"pressed":false,"script":null)
|
||||
]
|
||||
}
|
||||
fire={
|
||||
"deadzone": 0.5,
|
||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":82,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":7,"pressure":0.0,"pressed":false,"script":null)
|
||||
]
|
||||
}
|
||||
run={
|
||||
"deadzone": 0.5,
|
||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777237,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":1,"pressure":0.0,"pressed":false,"script":null)
|
||||
]
|
||||
}
|
||||
jump={
|
||||
"deadzone": 0.5,
|
||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":32,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":0,"pressure":0.0,"pressed":false,"script":null)
|
||||
]
|
||||
}
|
||||
simulate_damage={
|
||||
"deadzone": 0.5,
|
||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":88,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":3,"pressure":0.0,"pressed":false,"script":null)
|
||||
]
|
||||
}
|
||||
attack={
|
||||
"deadzone": 0.5,
|
||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":70,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":6,"pressure":0.0,"pressed":false,"script":null)
|
||||
]
|
||||
}
|
||||
|
||||
[rendering]
|
||||
|
||||
environment/default_environment="res://default_env.tres"
|
||||
28
2d/finite_state_machine/state_machine/state.gd
Normal file
@@ -0,0 +1,28 @@
|
||||
extends Node
|
||||
# Base interface for all states: it doesn't do anything by itself,
|
||||
# but forces us to pass the right arguments to the methods below
|
||||
# and makes sure every State object had all of these methods.
|
||||
|
||||
# warning-ignore:unused_signal
|
||||
signal finished(next_state_name)
|
||||
|
||||
# Initialize the state. E.g. change the animation.
|
||||
func enter():
|
||||
pass
|
||||
|
||||
|
||||
# Clean up the state. Reinitialize values like a timer.
|
||||
func exit():
|
||||
pass
|
||||
|
||||
|
||||
func handle_input(_event):
|
||||
pass
|
||||
|
||||
|
||||
func update(_delta):
|
||||
pass
|
||||
|
||||
|
||||
func _on_animation_finished(_anim_name):
|
||||
pass
|
||||
73
2d/finite_state_machine/state_machine/state_machine.gd
Normal file
@@ -0,0 +1,73 @@
|
||||
extends Node
|
||||
# Base interface for a generic state machine.
|
||||
# It handles initializing, setting the machine active or not
|
||||
# delegating _physics_process, _input calls to the State nodes,
|
||||
# and changing the current/active state.
|
||||
# See the PlayerV2 scene for an example on how to use it.
|
||||
|
||||
signal state_changed(current_state)
|
||||
|
||||
# You must set a starting node from the inspector or on
|
||||
# the node that inherits from this state machine interface.
|
||||
# If you don't the game will crash (on purpose, so you won't
|
||||
# forget to initialize the state machine).
|
||||
export(NodePath) var start_state
|
||||
var states_map = {}
|
||||
|
||||
var states_stack = []
|
||||
var current_state = null
|
||||
var _active = false setget set_active
|
||||
|
||||
func _ready():
|
||||
if not start_state:
|
||||
start_state = get_child(0).get_path()
|
||||
for child in get_children():
|
||||
child.connect("finished", self, "_change_state")
|
||||
initialize(start_state)
|
||||
|
||||
|
||||
func initialize(initial_state):
|
||||
set_active(true)
|
||||
states_stack.push_front(get_node(initial_state))
|
||||
current_state = states_stack[0]
|
||||
current_state.enter()
|
||||
|
||||
|
||||
func set_active(value):
|
||||
_active = value
|
||||
set_physics_process(value)
|
||||
set_process_input(value)
|
||||
if not _active:
|
||||
states_stack = []
|
||||
current_state = null
|
||||
|
||||
|
||||
func _input(event):
|
||||
current_state.handle_input(event)
|
||||
|
||||
|
||||
func _physics_process(delta):
|
||||
current_state.update(delta)
|
||||
|
||||
|
||||
func _on_animation_finished(anim_name):
|
||||
if not _active:
|
||||
return
|
||||
current_state._on_animation_finished(anim_name)
|
||||
|
||||
|
||||
func _change_state(state_name):
|
||||
if not _active:
|
||||
return
|
||||
current_state.exit()
|
||||
|
||||
if state_name == "previous":
|
||||
states_stack.pop_front()
|
||||
else:
|
||||
states_stack[0] = states_map[state_name]
|
||||
|
||||
current_state = states_stack[0]
|
||||
emit_signal("state_changed", current_state)
|
||||
|
||||
if state_name != "previous":
|
||||
current_state.enter()
|
||||
249
2d/gd_paint/PaintControl.gd
Normal file
@@ -0,0 +1,249 @@
|
||||
extends Control
|
||||
|
||||
# A constant for whether or not we're needing to undo a shape.
|
||||
const UNDO_MODE_SHAPE = -2
|
||||
# A constant for whether or not we can undo.
|
||||
const UNDO_NONE = -1
|
||||
# How large is the image (it's actually the size of DrawingAreaBG, because that's our background canvas).
|
||||
const IMAGE_SIZE = Vector2(930, 720)
|
||||
|
||||
# Enums for the various modes and brush shapes that can be applied.
|
||||
enum BrushModes {
|
||||
PENCIL, ERASER, CIRCLE_SHAPE, RECTANGLE_SHAPE
|
||||
}
|
||||
enum BrushShapes {
|
||||
RECTANGLE, CIRCLE
|
||||
}
|
||||
|
||||
# The top-left position of the canvas.
|
||||
var TL_node
|
||||
|
||||
# A list to hold all of the dictionaries that make up each brush.
|
||||
var brush_data_list = []
|
||||
|
||||
# A boolean to hold whether or not the mouse is inside the drawing area, the mouse position last _process call
|
||||
# and the position of the mouse when the left mouse button was pressed.
|
||||
var is_mouse_in_drawing_area = false
|
||||
var last_mouse_pos = Vector2()
|
||||
var mouse_click_start_pos = null
|
||||
|
||||
# A boolean to tell whether we've set undo_elements_list_num, which holds the size of draw_elements_list
|
||||
# before a new stroke is added (unless the current brush mode is 'rectangle shape' or 'circle shape', in
|
||||
# which case we do things a litte differently. See the undo_stroke function for more details).
|
||||
var undo_set = false
|
||||
var undo_element_list_num = -1
|
||||
|
||||
# The current brush settings: The mode, size, color, and shape we have currently selected.
|
||||
var brush_mode = BrushModes.PENCIL
|
||||
var brush_size = 32
|
||||
var brush_color = Color.black
|
||||
var brush_shape = BrushShapes.CIRCLE;
|
||||
|
||||
# The color of the background. We need this for the eraser (see the how we handle the eraser
|
||||
# in the _draw function for more details).
|
||||
var bg_color = Color.white
|
||||
|
||||
func _ready():
|
||||
# Get the top left position node. We need this to find out whether or not the mouse is inside the canvas.
|
||||
TL_node = get_node("TLPos")
|
||||
set_process(true)
|
||||
|
||||
|
||||
func _process(_delta):
|
||||
var mouse_pos = get_viewport().get_mouse_position()
|
||||
|
||||
# Check if the mouse is currently inside the canvas/drawing-area.
|
||||
is_mouse_in_drawing_area = false
|
||||
if mouse_pos.x > TL_node.global_position.x:
|
||||
if mouse_pos.y > TL_node.global_position.y:
|
||||
is_mouse_in_drawing_area = true
|
||||
|
||||
if Input.is_mouse_button_pressed(BUTTON_LEFT):
|
||||
# If we do not have a position for when the mouse was first clicked, then this must
|
||||
# be the first time is_mouse_button_pressed has been called since the mouse button was
|
||||
# released, so we need to store the position.
|
||||
if mouse_click_start_pos == null:
|
||||
mouse_click_start_pos = mouse_pos
|
||||
|
||||
# If the mouse is inside the canvas and the mouse is 1px away from the position of the mouse last _process call.
|
||||
if check_if_mouse_is_inside_canvas():
|
||||
if mouse_pos.distance_to(last_mouse_pos) >= 1:
|
||||
# If we are in pencil or eraser mode, then we need to draw.
|
||||
if brush_mode == BrushModes.PENCIL or brush_mode == BrushModes.ERASER:
|
||||
# If undo has not been set, meaning we've started a new stroke, then store the size of the
|
||||
# draw_elements_list so we can undo from this point in time.
|
||||
if undo_set == false:
|
||||
undo_set = true
|
||||
undo_element_list_num = brush_data_list.size()
|
||||
# Add the brush object to draw_elements_array.
|
||||
add_brush(mouse_pos, brush_mode)
|
||||
|
||||
else:
|
||||
# We've finished our stroke, so we can set a new undo (if a new storke is made).
|
||||
undo_set = false
|
||||
|
||||
# If the mouse is inside the canvas.
|
||||
if check_if_mouse_is_inside_canvas():
|
||||
# If we're using either the circle shape mode, or the rectangle shape mode, then
|
||||
# add the brush object to draw_elements_array.
|
||||
if brush_mode == BrushModes.CIRCLE_SHAPE or brush_mode == BrushModes.RECTANGLE_SHAPE:
|
||||
add_brush(mouse_pos, brush_mode)
|
||||
# We handle undo's differently than either pencil or eraser mode, so we need to set undo
|
||||
# element_list_num to -2 so we can tell if we need to undo a shape. See undo_stroke for details.
|
||||
undo_element_list_num = UNDO_MODE_SHAPE
|
||||
# Since we've released the left mouse, we need to get a new mouse_click_start_pos next time
|
||||
#is_mouse_button_pressed is true.
|
||||
mouse_click_start_pos = null
|
||||
|
||||
# Store mouse_pos as last_mouse_pos now that we're done with _process.
|
||||
last_mouse_pos = mouse_pos
|
||||
|
||||
|
||||
func check_if_mouse_is_inside_canvas():
|
||||
# Make sure we have a mouse click starting position.
|
||||
if mouse_click_start_pos != null:
|
||||
# Make sure the mouse click starting position is inside the canvas.
|
||||
# This is so if we start out click outside the canvas (say chosing a color from the color picker)
|
||||
# and then move our mouse back into the canvas, it won't start painting.
|
||||
if mouse_click_start_pos.x > TL_node.global_position.x:
|
||||
if mouse_click_start_pos.y > TL_node.global_position.y:
|
||||
# Make sure the current mouse position is inside the canvas.
|
||||
if is_mouse_in_drawing_area:
|
||||
return true
|
||||
return false
|
||||
|
||||
|
||||
func undo_stroke():
|
||||
# Only undo a stroke if we have one.
|
||||
if undo_element_list_num == UNDO_NONE:
|
||||
return
|
||||
|
||||
# If we are undoing a shape, then we can just remove the latest brush.
|
||||
if undo_element_list_num == UNDO_MODE_SHAPE:
|
||||
if brush_data_list.size() > 0:
|
||||
brush_data_list.remove(brush_data_list.size() - 1)
|
||||
|
||||
# Now that we've undone a shape, we cannot undo again until another stoke is added.
|
||||
undo_element_list_num = UNDO_NONE
|
||||
# NOTE: if we only had shape brushes, then we could remove the above line and could let the user
|
||||
# undo until we have a empty element list.
|
||||
|
||||
# Otherwise we're removing a either a pencil stroke or a eraser stroke.
|
||||
else:
|
||||
# Figure out how many elements/brushes we've added in the last stroke.
|
||||
var elements_to_remove = brush_data_list.size() - undo_element_list_num
|
||||
# Remove all of the elements we've added this in the last stroke.
|
||||
#warning-ignore:unused_variable
|
||||
for elment_num in range(0, elements_to_remove):
|
||||
brush_data_list.pop_back()
|
||||
|
||||
# Now that we've undone a stoke, we cannot undo again until another stoke is added.
|
||||
undo_element_list_num = UNDO_NONE
|
||||
|
||||
# Redraw the brushes
|
||||
update()
|
||||
|
||||
|
||||
func add_brush(mouse_pos, type):
|
||||
# Make new brush dictionary that will hold all of the data we need for the brush.
|
||||
var new_brush = {}
|
||||
|
||||
# Populate the dictionary with values based on the global brush variables.
|
||||
# We will override these as needed if the brush is a rectange or circle.
|
||||
new_brush.brush_type = type
|
||||
new_brush.brush_pos = mouse_pos
|
||||
new_brush.brush_shape = brush_shape
|
||||
new_brush.brush_size = brush_size
|
||||
new_brush.brush_color = brush_color
|
||||
|
||||
# If the new bursh is a rectangle shape, we need to calculate the top left corner of the rectangle and the
|
||||
# bottom right corner of the rectangle.
|
||||
if type == BrushModes.RECTANGLE_SHAPE:
|
||||
var TL_pos = Vector2()
|
||||
var BR_pos = Vector2()
|
||||
|
||||
# Figure out the left and right positions of the corners and assign them to the proper variable.
|
||||
if mouse_pos.x < mouse_click_start_pos.x:
|
||||
TL_pos.x = mouse_pos.x
|
||||
BR_pos.x = mouse_click_start_pos.x
|
||||
else:
|
||||
TL_pos.x = mouse_click_start_pos.x
|
||||
BR_pos.x = mouse_pos.x
|
||||
|
||||
# Figure out the top and bottom positions of the corners and assign them to the proper variable.
|
||||
if mouse_pos.y < mouse_click_start_pos.y:
|
||||
TL_pos.y = mouse_pos.y
|
||||
BR_pos.y = mouse_click_start_pos.y
|
||||
else:
|
||||
TL_pos.y = mouse_click_start_pos.y
|
||||
BR_pos.y = mouse_pos.y
|
||||
|
||||
# Assign the positions to the brush.
|
||||
new_brush.brush_pos = TL_pos
|
||||
new_brush.brush_shape_rect_pos_BR = BR_pos
|
||||
|
||||
# If the brush isa circle shape, then we need to calculate the radius of the circle.
|
||||
if type == BrushModes.CIRCLE_SHAPE:
|
||||
# Get the center point inbetween the mouse position and the position of the mouse when we clicked.
|
||||
var center_pos = Vector2((mouse_pos.x + mouse_click_start_pos.x) / 2, (mouse_pos.y + mouse_click_start_pos.y) / 2)
|
||||
# Assign the brush position to the center point, and calculate the radius of the circle using the distance from
|
||||
# the center to the top/bottom positon of the mouse.
|
||||
new_brush.brush_pos = center_pos
|
||||
new_brush.brush_shape_circle_radius = center_pos.distance_to(Vector2(center_pos.x, mouse_pos.y))
|
||||
|
||||
# Add the brush and update/draw all of the brushes.
|
||||
brush_data_list.append(new_brush)
|
||||
update()
|
||||
|
||||
|
||||
func _draw():
|
||||
# Go through all of the brushes in brush_data_list.
|
||||
for brush in brush_data_list:
|
||||
match brush.brush_type:
|
||||
BrushModes.PENCIL:
|
||||
# If the brush shape is a rectangle, then we need to make a Rect2 so we can use draw_rect.
|
||||
# Draw_rect draws a rectagle at the top left corner, using the scale for the size.
|
||||
# So we offset the position by half of the brush size so the rectangle's center is at mouse position.
|
||||
if brush.brush_shape == BrushShapes.RECTANGLE:
|
||||
var rect = Rect2(brush.brush_pos - Vector2(brush.brush_size / 2, brush.brush_size / 2), Vector2(brush.brush_size, brush.brush_size))
|
||||
draw_rect(rect, brush.brush_color)
|
||||
# If the brush shape is a circle, then we draw a circle at the mouse position,
|
||||
# making the radius half of brush size (so the circle is brush size pixels in diameter).
|
||||
elif brush.brush_shape == BrushShapes.CIRCLE:
|
||||
draw_circle(brush.brush_pos, brush.brush_size / 2, brush.brush_color)
|
||||
BrushModes.ERASER:
|
||||
# NOTE: this is a really cheap way of erasing that isn't really erasing!
|
||||
# However, this gives similar results in a fairy simple way!
|
||||
|
||||
# Erasing works exactly the same was as pencil does for both the rectangle shape and the circle shape,
|
||||
# but instead of using brush.brush_color, we instead use bg_color instead.
|
||||
if brush.brush_shape == BrushShapes.RECTANGLE:
|
||||
var rect = Rect2(brush.brush_pos - Vector2(brush.brush_size / 2, brush.brush_size / 2), Vector2(brush.brush_size, brush.brush_size))
|
||||
draw_rect(rect, bg_color)
|
||||
elif brush.brush_shape == BrushShapes.CIRCLE:
|
||||
draw_circle(brush.brush_pos, brush.brush_size / 2, bg_color)
|
||||
BrushModes.RECTANGLE_SHAPE:
|
||||
# We make a Rect2 with the postion at the top left. To get the size we take the bottom right position
|
||||
# and subtract the top left corner's position.
|
||||
var rect = Rect2(brush.brush_pos, brush.brush_shape_rect_pos_BR - brush.brush_pos)
|
||||
draw_rect(rect, brush.brush_color)
|
||||
BrushModes.CIRCLE_SHAPE:
|
||||
# We simply draw a circle using stored in brush.
|
||||
draw_circle(brush.brush_pos, brush.brush_shape_circle_radius, brush.brush_color)
|
||||
|
||||
|
||||
|
||||
func save_picture(path):
|
||||
# Wait a couple frames so the save dialog isn't in the way.
|
||||
yield (get_tree(), "idle_frame")
|
||||
yield (get_tree(), "idle_frame")
|
||||
|
||||
# Get the viewport image.
|
||||
var img = get_viewport().get_texture().get_data()
|
||||
# Crop the image so we only have canvas area.
|
||||
var cropped_image = img.get_rect(Rect2(TL_node.global_position, IMAGE_SIZE))
|
||||
# Flip the image on the Y-axis (it's flipped upside down by default).
|
||||
cropped_image.flip_y()
|
||||
|
||||
# Save the image with the passed in path we got from the save dialog.
|
||||
cropped_image.save_png(path)
|
||||
BIN
2d/gd_paint/PaintTools.png
Normal file
|
After Width: | Height: | Size: 440 B |
34
2d/gd_paint/PaintTools.png.import
Normal file
@@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/PaintTools.png-636e86a6d210b52282c946752bbcc6f1.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://PaintTools.png"
|
||||
dest_files=[ "res://.import/PaintTools.png-636e86a6d210b52282c946752bbcc6f1.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=true
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
||||
220
2d/gd_paint/Paint_root.tscn
Normal file
@@ -0,0 +1,220 @@
|
||||
[gd_scene load_steps=5 format=2]
|
||||
|
||||
[ext_resource path="res://PaintControl.gd" type="Script" id=1]
|
||||
[ext_resource path="res://ToolsPanel.gd" type="Script" id=2]
|
||||
[ext_resource path="res://PaintTools.png" type="Texture" id=3]
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id=1]
|
||||
bg_color = Color( 1, 1, 1, 1 )
|
||||
|
||||
[node name="PaintRoot" type="Control"]
|
||||
margin_right = 40.0
|
||||
margin_bottom = 40.0
|
||||
|
||||
[node name="DrawingAreaBG" type="Panel" parent="."]
|
||||
margin_left = 350.0
|
||||
margin_right = 1280.0
|
||||
margin_bottom = 720.0
|
||||
custom_styles/panelf = SubResource( 1 )
|
||||
custom_styles/panel = SubResource( 1 )
|
||||
custom_styles/panelnc = SubResource( 1 )
|
||||
|
||||
[node name="PaintControl" type="Control" parent="."]
|
||||
margin_right = 40.0
|
||||
margin_bottom = 40.0
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="TLPos" type="Position2D" parent="PaintControl"]
|
||||
position = Vector2( 350, 0 )
|
||||
|
||||
[node name="ToolsPanel" type="Panel" parent="."]
|
||||
margin_right = 350.0
|
||||
margin_bottom = 720.0
|
||||
script = ExtResource( 2 )
|
||||
|
||||
[node name="LabelTools" type="Label" parent="ToolsPanel"]
|
||||
margin_left = 20.0
|
||||
margin_top = 10.0
|
||||
margin_right = 330.0
|
||||
margin_bottom = 24.0
|
||||
text = "Selected tool: Pencil"
|
||||
align = 1
|
||||
|
||||
[node name="ButtonToolPencil" type="Button" parent="ToolsPanel"]
|
||||
margin_left = 40.0
|
||||
margin_top = 40.0
|
||||
margin_right = 100.0
|
||||
margin_bottom = 100.0
|
||||
|
||||
[node name="Sprite" type="Sprite" parent="ToolsPanel/ButtonToolPencil"]
|
||||
position = Vector2( 30, 30 )
|
||||
scale = Vector2( 2.5, 2.5 )
|
||||
texture = ExtResource( 3 )
|
||||
region_enabled = true
|
||||
region_rect = Rect2( 0, 0, 16, 16 )
|
||||
|
||||
[node name="ButtonToolEraser" type="Button" parent="ToolsPanel"]
|
||||
margin_left = 110.0
|
||||
margin_top = 40.0
|
||||
margin_right = 170.0
|
||||
margin_bottom = 100.0
|
||||
|
||||
[node name="Sprite" type="Sprite" parent="ToolsPanel/ButtonToolEraser"]
|
||||
position = Vector2( 30, 30 )
|
||||
scale = Vector2( 2.5, 2.5 )
|
||||
texture = ExtResource( 3 )
|
||||
region_enabled = true
|
||||
region_rect = Rect2( 16, 0, 16, 16 )
|
||||
|
||||
[node name="ButtonToolRectangle" type="Button" parent="ToolsPanel"]
|
||||
margin_left = 180.0
|
||||
margin_top = 40.0
|
||||
margin_right = 240.0
|
||||
margin_bottom = 100.0
|
||||
|
||||
[node name="Sprite" type="Sprite" parent="ToolsPanel/ButtonToolRectangle"]
|
||||
position = Vector2( 30, 30 )
|
||||
scale = Vector2( 2.5, 2.5 )
|
||||
texture = ExtResource( 3 )
|
||||
region_enabled = true
|
||||
region_rect = Rect2( 0, 16, 16, 16 )
|
||||
|
||||
[node name="ButtonToolCircle" type="Button" parent="ToolsPanel"]
|
||||
margin_left = 250.0
|
||||
margin_top = 40.0
|
||||
margin_right = 310.0
|
||||
margin_bottom = 100.0
|
||||
|
||||
[node name="Sprite" type="Sprite" parent="ToolsPanel/ButtonToolCircle"]
|
||||
position = Vector2( 30, 30 )
|
||||
scale = Vector2( 2.5, 2.5 )
|
||||
texture = ExtResource( 3 )
|
||||
region_enabled = true
|
||||
region_rect = Rect2( 16, 16, 16, 16 )
|
||||
|
||||
[node name="LabelBrushColor" type="Label" parent="ToolsPanel"]
|
||||
margin_left = 20.0
|
||||
margin_top = 120.0
|
||||
margin_right = 330.0
|
||||
margin_bottom = 134.0
|
||||
text = "Current color"
|
||||
align = 1
|
||||
|
||||
[node name="ColorPickerBrush" type="ColorPickerButton" parent="ToolsPanel"]
|
||||
margin_left = 20.0
|
||||
margin_top = 140.0
|
||||
margin_right = 330.0
|
||||
margin_bottom = 190.0
|
||||
|
||||
[node name="BrushSettings" type="Control" parent="ToolsPanel"]
|
||||
margin_top = 200.0
|
||||
margin_right = 350.0
|
||||
margin_bottom = 375.0
|
||||
|
||||
[node name="LabelBrushSize" type="Label" parent="ToolsPanel/BrushSettings"]
|
||||
margin_left = 20.0
|
||||
margin_top = 10.0
|
||||
margin_right = 330.0
|
||||
margin_bottom = 24.0
|
||||
text = "Brush size: 32px"
|
||||
align = 1
|
||||
|
||||
[node name="HScrollBarBrushSize" type="HScrollBar" parent="ToolsPanel/BrushSettings"]
|
||||
margin_left = 20.0
|
||||
margin_top = 30.0
|
||||
margin_right = 330.0
|
||||
margin_bottom = 60.0
|
||||
min_value = 2.0
|
||||
step = 1.0
|
||||
value = 32.0
|
||||
|
||||
[node name="LabelBrushShape" type="Label" parent="ToolsPanel/BrushSettings"]
|
||||
margin_left = 20.0
|
||||
margin_top = 80.0
|
||||
margin_right = 330.0
|
||||
margin_bottom = 94.0
|
||||
text = "Brush shape: Circle"
|
||||
align = 1
|
||||
|
||||
[node name="ButtonShapeBox" type="Button" parent="ToolsPanel/BrushSettings"]
|
||||
editor/display_folded = true
|
||||
margin_left = 100.0
|
||||
margin_top = 100.0
|
||||
margin_right = 160.0
|
||||
margin_bottom = 160.0
|
||||
|
||||
[node name="Sprite" type="Sprite" parent="ToolsPanel/BrushSettings/ButtonShapeBox"]
|
||||
position = Vector2( 30, 30 )
|
||||
scale = Vector2( 2.5, 2.5 )
|
||||
texture = ExtResource( 3 )
|
||||
region_enabled = true
|
||||
region_rect = Rect2( 0, 16, 16, 16 )
|
||||
|
||||
[node name="ButtonShapeCircle" type="Button" parent="ToolsPanel/BrushSettings"]
|
||||
editor/display_folded = true
|
||||
margin_left = 190.0
|
||||
margin_top = 100.0
|
||||
margin_right = 250.0
|
||||
margin_bottom = 160.0
|
||||
|
||||
[node name="Sprite" type="Sprite" parent="ToolsPanel/BrushSettings/ButtonShapeCircle"]
|
||||
position = Vector2( 30, 30 )
|
||||
scale = Vector2( 2.5, 2.5 )
|
||||
texture = ExtResource( 3 )
|
||||
region_enabled = true
|
||||
region_rect = Rect2( 16, 16, 16, 16 )
|
||||
|
||||
[node name="LabelBackgroundColor" type="Label" parent="ToolsPanel"]
|
||||
margin_left = 20.0
|
||||
margin_top = 400.0
|
||||
margin_right = 330.0
|
||||
margin_bottom = 414.0
|
||||
text = "Background color"
|
||||
align = 1
|
||||
|
||||
[node name="ColorPickerBackground" type="ColorPickerButton" parent="ToolsPanel"]
|
||||
margin_left = 20.0
|
||||
margin_top = 420.0
|
||||
margin_right = 330.0
|
||||
margin_bottom = 470.0
|
||||
color = Color( 1, 1, 1, 1 )
|
||||
edit_alpha = false
|
||||
|
||||
[node name="LabelStats" type="Label" parent="ToolsPanel"]
|
||||
modulate = Color( 0.414062, 0.414062, 0.414062, 1 )
|
||||
margin_left = 20.0
|
||||
margin_top = 590.0
|
||||
margin_right = 330.0
|
||||
margin_bottom = 604.0
|
||||
text = "Brush objects: 00000"
|
||||
align = 1
|
||||
|
||||
[node name="ButtonUndo" type="Button" parent="ToolsPanel"]
|
||||
margin_left = 10.0
|
||||
margin_top = 520.0
|
||||
margin_right = 340.0
|
||||
margin_bottom = 560.0
|
||||
text = "Undo last stroke"
|
||||
|
||||
[node name="ButtonSave" type="Button" parent="ToolsPanel"]
|
||||
margin_left = 10.0
|
||||
margin_top = 620.0
|
||||
margin_right = 340.0
|
||||
margin_bottom = 660.0
|
||||
text = "Save picture"
|
||||
|
||||
[node name="ButtonClear" type="Button" parent="ToolsPanel"]
|
||||
margin_left = 10.0
|
||||
margin_top = 670.0
|
||||
margin_right = 340.0
|
||||
margin_bottom = 710.0
|
||||
text = "Clear picture"
|
||||
|
||||
[node name="SaveFileDialog" type="FileDialog" parent="."]
|
||||
margin_right = 600.0
|
||||
margin_bottom = 400.0
|
||||
resizable = true
|
||||
access = 2
|
||||
filters = PoolStringArray( "*.png" )
|
||||
current_dir = "/home/aaronfranke/workspace/godot-demo-projects/2d/gd_paint"
|
||||
current_path = "/home/aaronfranke/workspace/godot-demo-projects/2d/gd_paint/"
|
||||
116
2d/gd_paint/ToolsPanel.gd
Normal file
@@ -0,0 +1,116 @@
|
||||
extends Panel
|
||||
|
||||
var paint_control
|
||||
|
||||
onready var brush_settings = $BrushSettings
|
||||
onready var label_tools = $LabelTools
|
||||
onready var label_brush_size = $BrushSettings/LabelBrushSize
|
||||
onready var label_brush_shape = $BrushSettings/LabelBrushShape
|
||||
onready var label_stats = $LabelStats
|
||||
|
||||
var save_dialog
|
||||
|
||||
func _ready():
|
||||
# Get PaintControl and SaveFileDialog.
|
||||
paint_control = get_parent().get_node("PaintControl")
|
||||
save_dialog = get_parent().get_node("SaveFileDialog")
|
||||
|
||||
# warning-ignore-all:return_value_discarded
|
||||
# Assign all of the needed signals for the oppersation buttons.
|
||||
$ButtonUndo.connect("pressed", self, "button_pressed", ["undo_stroke"])
|
||||
$ButtonSave.connect("pressed", self, "button_pressed", ["save_picture"])
|
||||
$ButtonClear.connect("pressed", self, "button_pressed", ["clear_picture"])
|
||||
|
||||
# Assign all of the needed signals for the brush buttons.
|
||||
$ButtonToolPencil.connect("pressed", self, "button_pressed", ["mode_pencil"])
|
||||
$ButtonToolEraser.connect("pressed", self, "button_pressed", ["mode_eraser"])
|
||||
$ButtonToolRectangle.connect("pressed", self, "button_pressed", ["mode_rectangle"])
|
||||
$ButtonToolCircle.connect("pressed", self, "button_pressed", ["mode_circle"])
|
||||
$BrushSettings/ButtonShapeBox.connect("pressed", self, "button_pressed", ["shape_rectangle"])
|
||||
$BrushSettings/ButtonShapeCircle.connect("pressed", self, "button_pressed", ["shape_circle"])
|
||||
|
||||
# Assign all of the needed signals for the other brush settings (and ColorPickerBackground).
|
||||
$ColorPickerBrush.connect("color_changed", self, "brush_color_changed")
|
||||
$ColorPickerBackground.connect("color_changed", self, "background_color_changed")
|
||||
$BrushSettings/HScrollBarBrushSize.connect("value_changed", self, "brush_size_changed")
|
||||
|
||||
# Assign the 'file_selected' signal in SaveFileDialog.
|
||||
save_dialog.connect("file_selected", self, "save_file_selected")
|
||||
|
||||
# Set physics process so we can update the status label.
|
||||
set_physics_process(true)
|
||||
|
||||
|
||||
func _physics_process(_delta):
|
||||
# Update the status label with the newest brush element count.
|
||||
label_stats.text = "Brush objects: " + String(paint_control.brush_data_list.size())
|
||||
|
||||
|
||||
func button_pressed(button_name):
|
||||
# If a brush mode button is pressed.
|
||||
var tool_name = null
|
||||
var shape_name = null
|
||||
|
||||
if button_name == "mode_pencil":
|
||||
paint_control.brush_mode = paint_control.BrushModes.PENCIL
|
||||
brush_settings.modulate = Color(1, 1, 1, 1)
|
||||
tool_name = "Pencil"
|
||||
elif button_name == "mode_eraser":
|
||||
paint_control.brush_mode = paint_control.BrushModes.ERASER
|
||||
brush_settings.modulate = Color(1, 1, 1, 1)
|
||||
tool_name = "Eraser"
|
||||
elif button_name == "mode_rectangle":
|
||||
paint_control.brush_mode = paint_control.BrushModes.RECTANGLE_SHAPE
|
||||
brush_settings.modulate = Color(1, 1, 1, 0.5)
|
||||
tool_name = "Rectangle shape"
|
||||
elif button_name == "mode_circle":
|
||||
paint_control.brush_mode = paint_control.BrushModes.CIRCLE_SHAPE
|
||||
brush_settings.modulate = Color(1, 1, 1, 0.5)
|
||||
tool_name = "Circle shape"
|
||||
|
||||
# If a brush shape button is pressed
|
||||
elif button_name == "shape_rectangle":
|
||||
paint_control.brush_shape = paint_control.BrushShapes.RECTANGLE
|
||||
shape_name = "Rectangle"
|
||||
elif button_name == "shape_circle":
|
||||
paint_control.brush_shape = paint_control.BrushShapes.CIRCLE
|
||||
shape_name = "Circle";
|
||||
|
||||
# If a opperation button is pressed
|
||||
elif button_name == "clear_picture":
|
||||
paint_control.brush_data_list = []
|
||||
paint_control.update()
|
||||
elif button_name == "save_picture":
|
||||
save_dialog.popup_centered()
|
||||
elif button_name == "undo_stroke":
|
||||
paint_control.undo_stroke()
|
||||
|
||||
# Update the labels (in case the brush mode or brush shape has changed).
|
||||
if tool_name != null:
|
||||
label_tools.text = "Selected tool: " + tool_name
|
||||
if shape_name != null:
|
||||
label_brush_shape.text = "Brush shape: " + shape_name
|
||||
|
||||
|
||||
func brush_color_changed(color):
|
||||
# Change the brush color to whatever color the color picker is.
|
||||
paint_control.brush_color = color
|
||||
|
||||
|
||||
func background_color_changed(color):
|
||||
# Change the background color to whatever colorthe background color picker is.
|
||||
get_parent().get_node("DrawingAreaBG").modulate = color
|
||||
paint_control.bg_color = color
|
||||
# Because of how the eraser works we also need to redraw the paint control.
|
||||
paint_control.update()
|
||||
|
||||
|
||||
func brush_size_changed(value):
|
||||
# Change the size of the brush, and update the label to reflect the new value.
|
||||
paint_control.brush_size = ceil(value)
|
||||
label_brush_size.text = "Brush size: " + String(ceil(value)) + "px"
|
||||
|
||||
|
||||
func save_file_selected(path):
|
||||
# Call save_picture in paint_control, passing in the path we recieved from SaveFileDialog.
|
||||
paint_control.save_picture(path)
|
||||
14
2d/gd_paint/default_env.tres
Normal file
@@ -0,0 +1,14 @@
|
||||
[gd_resource type="Environment" load_steps=2 format=2]
|
||||
|
||||
[sub_resource type="ProceduralSky" id=1]
|
||||
sky_top_color = Color( 0.0470588, 0.454902, 0.976471, 1 )
|
||||
sky_horizon_color = Color( 0.556863, 0.823529, 0.909804, 1 )
|
||||
sky_curve = 0.25
|
||||
ground_bottom_color = Color( 0.101961, 0.145098, 0.188235, 1 )
|
||||
ground_horizon_color = Color( 0.482353, 0.788235, 0.952941, 1 )
|
||||
ground_curve = 0.01
|
||||
sun_energy = 16.0
|
||||
|
||||
[resource]
|
||||
background_mode = 2
|
||||
background_sky = SubResource( 1 )
|
||||
BIN
2d/gd_paint/icon.png
Normal file
|
After Width: | Height: | Size: 884 B |
@@ -3,16 +3,21 @@
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_md5="9be177e863d37787c0836d64924b3503"
|
||||
source_file="res://icon.png"
|
||||
dest_files=[ "res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=true
|
||||
@@ -22,6 +27,7 @@ flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
34
2d/gd_paint/project.godot
Normal file
@@ -0,0 +1,34 @@
|
||||
; 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=4
|
||||
|
||||
_global_script_classes=[ ]
|
||||
_global_script_class_icons={
|
||||
}
|
||||
|
||||
[application]
|
||||
|
||||
config/name="GD Paint"
|
||||
run/main_scene="res://Paint_root.tscn"
|
||||
config/icon="res://icon.png"
|
||||
|
||||
[display]
|
||||
|
||||
window/size/width=1280
|
||||
window/size/height=720
|
||||
window/stretch/mode="2d"
|
||||
window/stretch/aspect="keep"
|
||||
|
||||
[gdnative]
|
||||
|
||||
singletons=[ ]
|
||||
|
||||
[rendering]
|
||||
|
||||
environment/default_environment="res://default_env.tres"
|
||||
56
2d/grid_based_movement/Game.tscn
Normal file
13
2d/grid_based_movement/default_env.tres
Normal file
@@ -0,0 +1,13 @@
|
||||
[gd_resource type="Environment" load_steps=2 format=2]
|
||||
|
||||
[sub_resource type="ProceduralSky" id=1]
|
||||
sky_top_color = Color( 0.0470588, 0.454902, 0.976471, 1 )
|
||||
sky_horizon_color = Color( 0.556863, 0.823529, 0.909804, 1 )
|
||||
sky_curve = 0.25
|
||||
ground_bottom_color = Color( 0.101961, 0.145098, 0.188235, 1 )
|
||||
ground_horizon_color = Color( 0.482353, 0.788235, 0.952941, 1 )
|
||||
ground_curve = 0.01
|
||||
|
||||
[resource]
|
||||
background_mode = 2
|
||||
background_sky = SubResource( 1 )
|
||||