Compare commits
225 Commits
3.2-5bd2bb
...
3.x
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fe1ccaea77 | ||
|
|
ec368a812b | ||
|
|
0a826508da | ||
|
|
a2d63288fa | ||
|
|
aae565b34a | ||
|
|
d52d430af7 | ||
|
|
bfcd81aa85 | ||
|
|
cdffdc025f | ||
|
|
ed3e2a1635 | ||
|
|
e292b09d9e | ||
|
|
c17d803a1b | ||
|
|
c0180d20d1 | ||
|
|
edee4413e3 | ||
|
|
3a23fdbe6a | ||
|
|
c8bb3b874a | ||
|
|
c8f0706055 | ||
|
|
ccc4354331 | ||
|
|
1849640ff8 | ||
|
|
3ae7f01a23 | ||
|
|
690dd395fd | ||
|
|
f85f8b2b4d | ||
|
|
7ddaf29f8d | ||
|
|
b626d3e628 | ||
|
|
a39928fc55 | ||
|
|
9e68af38d9 | ||
|
|
4357b5b620 | ||
|
|
24519e58a8 | ||
|
|
219e37b592 | ||
|
|
fe6f646c9d | ||
|
|
06bdeb97dc | ||
|
|
b1f9f2da48 | ||
|
|
d7c7e4ede3 | ||
|
|
0550497e60 | ||
|
|
5c13d21260 | ||
|
|
2f60828e6e | ||
|
|
61d9e0f1ab | ||
|
|
cd72b05a7d | ||
|
|
69758f2523 | ||
|
|
0f848370fe | ||
|
|
4618c9b04e | ||
|
|
6ddead591a | ||
|
|
6eec19b9af | ||
|
|
935e9bbc44 | ||
|
|
59d443e889 | ||
|
|
2e40f67b1b | ||
|
|
f1de905f87 | ||
|
|
b0d4a7cb8a | ||
|
|
fed698d0d2 | ||
|
|
db01a216fd | ||
|
|
b46a823342 | ||
|
|
2190128fd3 | ||
|
|
9e096b1c89 | ||
|
|
14580c55ac | ||
|
|
076b0453c6 | ||
|
|
6b983c0542 | ||
|
|
07d6c311d7 | ||
|
|
58c337c33c | ||
|
|
aeb2d7b8d5 | ||
|
|
b0fdd8cf76 | ||
|
|
fbde23fbb0 | ||
|
|
3f507c0363 | ||
|
|
a2979d237b | ||
|
|
9d67db049a | ||
|
|
851f486a48 | ||
|
|
be43d1644b | ||
|
|
75505ca79f | ||
|
|
7c8b9962ca | ||
|
|
149cfcb995 | ||
|
|
7611baf52e | ||
|
|
efd3a46331 | ||
|
|
4c0cb41a0e | ||
|
|
f6594e9923 | ||
|
|
4a832ad714 | ||
|
|
0200ba6c95 | ||
|
|
0fc59325ab | ||
|
|
eba852bbde | ||
|
|
f82dd94089 | ||
|
|
3e9e2079a7 | ||
|
|
585455e67c | ||
|
|
b7e0a470c7 | ||
|
|
53ea602c07 | ||
|
|
874d3bcc33 | ||
|
|
cbb5c94c6f | ||
|
|
87cfcb7a4f | ||
|
|
44aefaecb6 | ||
|
|
7a7af4cf4e | ||
|
|
1916f87ac5 | ||
|
|
36e8b45bd4 | ||
|
|
89b64e33e2 | ||
|
|
2b10e6724e | ||
|
|
b9685cb369 | ||
|
|
d1f25ca4aa | ||
|
|
11a72411cc | ||
|
|
5057fcff50 | ||
|
|
d791cd9bda | ||
|
|
7d7c728227 | ||
|
|
5fb81434e7 | ||
|
|
c3c4fdf4fa | ||
|
|
9ea18370d3 | ||
|
|
f9333dce01 | ||
|
|
84a87a5128 | ||
|
|
7d64830cfe | ||
|
|
f08916c90f | ||
|
|
89978a7421 | ||
|
|
6ca2a45a21 | ||
|
|
57f8628b50 | ||
|
|
a4e8231f5a | ||
|
|
f71816ed31 | ||
|
|
ef069d49ae | ||
|
|
742ea87708 | ||
|
|
45f5417822 | ||
|
|
f28a09ea0d | ||
|
|
85c1805d33 | ||
|
|
7e129db12e | ||
|
|
7bfc57d1ae | ||
|
|
cd48c9a9cc | ||
|
|
244b759787 | ||
|
|
6875a21545 | ||
|
|
694ee7fa36 | ||
|
|
6e3db7c64d | ||
|
|
2d4d23302a | ||
|
|
4456027f91 | ||
|
|
19312b2899 | ||
|
|
ca17967de1 | ||
|
|
491fb265b1 | ||
|
|
08be1b7f03 | ||
|
|
4ef90a836a | ||
|
|
bfd903a933 | ||
|
|
e0db0b8f6d | ||
|
|
4d21951b71 | ||
|
|
7656c08454 | ||
|
|
e894e4655a | ||
|
|
2ce76ff4e5 | ||
|
|
e5d829eb8f | ||
|
|
7f025e000e | ||
|
|
5132941a84 | ||
|
|
ef265cca0a | ||
|
|
31bb09233b | ||
|
|
57f5e0835d | ||
|
|
814909538f | ||
|
|
94ec2ea5d9 | ||
|
|
40aec7c068 | ||
|
|
ead2777f48 | ||
|
|
0a0d44d4f1 | ||
|
|
4911866f3d | ||
|
|
d7e1052205 | ||
|
|
8e2dbf3f55 | ||
|
|
2ee9b47f6c | ||
|
|
d8dc94c1ff | ||
|
|
d989bf6209 | ||
|
|
021070215c | ||
|
|
ac61cba05b | ||
|
|
21e829416f | ||
|
|
cf7e4b31f4 | ||
|
|
dc5c1016ce | ||
|
|
8a0824a948 | ||
|
|
5c154dac25 | ||
|
|
7f095a6092 | ||
|
|
35687c3ead | ||
|
|
f91fe01f3e | ||
|
|
43d29bfbbb | ||
|
|
7dff4e748d | ||
|
|
4913cd868a | ||
|
|
973c12264c | ||
|
|
fecbed5fb2 | ||
|
|
82e68e378b | ||
|
|
bbf4cff5f7 | ||
|
|
3d6ba65cfc | ||
|
|
ca0f74ee44 | ||
|
|
aa65867e43 | ||
|
|
c2e7a30e42 | ||
|
|
4dbfd92e6f | ||
|
|
c0d9e483c2 | ||
|
|
36db05c3b9 | ||
|
|
fc032119ca | ||
|
|
98ed996780 | ||
|
|
fa83ee0277 | ||
|
|
7c137510e7 | ||
|
|
10a7e3d301 | ||
|
|
feaf406fee | ||
|
|
d90e401d2a | ||
|
|
99ad90bd0d | ||
|
|
4adaaa2eb2 | ||
|
|
b946d20762 | ||
|
|
2a13307276 | ||
|
|
0b3e046953 | ||
|
|
68e095c4d6 | ||
|
|
fe54ebbb3a | ||
|
|
cdf0ed3be9 | ||
|
|
da9e24dfa7 | ||
|
|
1c1ad17b43 | ||
|
|
5618c2b45a | ||
|
|
3878948300 | ||
|
|
ca4cde1c26 | ||
|
|
6a738c1ede | ||
|
|
04e9afb4cf | ||
|
|
e73af12f49 | ||
|
|
6bdbeafca2 | ||
|
|
21cbaafb2f | ||
|
|
35426410d5 | ||
|
|
54a8d37e6c | ||
|
|
d5dae1cbb7 | ||
|
|
06dc40ba65 | ||
|
|
7c604f336d | ||
|
|
e3a31afe40 | ||
|
|
289d658baa | ||
|
|
7a437d1d23 | ||
|
|
08e3f1efd0 | ||
|
|
0d9c0d15c6 | ||
|
|
96baaa09e3 | ||
|
|
e004d2564e | ||
|
|
651ef54920 | ||
|
|
4a60286512 | ||
|
|
1148a6bda0 | ||
|
|
9ad473c633 | ||
|
|
e38be6dec0 | ||
|
|
8241be5817 | ||
|
|
1c836ecde9 | ||
|
|
6dd09308fa | ||
|
|
555e43c896 | ||
|
|
2bd5b1c8ee | ||
|
|
14f2f1a713 | ||
|
|
3d9bcc6d97 | ||
|
|
3147c6c5bd | ||
|
|
20a515153f |
@@ -2,10 +2,15 @@
|
||||
root = true
|
||||
|
||||
# Unix-style newlines with a newline ending every file.
|
||||
[*.cs]
|
||||
[*]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
|
||||
[*.cs]
|
||||
csharp_space_after_cast = false
|
||||
indent_size = 4
|
||||
|
||||
[*.csproj]
|
||||
insert_final_newline = false
|
||||
indent_size = 2
|
||||
|
||||
11
.github/CODEOWNERS
vendored
@@ -2,5 +2,12 @@
|
||||
# Each line is a file pattern followed by one or more owners.
|
||||
# Owners can be @users, @org/teams or emails
|
||||
|
||||
/misc/2.5d @aaronfranke
|
||||
/mono/2.5d @aaronfranke
|
||||
/.github/dist/ @Calinou
|
||||
|
||||
/3d/voxel/ @aaronfranke
|
||||
/misc/matrix_transform/ @aaronfranke
|
||||
/misc/2.5d/ @aaronfranke
|
||||
/mono/2.5d/ @aaronfranke
|
||||
|
||||
/2d/physics_tests/ @pouleyKetchoupp
|
||||
/3d/physics_tests/ @pouleyKetchoupp
|
||||
|
||||
4
.github/ISSUE_TEMPLATE/bug-report.md
vendored
@@ -1,9 +1,9 @@
|
||||
---
|
||||
name: Bug Report
|
||||
about: Report a bug with one of the demo projects.
|
||||
title: ''
|
||||
title: ""
|
||||
labels: bug
|
||||
assignees: ''
|
||||
assignees: ""
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
---
|
||||
name: Feature / Enhancement Request
|
||||
about: Adding new features or improving existing ones.
|
||||
title: ''
|
||||
title: ""
|
||||
labels: enhancement
|
||||
assignees: ''
|
||||
assignees: ""
|
||||
|
||||
---
|
||||
|
||||
|
||||
3
.github/PULL_REQUEST_TEMPLATE.md
vendored
@@ -1,8 +1,7 @@
|
||||
<!--
|
||||
Only submit a pull request if all of the following conditions are met:
|
||||
|
||||
* It must work with the latest stable Godot version. Do not submit a
|
||||
pull request if it only works with alpha/beta builds.
|
||||
* It must work with the latest Godot version of the branch you're submitting to.
|
||||
|
||||
* It must follow all of the Godot style guides, including the GDScript
|
||||
style guide and the C# style guide.
|
||||
|
||||
0
.github/dist/.nojekyll
vendored
Normal file
23
.github/dist/export_presets.cfg
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
[preset.0]
|
||||
|
||||
name="HTML5"
|
||||
platform="HTML5"
|
||||
runnable=true
|
||||
custom_features=""
|
||||
export_filter="all_resources"
|
||||
include_filter="*.json"
|
||||
exclude_filter=""
|
||||
export_path=""
|
||||
script_export_mode=1
|
||||
script_encryption_key=""
|
||||
|
||||
[preset.0.options]
|
||||
|
||||
custom_template/debug=""
|
||||
custom_template/release=""
|
||||
variant/export_type=0
|
||||
vram_texture_compression/for_desktop=true
|
||||
vram_texture_compression/for_mobile=false
|
||||
html/custom_html_shell=""
|
||||
html/head_include=""
|
||||
html/full_window_size=true
|
||||
20
.github/dist/footer.html
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
<!-- The list of demos will be inserted above by the CI process. -->
|
||||
</ul>
|
||||
<h2>Unavailable demos</h2>
|
||||
<ul>
|
||||
<li><code>2d/hdr/</code>: Not supported on HTML5 yet.</li>
|
||||
<li><code>3d/global_illumination/</code>: Not supported on HTML5 yet (freezes the browser).</li>
|
||||
<li><code>3d/voxel/</code>: Not supported on HTML5 yet.</li>
|
||||
<li><code>audio/device_changer/</code>: Not supported on HTML5 due to browser limitations.</li>
|
||||
<li><code>loading/background_load/</code>: Not supported on HTML5 yet.</li>
|
||||
<li><code>loading/multiple_threads_loading/</code>: Not supported on HTML5 yet.</li>
|
||||
<li><code>loading/threads/</code>: Not supported on HTML5 yet.</li>
|
||||
<li><code>misc/matrix_transform/</code>: Results are only visible in the editor.</li>
|
||||
<li><code>mobile/android_iap/</code>: Only relevant on native Android.</li>
|
||||
<li><code>mobile/sensors/</code>: Not supported on HTML5 yet.</li>
|
||||
<li><code>mono/*/</code>: Not available yet (requires Mono-enabled HTML5 build).</li>
|
||||
<li><code>networking/*/</code>: Doesn't make sense to be hosted on a static host, as the server must be hosted on the same origin due to the browser's same-origin policy.</li>
|
||||
<li><code>plugins/*/</code>: Only effective within the editor.</li>
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
||||
118
.github/dist/header.html
vendored
Normal file
@@ -0,0 +1,118 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Godot demos exported to HTML5</title>
|
||||
<style>
|
||||
:root {
|
||||
--background-color: #fff;
|
||||
--text-color: #222;
|
||||
--link-color: hsl(220, 100%, 45%);
|
||||
--link-underline-color: hsla(220, 100%, 45%, 0.3);
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: dark) {
|
||||
:root {
|
||||
--background-color: #222;
|
||||
--text-color: #eee;
|
||||
--link-color: hsl(200, 100%, 70%);
|
||||
--link-underline-color: hsla(200, 100%, 70%, 0.3);
|
||||
}
|
||||
}
|
||||
|
||||
*:focus {
|
||||
/* More visible outline for better keyboard navigation. */
|
||||
outline: 0.125rem solid hsl(220, 100%, 62.5%);
|
||||
/* Make the outline always appear above other elements. */
|
||||
position: relative;
|
||||
}
|
||||
|
||||
html {
|
||||
background-color: var(--background-color);
|
||||
color: var(--text-color);
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
|
||||
max-width: 50rem;
|
||||
margin: 0 auto;
|
||||
padding: 0.75rem;
|
||||
line-height: 1.618rem;
|
||||
}
|
||||
|
||||
h2 {
|
||||
margin-top: 2.5rem;
|
||||
}
|
||||
|
||||
a {
|
||||
color: var(--link-color);
|
||||
text-decoration-color: var(--link-underline-color);
|
||||
text-decoration-thickness: 0.125rem;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
filter: brightness(117.5%);
|
||||
}
|
||||
|
||||
a:active {
|
||||
filter: brightness(82.5%);
|
||||
}
|
||||
|
||||
ul {
|
||||
padding-left: 0;
|
||||
}
|
||||
|
||||
li {
|
||||
display: block;
|
||||
}
|
||||
|
||||
li a {
|
||||
display: inline-block;
|
||||
width: 100%;
|
||||
height: 4rem;
|
||||
margin-left: 0.5rem;
|
||||
}
|
||||
|
||||
li a:hover {
|
||||
background-color: hsla(0, 0%, 50%, 0.1);
|
||||
}
|
||||
|
||||
li a * {
|
||||
float: left;
|
||||
}
|
||||
|
||||
li a p {
|
||||
height: 24px;
|
||||
margin: 20px 10px;
|
||||
}
|
||||
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>Godot demo projects</h1>
|
||||
<p>
|
||||
This page lists
|
||||
<a href="https://github.com/godotengine/godot-demo-projects">official Godot demo projects</a>
|
||||
exported to HTML5 for testing purposes. These projects are deployed automatically
|
||||
on every commit on the <code>master</code> branch of the repository.
|
||||
</p>
|
||||
<p>
|
||||
The HTML5 exports on this page are provided for demonstration purposes only.
|
||||
Some of these demos may not function or render correctly on HTML5,
|
||||
especially on mobile devices.
|
||||
For best performance, it's recommended to
|
||||
<a href="https://godotengine.org/download">download</a> a native editor
|
||||
and run the demo project by importing its files in the project manager.
|
||||
</p>
|
||||
<p>
|
||||
See the
|
||||
<a href="https://docs.godotengine.org/en/stable/getting_started/workflow/export/exporting_for_web.html">Exporting for the Web</a>
|
||||
documentation for information on exporting your own projects to HTML5.
|
||||
</p>
|
||||
|
||||
<h2>List of demos</h2>
|
||||
<ul>
|
||||
<!-- The list of demos will be inserted below by the CI process. -->
|
||||
4
.github/workflows/static_checks.yml
vendored
@@ -4,10 +4,10 @@ on: [push, pull_request]
|
||||
jobs:
|
||||
format:
|
||||
name: File formatting (file_format.sh)
|
||||
runs-on: ubuntu-20.04
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v5
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
|
||||
3
.gitignore
vendored
@@ -5,6 +5,8 @@
|
||||
.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
|
||||
@@ -16,4 +18,5 @@ mono_crash.*.json
|
||||
|
||||
# System/tool-specific ignores
|
||||
.directory
|
||||
.DS_Store
|
||||
*~
|
||||
|
||||
@@ -5,4 +5,4 @@ These demos are all 2D, but otherwise do not have a common theme.
|
||||
Languages: Most have GDScript, some have
|
||||
[GDSL](https://docs.godotengine.org/en/latest/tutorials/shaders/shader_reference/shading_language.html)
|
||||
|
||||
Renderers: 6 of them are GLES 3, but most are GLES 2
|
||||
Renderers: 4 of them are GLES 3, but most are GLES 2
|
||||
|
||||
20
2d/bullet_shower/README.md
Normal file
@@ -0,0 +1,20 @@
|
||||
# Bullet Shower
|
||||
|
||||
This demonstrates how to manage large amounts of objects efficiently using
|
||||
low-level Servers.
|
||||
|
||||
See
|
||||
[Optimization using Servers](https://docs.godotengine.org/en/latest/tutorials/performance/using_servers.html)
|
||||
in the documentation for more information.
|
||||
|
||||
Language: GDScript
|
||||
|
||||
Renderer: GLES 2
|
||||
|
||||
Check out this demo on the asset library: https://godotengine.org/asset-library/asset/887
|
||||
|
||||
## Screenshots
|
||||
|
||||

|
||||
|
||||

|
||||
BIN
2d/bullet_shower/bullet.png
Normal file
|
After Width: | Height: | Size: 312 B |
@@ -2,15 +2,15 @@
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/object.png-f9ec4c5540ae154e2e73d50438312f26.stex"
|
||||
path="res://.import/bullet.png-ff1424653e10246c11e3724e402c519e.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://grid_movement/tilesets/grid/object.png"
|
||||
dest_files=[ "res://.import/object.png-f9ec4c5540ae154e2e73d50438312f26.stex" ]
|
||||
source_file="res://bullet.png"
|
||||
dest_files=[ "res://.import/bullet.png-ff1424653e10246c11e3724e402c519e.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
@@ -28,6 +28,7 @@ process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
process/normal_map_invert_y=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
93
2d/bullet_shower/bullets.gd
Normal file
@@ -0,0 +1,93 @@
|
||||
extends Node2D
|
||||
# This demo is an example of controling a high number of 2D objects with logic
|
||||
# and collision without using nodes in the scene. This technique is a lot more
|
||||
# efficient than using instancing and nodes, but requires more programming and
|
||||
# is less visual. Bullets are managed together in the `bullets.gd` script.
|
||||
|
||||
const BULLET_COUNT = 500
|
||||
const SPEED_MIN = 20
|
||||
const SPEED_MAX = 80
|
||||
|
||||
const bullet_image = preload("res://bullet.png")
|
||||
|
||||
var bullets = []
|
||||
var shape
|
||||
|
||||
|
||||
class Bullet:
|
||||
var position = Vector2()
|
||||
var speed = 1.0
|
||||
# The body is stored as a RID, which is an "opaque" way to access resources.
|
||||
# With large amounts of objects (thousands or more), it can be significantly
|
||||
# faster to use RIDs compared to a high-level approach.
|
||||
var body = RID()
|
||||
|
||||
|
||||
func _ready():
|
||||
randomize()
|
||||
|
||||
shape = Physics2DServer.circle_shape_create()
|
||||
# Set the collision shape's radius for each bullet in pixels.
|
||||
Physics2DServer.shape_set_data(shape, 8)
|
||||
|
||||
for _i in BULLET_COUNT:
|
||||
var bullet = Bullet.new()
|
||||
# Give each bullet its own speed.
|
||||
bullet.speed = rand_range(SPEED_MIN, SPEED_MAX)
|
||||
bullet.body = Physics2DServer.body_create()
|
||||
|
||||
Physics2DServer.body_set_space(bullet.body, get_world_2d().get_space())
|
||||
Physics2DServer.body_add_shape(bullet.body, shape)
|
||||
# Don't make bullets check collision with other bullets to improve performance.
|
||||
# Their collision mask is still configured to the default value, which allows
|
||||
# bullets to detect collisions with the player.
|
||||
Physics2DServer.body_set_collision_layer(bullet.body, 0)
|
||||
|
||||
# Place bullets randomly on the viewport and move bullets outside the
|
||||
# play area so that they fade in nicely.
|
||||
bullet.position = Vector2(
|
||||
rand_range(0, get_viewport_rect().size.x) + get_viewport_rect().size.x,
|
||||
rand_range(0, get_viewport_rect().size.y)
|
||||
)
|
||||
var transform2d = Transform2D()
|
||||
transform2d.origin = bullet.position
|
||||
Physics2DServer.body_set_state(bullet.body, Physics2DServer.BODY_STATE_TRANSFORM, transform2d)
|
||||
|
||||
bullets.push_back(bullet)
|
||||
|
||||
|
||||
func _process(_delta):
|
||||
# Order the CanvasItem to update every frame.
|
||||
update()
|
||||
|
||||
|
||||
func _physics_process(delta):
|
||||
var transform2d = Transform2D()
|
||||
var offset = get_viewport_rect().size.x + 16
|
||||
for bullet in bullets:
|
||||
bullet.position.x -= bullet.speed * delta
|
||||
|
||||
if bullet.position.x < -16:
|
||||
# The bullet has left the screen; move it back to the right.
|
||||
bullet.position.x = offset
|
||||
|
||||
transform2d.origin = bullet.position
|
||||
|
||||
Physics2DServer.body_set_state(bullet.body, Physics2DServer.BODY_STATE_TRANSFORM, transform2d)
|
||||
|
||||
|
||||
# Instead of drawing each bullet individually in a script attached to each bullet,
|
||||
# we are drawing *all* the bullets at once here.
|
||||
func _draw():
|
||||
var offset = -bullet_image.get_size() * 0.5
|
||||
for bullet in bullets:
|
||||
draw_texture(bullet_image, bullet.position + offset)
|
||||
|
||||
|
||||
# Perform cleanup operations (required to exit without error messages in the console).
|
||||
func _exit_tree():
|
||||
for bullet in bullets:
|
||||
Physics2DServer.free_rid(bullet.body)
|
||||
|
||||
Physics2DServer.free_rid(shape)
|
||||
bullets.clear()
|
||||
BIN
2d/bullet_shower/face_happy.png
Normal file
|
After Width: | Height: | Size: 907 B |
35
2d/bullet_shower/face_happy.png.import
Normal file
@@ -0,0 +1,35 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/face_happy.png-38d387d31ec13459f749c93ce3d75d80.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://face_happy.png"
|
||||
dest_files=[ "res://.import/face_happy.png-38d387d31ec13459f749c93ce3d75d80.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
|
||||
process/normal_map_invert_y=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
||||
BIN
2d/bullet_shower/face_sad.png
Normal file
|
After Width: | Height: | Size: 846 B |
@@ -2,15 +2,15 @@
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/obstacle.png-303025fbfb0bdc414a247e8ee1624a90.stex"
|
||||
path="res://.import/face_sad.png-0ac7165eab24f595aba17a746a66c550.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://grid_movement/tilesets/grid/obstacle.png"
|
||||
dest_files=[ "res://.import/obstacle.png-303025fbfb0bdc414a247e8ee1624a90.stex" ]
|
||||
source_file="res://face_sad.png"
|
||||
dest_files=[ "res://.import/face_sad.png-0ac7165eab24f595aba17a746a66c550.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
@@ -28,6 +28,7 @@ process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
process/normal_map_invert_y=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
BIN
2d/bullet_shower/icon.png
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
@@ -28,6 +28,7 @@ process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
process/normal_map_invert_y=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
33
2d/bullet_shower/player.gd
Normal file
@@ -0,0 +1,33 @@
|
||||
extends Node2D
|
||||
# This demo is an example of controling a high number of 2D objects with logic
|
||||
# and collision without using nodes in the scene. This technique is a lot more
|
||||
# efficient than using instancing and nodes, but requires more programming and
|
||||
# is less visual. Bullets are managed together in the `bullets.gd` script.
|
||||
|
||||
# The number of bullets currently touched by the player.
|
||||
var touching = 0
|
||||
|
||||
onready var sprite = $AnimatedSprite
|
||||
|
||||
|
||||
func _ready():
|
||||
# The player follows the mouse cursor automatically, so there's no point
|
||||
# in displaying the mouse cursor.
|
||||
Input.set_mouse_mode(Input.MOUSE_MODE_HIDDEN)
|
||||
|
||||
|
||||
func _input(event):
|
||||
if event is InputEventMouseMotion:
|
||||
position = event.position - Vector2(0, 16)
|
||||
|
||||
|
||||
func _on_body_shape_entered(_body_id, _body, _body_shape, _local_shape):
|
||||
touching += 1
|
||||
if touching >= 1:
|
||||
sprite.frame = 1
|
||||
|
||||
|
||||
func _on_body_shape_exited(_body_id, _body, _body_shape, _local_shape):
|
||||
touching -= 1
|
||||
if touching == 0:
|
||||
sprite.frame = 0
|
||||
40
2d/bullet_shower/project.godot
Normal file
@@ -0,0 +1,40 @@
|
||||
; 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="Bullet Shower"
|
||||
config/description="Demonstrates how to manage large amounts of objects efficiently using low-level Servers."
|
||||
run/main_scene="res://shower.tscn"
|
||||
config/icon="res://icon.png"
|
||||
|
||||
[display]
|
||||
|
||||
window/dpi/allow_hidpi=true
|
||||
window/stretch/mode="2d"
|
||||
window/stretch/aspect="expand"
|
||||
|
||||
[physics]
|
||||
|
||||
common/enable_pause_aware_picking=true
|
||||
2d/cell_size=64
|
||||
|
||||
[rendering]
|
||||
|
||||
quality/driver/driver_name="GLES2"
|
||||
quality/intended_usage/framebuffer_allocation=0
|
||||
quality/intended_usage/framebuffer_allocation.mobile=0
|
||||
vram_compression/import_etc=true
|
||||
vram_compression/import_etc2=false
|
||||
environment/default_clear_color=Color( 0.133333, 0.133333, 0.2, 1 )
|
||||
0
2d/bullet_shower/screenshots/.gdignore
Normal file
BIN
2d/bullet_shower/screenshots/collision.png
Normal file
|
After Width: | Height: | Size: 152 KiB |
BIN
2d/bullet_shower/screenshots/no_collision.png
Normal file
|
After Width: | Height: | Size: 150 KiB |
34
2d/bullet_shower/shower.tscn
Normal file
@@ -0,0 +1,34 @@
|
||||
[gd_scene load_steps=7 format=2]
|
||||
|
||||
[ext_resource path="res://bullets.gd" type="Script" id=2]
|
||||
[ext_resource path="res://face_happy.png" type="Texture" id=3]
|
||||
[ext_resource path="res://face_sad.png" type="Texture" id=4]
|
||||
[ext_resource path="res://player.gd" type="Script" id=5]
|
||||
|
||||
[sub_resource type="SpriteFrames" id=1]
|
||||
animations = [ {
|
||||
"frames": [ ExtResource( 3 ), ExtResource( 4 ) ],
|
||||
"loop": true,
|
||||
"name": "default",
|
||||
"speed": 5.0
|
||||
} ]
|
||||
|
||||
[sub_resource type="CircleShape2D" id=2]
|
||||
radius = 27.0
|
||||
|
||||
[node name="Shower" type="Node2D"]
|
||||
|
||||
[node name="Bullets" type="Node2D" parent="."]
|
||||
script = ExtResource( 2 )
|
||||
|
||||
[node name="Player" type="Area2D" parent="."]
|
||||
script = ExtResource( 5 )
|
||||
|
||||
[node name="AnimatedSprite" type="AnimatedSprite" parent="Player"]
|
||||
frames = SubResource( 1 )
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Player"]
|
||||
shape = SubResource( 2 )
|
||||
|
||||
[connection signal="body_shape_entered" from="Player" to="Player" method="_on_body_shape_entered"]
|
||||
[connection signal="body_shape_exited" from="Player" to="Player" method="_on_body_shape_exited"]
|
||||
@@ -2,6 +2,7 @@ extends CanvasLayer
|
||||
|
||||
signal start_game
|
||||
|
||||
|
||||
func show_message(text):
|
||||
$MessageLabel.text = text
|
||||
$MessageLabel.show()
|
||||
|
||||
@@ -12,7 +12,7 @@ size = 64
|
||||
font_data = ExtResource( 2 )
|
||||
|
||||
[sub_resource type="InputEventAction" id=3]
|
||||
action = "ui_select"
|
||||
action = "start_game"
|
||||
|
||||
[sub_resource type="ShortCut" id=4]
|
||||
shortcut = SubResource( 3 )
|
||||
@@ -50,8 +50,12 @@ margin_bottom = -100.0
|
||||
custom_fonts/font = SubResource( 2 )
|
||||
shortcut = SubResource( 4 )
|
||||
text = "Start"
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[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"]
|
||||
|
||||
@@ -3,6 +3,7 @@ extends Node
|
||||
export(PackedScene) var mob_scene
|
||||
var score
|
||||
|
||||
|
||||
func _ready():
|
||||
randomize()
|
||||
|
||||
@@ -26,14 +27,13 @@ func new_game():
|
||||
|
||||
|
||||
func _on_MobTimer_timeout():
|
||||
# Create a new instance of the Mob scene.
|
||||
var mob = mob_scene.instance()
|
||||
|
||||
# Choose a random location on Path2D.
|
||||
var mob_spawn_location = get_node("MobPath/MobSpawnLocation")
|
||||
mob_spawn_location.offset = randi()
|
||||
|
||||
# Create a Mob instance and add it to the scene.
|
||||
var mob = mob_scene.instance()
|
||||
add_child(mob)
|
||||
|
||||
# Set the mob's direction perpendicular to the path direction.
|
||||
var direction = mob_spawn_location.rotation + PI / 2
|
||||
|
||||
@@ -44,10 +44,13 @@ func _on_MobTimer_timeout():
|
||||
direction += rand_range(-PI / 4, PI / 4)
|
||||
mob.rotation = direction
|
||||
|
||||
# Choose the velocity.
|
||||
var velocity = Vector2(rand_range(mob.min_speed, mob.max_speed), 0)
|
||||
# Choose the velocity for the mob.
|
||||
var velocity = Vector2(rand_range(150.0, 250.0), 0.0)
|
||||
mob.linear_velocity = velocity.rotated(direction)
|
||||
|
||||
# Spawn the mob by adding it to the Main scene.
|
||||
add_child(mob)
|
||||
|
||||
|
||||
func _on_ScoreTimer_timeout():
|
||||
score += 1
|
||||
|
||||
@@ -47,6 +47,7 @@ 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"]
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
extends RigidBody2D
|
||||
|
||||
#warning-ignore-all:unused_class_variable
|
||||
export var min_speed = 150
|
||||
export var max_speed = 250
|
||||
|
||||
func _ready():
|
||||
$AnimatedSprite.playing = true
|
||||
@@ -12,7 +9,3 @@ func _ready():
|
||||
|
||||
func _on_VisibilityNotifier2D_screen_exited():
|
||||
queue_free()
|
||||
|
||||
|
||||
func _on_start_game():
|
||||
queue_free()
|
||||
|
||||
@@ -10,29 +10,27 @@
|
||||
|
||||
[sub_resource type="SpriteFrames" id=1]
|
||||
animations = [ {
|
||||
"frames": [ ExtResource( 4 ), ExtResource( 5 ) ],
|
||||
"frames": [ ExtResource( 2 ), ExtResource( 3 ) ],
|
||||
"loop": true,
|
||||
"name": "walk",
|
||||
"speed": 4.0
|
||||
"name": "fly",
|
||||
"speed": 3.0
|
||||
}, {
|
||||
"frames": [ ExtResource( 6 ), ExtResource( 7 ) ],
|
||||
"loop": true,
|
||||
"name": "swim",
|
||||
"speed": 4.0
|
||||
}, {
|
||||
"frames": [ ExtResource( 2 ), ExtResource( 3 ) ],
|
||||
"frames": [ ExtResource( 4 ), ExtResource( 5 ) ],
|
||||
"loop": true,
|
||||
"name": "fly",
|
||||
"speed": 3.0
|
||||
"name": "walk",
|
||||
"speed": 4.0
|
||||
} ]
|
||||
|
||||
[sub_resource type="CapsuleShape2D" id=2]
|
||||
radius = 35.2706
|
||||
height = 23.3281
|
||||
|
||||
[node name="Mob" type="RigidBody2D" groups=[
|
||||
"mobs",
|
||||
]]
|
||||
[node name="Mob" type="RigidBody2D" groups=["mobs"]]
|
||||
collision_mask = 0
|
||||
gravity_scale = 0.0
|
||||
script = ExtResource( 1 )
|
||||
@@ -50,4 +48,5 @@ rotation = 1.5708
|
||||
shape = SubResource( 2 )
|
||||
|
||||
[node name="VisibilityNotifier2D" type="VisibilityNotifier2D" parent="."]
|
||||
|
||||
[connection signal="screen_exited" from="VisibilityNotifier2D" to="." method="_on_VisibilityNotifier2D_screen_exited"]
|
||||
|
||||
@@ -5,6 +5,7 @@ signal hit
|
||||
export var speed = 400 # How fast the player will move (pixels/sec).
|
||||
var screen_size # Size of the game window.
|
||||
|
||||
|
||||
func _ready():
|
||||
screen_size = get_viewport_rect().size
|
||||
hide()
|
||||
|
||||
@@ -67,4 +67,5 @@ 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"]
|
||||
|
||||
@@ -4,7 +4,7 @@ This is a simple game where your character must move
|
||||
and avoid the enemies for as long as possible.
|
||||
|
||||
This is a finished version of the game featured in the
|
||||
["Your first game"](https://docs.godotengine.org/en/latest/getting_started/step_by_step/your_first_game.html)
|
||||
["Your first 2D game"](https://docs.godotengine.org/en/latest/getting_started/first_2d_game/index.html)
|
||||
tutorial in the documentation. For more details,
|
||||
consider following the tutorial in the documentation.
|
||||
|
||||
@@ -14,12 +14,16 @@ Renderer: GLES 3 (particles are not available in GLES 2)
|
||||
|
||||
Note: There is a C# version available [here](https://github.com/godotengine/godot-demo-projects/tree/master/mono/dodge_the_creeps).
|
||||
|
||||
Note: There is a GDNative C++ version available [here](https://github.com/godotengine/gdnative-demos/tree/master/cpp/dodge_the_creeps).
|
||||
|
||||
Check out this demo on the asset library: https://godotengine.org/asset-library/asset/515
|
||||
|
||||
## Screenshots
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
## Copying
|
||||
|
||||
`art/House In a Forest Loop.ogg` Copyright © 2012 [HorrorPen](https://opengameart.org/users/horrorpen), [CC-BY 3.0: Attribution](http://creativecommons.org/licenses/by/3.0/). Source: https://opengameart.org/content/loop-house-in-a-forest
|
||||
|
||||
@@ -28,6 +28,7 @@ process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
process/normal_map_invert_y=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
|
||||
@@ -28,6 +28,7 @@ process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
process/normal_map_invert_y=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
|
||||
@@ -28,6 +28,7 @@ process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
process/normal_map_invert_y=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
|
||||
@@ -28,6 +28,7 @@ process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
process/normal_map_invert_y=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
|
||||
@@ -28,6 +28,7 @@ process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
process/normal_map_invert_y=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
|
||||
@@ -28,6 +28,7 @@ process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
process/normal_map_invert_y=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
|
||||
@@ -17,5 +17,7 @@ force/max_rate=false
|
||||
force/max_rate_hz=44100
|
||||
edit/trim=true
|
||||
edit/normalize=true
|
||||
edit/loop=false
|
||||
edit/loop_mode=0
|
||||
edit/loop_begin=0
|
||||
edit/loop_end=-1
|
||||
compress/mode=0
|
||||
|
||||
@@ -28,6 +28,7 @@ process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
process/normal_map_invert_y=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
|
||||
@@ -28,6 +28,7 @@ process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
process/normal_map_invert_y=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
|
||||
@@ -28,6 +28,7 @@ process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
process/normal_map_invert_y=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
|
||||
@@ -28,6 +28,7 @@ process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
process/normal_map_invert_y=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
|
||||
@@ -28,6 +28,7 @@ process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
process/normal_map_invert_y=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
|
||||
@@ -8,18 +8,13 @@
|
||||
|
||||
config_version=4
|
||||
|
||||
_global_script_classes=[ ]
|
||||
_global_script_class_icons={
|
||||
|
||||
}
|
||||
|
||||
[application]
|
||||
|
||||
config/name="Dodge the Creeps"
|
||||
config/description="This is a simple game where your character must move
|
||||
and avoid the enemies for as long as possible.
|
||||
|
||||
This is a finished version of the game featured in the 'Your first game'
|
||||
This is a finished version of the game featured in the 'Your first 2D game'
|
||||
tutorial in the documentation. For more details, consider
|
||||
following the tutorial in the documentation."
|
||||
run/main_scene="res://Main.tscn"
|
||||
@@ -29,38 +24,45 @@ config/icon="res://icon.png"
|
||||
|
||||
window/size/width=480
|
||||
window/size/height=720
|
||||
window/stretch/mode="2d"
|
||||
window/stretch/aspect="keep"
|
||||
|
||||
[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)
|
||||
"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,"physical_scancode":0,"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,"physical_scancode":0,"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)
|
||||
"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,"physical_scancode":0,"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,"physical_scancode":0,"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)
|
||||
"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,"physical_scancode":0,"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,"physical_scancode":0,"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)
|
||||
"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,"physical_scancode":0,"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,"physical_scancode":0,"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)
|
||||
]
|
||||
}
|
||||
start_game={
|
||||
"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":16777221,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
|
||||
0
2d/dodge_the_creeps/screenshots/.gdignore
Normal file
BIN
2d/dodge_the_creeps/screenshots/dodge.png
Normal file
|
After Width: | Height: | Size: 12 KiB |
@@ -1,22 +1,54 @@
|
||||
[gd_scene load_steps=5 format=2]
|
||||
[gd_scene load_steps=6 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://fonts/source_code_pro_explanations.tres" type="DynamicFont" id=2]
|
||||
[ext_resource path="res://debug/StatesStackDiplayer.tscn" type="PackedScene" id=3]
|
||||
[ext_resource path="res://debug/ControlsPanel.tscn" type="PackedScene" id=4]
|
||||
[ext_resource path="res://fonts/source_code_pro_explanations_bold.tres" type="DynamicFont" id=5]
|
||||
|
||||
[node name="Demo" type="Node"]
|
||||
|
||||
[node name="Player" parent="." instance=ExtResource( 1 )]
|
||||
position = Vector2( 640, 400 )
|
||||
|
||||
[node name="Explanations" parent="." instance=ExtResource( 2 )]
|
||||
[node name="Explanations" type="RichTextLabel" parent="."]
|
||||
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( 5 )
|
||||
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
|
||||
}
|
||||
|
||||
[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 )]
|
||||
|
||||
|
||||
@@ -7,9 +7,6 @@ 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
|
||||
|
||||
@@ -2,12 +2,13 @@ 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"
|
||||
states_names += String(state.get_name()) + "\n"
|
||||
numbers += str(index) + "\n"
|
||||
index += 1
|
||||
$States.text = states_names
|
||||
|
||||
@@ -28,6 +28,7 @@ process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
process/normal_map_invert_y=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
|
||||
@@ -41,7 +41,6 @@ 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_": [ ]
|
||||
@@ -81,11 +80,11 @@ texture = ExtResource( 9 )
|
||||
[node name="BodyPivot" type="Position2D" parent="."]
|
||||
|
||||
[node name="Body" type="Sprite" parent="BodyPivot"]
|
||||
position = Vector2( 0, -58.8242 )
|
||||
position = Vector2( 0, -58 )
|
||||
texture = ExtResource( 10 )
|
||||
|
||||
[node name="BulletSpawn" type="Node2D" parent="BodyPivot"]
|
||||
position = Vector2( 1.17401, -61.266 )
|
||||
position = Vector2( 0, -58 )
|
||||
script = ExtResource( 11 )
|
||||
|
||||
[node name="CooldownTimer" type="Timer" parent="BodyPivot/BulletSpawn"]
|
||||
@@ -93,7 +92,7 @@ wait_time = 0.2
|
||||
one_shot = true
|
||||
|
||||
[node name="WeaponPivot" type="Position2D" parent="BodyPivot"]
|
||||
position = Vector2( 1.17401, -61.266 )
|
||||
position = Vector2( 0, -58 )
|
||||
script = ExtResource( 12 )
|
||||
|
||||
[node name="Offset" type="Position2D" parent="BodyPivot/WeaponPivot"]
|
||||
@@ -105,17 +104,19 @@ position = Vector2( 110, 0 )
|
||||
polygon = PoolVector2Array( -20, 0, -20, -20, 20, -20, 20, 0 )
|
||||
|
||||
[node name="StateNameDisplayer" type="Label" parent="."]
|
||||
physics_interpolation_mode = 2
|
||||
margin_left = -109.0
|
||||
margin_top = -172.0
|
||||
margin_right = 110.0
|
||||
margin_bottom = -138.0
|
||||
custom_fonts/font = SubResource( 4 )
|
||||
text = "Test"
|
||||
text = "Idle"
|
||||
align = 1
|
||||
valign = 1
|
||||
uppercase = true
|
||||
script = ExtResource( 15 )
|
||||
[connection signal="state_changed" from="StateMachine" to="StateNameDisplayer" method="_on_StateMachine_state_changed"]
|
||||
|
||||
[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"]
|
||||
|
||||
@@ -28,6 +28,7 @@ process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
process/normal_map_invert_y=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
|
||||
@@ -5,6 +5,7 @@ export(float) var speed = 1000.0
|
||||
|
||||
onready var root = get_tree().root
|
||||
|
||||
|
||||
func _ready():
|
||||
set_as_toplevel(true)
|
||||
|
||||
|
||||
@@ -2,16 +2,18 @@ extends Node2D
|
||||
|
||||
var bullet = preload("Bullet.tscn")
|
||||
|
||||
|
||||
func _unhandled_input(event):
|
||||
if event.is_action_pressed("fire"):
|
||||
fire(owner.look_direction)
|
||||
fire()
|
||||
|
||||
|
||||
func fire(direction):
|
||||
func fire():
|
||||
if not $CooldownTimer.is_stopped():
|
||||
return
|
||||
|
||||
$CooldownTimer.start()
|
||||
var new_bullet = bullet.instance()
|
||||
new_bullet.direction = direction
|
||||
new_bullet.position = global_position
|
||||
new_bullet.direction = owner.look_direction
|
||||
add_child(new_bullet)
|
||||
|
||||
@@ -7,6 +7,7 @@ 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
|
||||
|
||||
@@ -6,6 +6,7 @@ onready var jump = $Jump
|
||||
onready var stagger = $Stagger
|
||||
onready var attack = $Attack
|
||||
|
||||
|
||||
func _ready():
|
||||
states_map = {
|
||||
"idle": idle,
|
||||
|
||||
@@ -28,6 +28,7 @@ process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
process/normal_map_invert_y=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
extends "res://state_machine/state.gd"
|
||||
|
||||
|
||||
func enter():
|
||||
owner.get_node("AnimationPlayer").play("idle")
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ extends "res://state_machine/state.gd"
|
||||
# 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")
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ extends Label
|
||||
|
||||
var start_position = Vector2()
|
||||
|
||||
|
||||
func _ready():
|
||||
start_position = rect_position
|
||||
|
||||
@@ -11,4 +12,4 @@ func _physics_process(_delta):
|
||||
|
||||
|
||||
func _on_StateMachine_state_changed(current_state):
|
||||
text = current_state.get_name()
|
||||
text = String(current_state.get_name())
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
extends "res://state_machine/state.gd"
|
||||
|
||||
|
||||
# Initialize the state. E.g. change the animation.
|
||||
func enter():
|
||||
owner.set_dead(true)
|
||||
|
||||
@@ -17,9 +17,13 @@ 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
|
||||
if speed > 0.0:
|
||||
max_horizontal_speed = speed
|
||||
else:
|
||||
max_horizontal_speed = base_max_horizontal_speed
|
||||
enter_velocity = velocity
|
||||
|
||||
|
||||
@@ -27,7 +31,10 @@ func enter():
|
||||
var input_direction = get_input_direction()
|
||||
update_look_direction(input_direction)
|
||||
|
||||
horizontal_velocity = enter_velocity if input_direction else Vector2()
|
||||
if input_direction:
|
||||
horizontal_velocity = enter_velocity
|
||||
else:
|
||||
horizontal_velocity = Vector2()
|
||||
vertical_speed = 600.0
|
||||
|
||||
owner.get_node("AnimationPlayer").play("idle")
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
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")
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
extends "on_ground.gd"
|
||||
|
||||
|
||||
func enter():
|
||||
owner.get_node("AnimationPlayer").play("idle")
|
||||
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
extends "on_ground.gd"
|
||||
|
||||
export(float) var max_walk_speed = 450
|
||||
export(float) var max_run_speed = 700
|
||||
|
||||
export(float) var max_walk_speed = 450.0
|
||||
export(float) var max_run_speed = 700.0
|
||||
|
||||
|
||||
func enter():
|
||||
speed = 0.0
|
||||
@@ -22,7 +24,11 @@ func update(_delta):
|
||||
emit_signal("finished", "idle")
|
||||
update_look_direction(input_direction)
|
||||
|
||||
speed = max_run_speed if Input.is_action_pressed("run") else max_walk_speed
|
||||
if Input.is_action_pressed("run"):
|
||||
speed = max_run_speed
|
||||
else:
|
||||
speed = max_walk_speed
|
||||
|
||||
var collision_info = move(speed, input_direction)
|
||||
if not collision_info:
|
||||
return
|
||||
|
||||
@@ -4,6 +4,7 @@ extends "../motion.gd"
|
||||
var speed = 0.0
|
||||
var velocity = Vector2()
|
||||
|
||||
|
||||
func handle_input(event):
|
||||
if event.is_action_pressed("jump"):
|
||||
emit_signal("finished", "jump")
|
||||
|
||||
@@ -221,10 +221,10 @@ tracks/0/keys = {
|
||||
}
|
||||
|
||||
[node name="Sword" type="Area2D"]
|
||||
input_pickable = false
|
||||
monitorable = false
|
||||
collision_layer = 16
|
||||
collision_mask = 3
|
||||
input_pickable = false
|
||||
monitorable = false
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||
|
||||
@@ -30,6 +30,7 @@ var combo = [{
|
||||
|
||||
var hit_objects = []
|
||||
|
||||
|
||||
func _ready():
|
||||
# warning-ignore:return_value_discarded
|
||||
$AnimationPlayer.connect("animation_finished", self, "_on_animation_finished")
|
||||
|
||||
@@ -28,6 +28,7 @@ process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
process/normal_map_invert_y=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
|
||||
@@ -2,6 +2,7 @@ extends Position2D
|
||||
|
||||
var z_index_start = 0
|
||||
|
||||
|
||||
func _ready():
|
||||
#warning-ignore:return_value_discarded
|
||||
owner.connect("direction_changed", self, "_on_Parent_direction_changed")
|
||||
|
||||
@@ -8,11 +8,6 @@
|
||||
|
||||
config_version=4
|
||||
|
||||
_global_script_classes=[ ]
|
||||
_global_script_class_icons={
|
||||
|
||||
}
|
||||
|
||||
[application]
|
||||
|
||||
config/name="Hierarchical Finite State Machine"
|
||||
@@ -38,67 +33,73 @@ singletons=[ ]
|
||||
|
||||
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)
|
||||
"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,"physical_scancode":0,"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,"physical_scancode":0,"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)
|
||||
"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,"physical_scancode":0,"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,"physical_scancode":0,"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)
|
||||
"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,"physical_scancode":0,"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,"physical_scancode":0,"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)
|
||||
"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,"physical_scancode":0,"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,"physical_scancode":0,"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)
|
||||
"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,"physical_scancode":0,"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)
|
||||
"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,"physical_scancode":0,"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)
|
||||
"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,"physical_scancode":0,"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)
|
||||
"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,"physical_scancode":0,"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)
|
||||
"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,"physical_scancode":0,"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)
|
||||
]
|
||||
}
|
||||
|
||||
[physics]
|
||||
|
||||
common/physics_interpolation=true
|
||||
|
||||
[rendering]
|
||||
|
||||
quality/driver/driver_name="GLES2"
|
||||
vram_compression/import_etc=true
|
||||
vram_compression/import_etc2=false
|
||||
|
||||
@@ -6,6 +6,7 @@ extends Node
|
||||
# warning-ignore:unused_signal
|
||||
signal finished(next_state_name)
|
||||
|
||||
|
||||
# Initialize the state. E.g. change the animation.
|
||||
func enter():
|
||||
pass
|
||||
|
||||
@@ -17,6 +17,7 @@ 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()
|
||||
|
||||
@@ -28,6 +28,7 @@ process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
process/normal_map_invert_y=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
|
||||
@@ -48,6 +48,7 @@ var brush_shape = BrushShapes.CIRCLE;
|
||||
# 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")
|
||||
|
||||
@@ -215,8 +215,7 @@ text = "Clear picture"
|
||||
[node name="SaveFileDialog" type="FileDialog" parent="."]
|
||||
margin_right = 600.0
|
||||
margin_bottom = 400.0
|
||||
rect_min_size = Vector2( 300, 105 )
|
||||
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/"
|
||||
|
||||
@@ -28,6 +28,7 @@ process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
process/normal_map_invert_y=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
|
||||
@@ -8,11 +8,6 @@
|
||||
|
||||
config_version=4
|
||||
|
||||
_global_script_classes=[ ]
|
||||
_global_script_class_icons={
|
||||
|
||||
}
|
||||
|
||||
[application]
|
||||
|
||||
config/name="GD Paint"
|
||||
@@ -37,3 +32,5 @@ singletons=[ ]
|
||||
[rendering]
|
||||
|
||||
quality/driver/driver_name="GLES2"
|
||||
vram_compression/import_etc=true
|
||||
vram_compression/import_etc2=false
|
||||
|
||||
@@ -10,6 +10,7 @@ onready var _parent = get_parent()
|
||||
onready var save_dialog = _parent.get_node(@"SaveFileDialog")
|
||||
onready var paint_control = _parent.get_node(@"PaintControl")
|
||||
|
||||
|
||||
func _ready():
|
||||
# warning-ignore-all:return_value_discarded
|
||||
# Assign all of the needed signals for the oppersation buttons.
|
||||
|
||||
@@ -4,6 +4,7 @@ const CAVE_LIMIT = 1000
|
||||
|
||||
onready var cave = $Cave
|
||||
|
||||
|
||||
func _unhandled_input(event):
|
||||
if event is InputEventMouseMotion and event.button_mask > 0:
|
||||
var rel_x = event.relative.x
|
||||
|
||||
@@ -28,6 +28,7 @@ process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
process/normal_map_invert_y=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
|
||||
@@ -28,6 +28,7 @@ process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
process/normal_map_invert_y=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
|
||||
@@ -28,6 +28,7 @@ process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
process/normal_map_invert_y=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
|
||||
@@ -8,11 +8,6 @@
|
||||
|
||||
config_version=4
|
||||
|
||||
_global_script_classes=[ ]
|
||||
_global_script_class_icons={
|
||||
|
||||
}
|
||||
|
||||
[application]
|
||||
|
||||
config/name="HDR for 2D"
|
||||
|
||||
@@ -28,6 +28,7 @@ process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
process/normal_map_invert_y=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
|
||||
@@ -8,11 +8,6 @@
|
||||
|
||||
config_version=4
|
||||
|
||||
_global_script_classes=[ ]
|
||||
_global_script_class_icons={
|
||||
|
||||
}
|
||||
|
||||
[application]
|
||||
|
||||
config/name="Hexagonal Game"
|
||||
@@ -34,38 +29,45 @@ singletons=[ ]
|
||||
|
||||
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)
|
||||
"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,"physical_scancode":0,"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,"physical_scancode":0,"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)
|
||||
]
|
||||
}
|
||||
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)
|
||||
"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,"physical_scancode":0,"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,"physical_scancode":0,"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)
|
||||
"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,"physical_scancode":0,"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,"physical_scancode":0,"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)
|
||||
"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,"physical_scancode":0,"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,"physical_scancode":0,"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)
|
||||
]
|
||||
}
|
||||
|
||||
[physics]
|
||||
|
||||
common/physics_fps=120
|
||||
common/physics_interpolation=true
|
||||
|
||||
[rendering]
|
||||
|
||||
quality/driver/driver_name="GLES2"
|
||||
vram_compression/import_etc=true
|
||||
vram_compression/import_etc2=false
|
||||
environment/default_clear_color=Color( 0.172549, 0.219608, 0.129412, 1 )
|
||||
|
||||
@@ -28,6 +28,7 @@ process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
process/normal_map_invert_y=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
|
||||
@@ -28,6 +28,7 @@ process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
process/normal_map_invert_y=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
|
||||
@@ -28,6 +28,7 @@ process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
process/normal_map_invert_y=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
|
||||
@@ -28,6 +28,7 @@ process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
process/normal_map_invert_y=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
|
||||
@@ -28,6 +28,7 @@ process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
process/normal_map_invert_y=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
|
||||
@@ -28,6 +28,7 @@ process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
process/normal_map_invert_y=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
|
||||
@@ -28,6 +28,7 @@ process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
process/normal_map_invert_y=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
|
||||
@@ -28,6 +28,7 @@ process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
process/normal_map_invert_y=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
|
||||