Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ea5b868fc7 | ||
|
|
a6ae6f64be | ||
|
|
507b8c6cf6 | ||
|
|
e59d96ef7a | ||
|
|
19584aae6a | ||
|
|
342f27e327 | ||
|
|
4d10544dd9 |
@@ -1,16 +1,6 @@
|
|||||||
# Top-most EditorConfig file.
|
# Top-most EditorConfig file.
|
||||||
root = true
|
root = true
|
||||||
|
|
||||||
# Unix-style newlines with a newline ending every file.
|
|
||||||
[*]
|
[*]
|
||||||
charset = utf-8
|
charset = utf-8
|
||||||
end_of_line = lf
|
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
|
|
||||||
|
|||||||
2
.gitattributes
vendored
@@ -1,4 +1,2 @@
|
|||||||
# Normalize EOL for all files that Git considers text files.
|
# Normalize EOL for all files that Git considers text files.
|
||||||
* text=auto eol=lf
|
* text=auto eol=lf
|
||||||
|
|
||||||
*.hdr binary
|
|
||||||
|
|||||||
13
.github/CODEOWNERS
vendored
@@ -1,13 +0,0 @@
|
|||||||
# Lines starting with '#' are comments.
|
|
||||||
# Each line is a file pattern followed by one or more owners.
|
|
||||||
# Owners can be @users, @org/teams or emails
|
|
||||||
|
|
||||||
/.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
|
|
||||||
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. -->
|
||||||
34
.github/ISSUE_TEMPLATE/bug-report.md
vendored
@@ -1,34 +0,0 @@
|
|||||||
---
|
|
||||||
name: Bug Report
|
|
||||||
about: Report a bug with one of the demo projects.
|
|
||||||
title: ""
|
|
||||||
labels: bug
|
|
||||||
assignees: ""
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
<!--
|
|
||||||
Please search existing issues for potential duplicates before filing yours:
|
|
||||||
https://github.com/godotengine/godot-demo-projects/issues?q=is%3Aissue
|
|
||||||
|
|
||||||
Only submit an issue if it is reproducible with the latest stable Godot version.
|
|
||||||
-->
|
|
||||||
|
|
||||||
**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, what was expected, and what went wrong. -->
|
|
||||||
|
|
||||||
|
|
||||||
**Screenshots of issue:**
|
|
||||||
<!--
|
|
||||||
This section is optional.
|
|
||||||
Drag in an image, or post an image with a link in the form of:
|
|
||||||

|
|
||||||
-->
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
---
|
|
||||||
name: Feature / Enhancement Request
|
|
||||||
about: Adding new features or improving existing ones.
|
|
||||||
title: ""
|
|
||||||
labels: enhancement
|
|
||||||
assignees: ""
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
<!--
|
|
||||||
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. -->
|
|
||||||
|
|
||||||
|
|
||||||
**Description:**
|
|
||||||
24
.github/PULL_REQUEST_TEMPLATE.md
vendored
@@ -1,24 +0,0 @@
|
|||||||
<!--
|
|
||||||
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 follow all of the Godot style guides, including the GDScript
|
|
||||||
style guide and the C# style guide.
|
|
||||||
|
|
||||||
* The demo should not be overcomplicated. Simplicity is usually preferred.
|
|
||||||
|
|
||||||
* If you are submitting a new demo, please ensure that it includes a
|
|
||||||
README file similar to the other demos.
|
|
||||||
|
|
||||||
* If you are submitting a copy of a demo translated to C# etc:
|
|
||||||
|
|
||||||
* Please ensure that there is a good reason to have this demo translated.
|
|
||||||
We don't want to have multiple copies of every single project.
|
|
||||||
|
|
||||||
* Please ensure that the code mirrors the original closely.
|
|
||||||
|
|
||||||
* In the project.godot file and in the README, include "with C#" etc in
|
|
||||||
the title, and also include a link to the original in the README.
|
|
||||||
-->
|
|
||||||
6
.github/dependabot.yml
vendored
@@ -1,6 +0,0 @@
|
|||||||
version: 2
|
|
||||||
updates:
|
|
||||||
- package-ecosystem: "github-actions"
|
|
||||||
directory: "/"
|
|
||||||
schedule:
|
|
||||||
interval: "daily"
|
|
||||||
0
.github/dist/.nojekyll
vendored
23
.github/dist/export_presets.cfg
vendored
@@ -1,23 +0,0 @@
|
|||||||
[preset.0]
|
|
||||||
|
|
||||||
name="HTML5"
|
|
||||||
platform="HTML5"
|
|
||||||
runnable=true
|
|
||||||
custom_features=""
|
|
||||||
export_filter="all_resources"
|
|
||||||
include_filter=""
|
|
||||||
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
|
|
||||||
19
.github/dist/footer.html
vendored
@@ -1,19 +0,0 @@
|
|||||||
<!-- 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><code>3d/voxel/</code>: Not supported on HTML5 yet.
|
|
||||||
<li><code>audio/device_changer/</code>: Not supported on HTML5 due to browser limitations.
|
|
||||||
<li><code>loading/background_load/</code>: Not supported on HTML5 yet.
|
|
||||||
<li><code>loading/multiple_threads_loading/</code>: Not supported on HTML5 yet.
|
|
||||||
<li><code>loading/threads/</code>: Not supported on HTML5 yet.
|
|
||||||
<li><code>misc/matrix_transform/</code>: Results are only visible in the editor.
|
|
||||||
<li><code>mobile/android_iap/</code>: Only relevant on native Android.
|
|
||||||
<li><code>mobile/sensors/</code>: Not supported on HTML5 yet.
|
|
||||||
<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
@@ -1,118 +0,0 @@
|
|||||||
<!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. -->
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
# 2D Demos
|
|
||||||
|
|
||||||
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
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
# 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
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||

|
|
||||||
|
Before Width: | Height: | Size: 312 B |
@@ -1,89 +0,0 @@
|
|||||||
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)
|
|
||||||
|
|
||||||
# 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()
|
|
||||||
|
Before Width: | Height: | Size: 907 B |
|
Before Width: | Height: | Size: 846 B |
|
Before Width: | Height: | Size: 1.9 KiB |
@@ -1,33 +0,0 @@
|
|||||||
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
|
|
||||||
@@ -1,41 +0,0 @@
|
|||||||
; 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]
|
|
||||||
|
|
||||||
2d/cell_size=64
|
|
||||||
common/enable_pause_aware_picking=true
|
|
||||||
|
|
||||||
[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 )
|
|
||||||
|
Before Width: | Height: | Size: 152 KiB |
|
Before Width: | Height: | Size: 150 KiB |
@@ -1,33 +0,0 @@
|
|||||||
[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"]
|
|
||||||
@@ -13,7 +13,7 @@ func show_game_over():
|
|||||||
yield($MessageTimer, "timeout")
|
yield($MessageTimer, "timeout")
|
||||||
$MessageLabel.text = "Dodge the\nCreeps"
|
$MessageLabel.text = "Dodge the\nCreeps"
|
||||||
$MessageLabel.show()
|
$MessageLabel.show()
|
||||||
yield(get_tree().create_timer(1), "timeout")
|
yield(get_tree().create_timer(1), 'timeout')
|
||||||
$StartButton.show()
|
$StartButton.show()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
extends Node
|
extends Node
|
||||||
|
|
||||||
export(PackedScene) var mob_scene
|
export (PackedScene) var Mob
|
||||||
var score
|
var score
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
@@ -16,7 +16,6 @@ func game_over():
|
|||||||
|
|
||||||
|
|
||||||
func new_game():
|
func new_game():
|
||||||
get_tree().call_group("mobs", "queue_free")
|
|
||||||
score = 0
|
score = 0
|
||||||
$Player.start($StartPosition.position)
|
$Player.start($StartPosition.position)
|
||||||
$StartTimer.start()
|
$StartTimer.start()
|
||||||
@@ -26,27 +25,14 @@ func new_game():
|
|||||||
|
|
||||||
|
|
||||||
func _on_MobTimer_timeout():
|
func _on_MobTimer_timeout():
|
||||||
# Choose a random location on Path2D.
|
$MobPath/MobSpawnLocation.offset = randi()
|
||||||
var mob_spawn_location = get_node("MobPath/MobSpawnLocation")
|
var mob = Mob.instance()
|
||||||
mob_spawn_location.offset = randi()
|
|
||||||
|
|
||||||
# Create a Mob instance and add it to the scene.
|
|
||||||
var mob = mob_scene.instance()
|
|
||||||
add_child(mob)
|
add_child(mob)
|
||||||
|
var direction = $MobPath/MobSpawnLocation.rotation + PI / 2
|
||||||
# Set the mob's direction perpendicular to the path direction.
|
mob.position = $MobPath/MobSpawnLocation.position
|
||||||
var direction = mob_spawn_location.rotation + PI / 2
|
|
||||||
|
|
||||||
# Set the mob's position to a random location.
|
|
||||||
mob.position = mob_spawn_location.position
|
|
||||||
|
|
||||||
# Add some randomness to the direction.
|
|
||||||
direction += rand_range(-PI / 4, PI / 4)
|
direction += rand_range(-PI / 4, PI / 4)
|
||||||
mob.rotation = direction
|
mob.rotation = direction
|
||||||
|
mob.linear_velocity = Vector2(rand_range(mob.min_speed, mob.max_speed), 0).rotated(direction)
|
||||||
# Choose the velocity.
|
|
||||||
var velocity = Vector2(rand_range(mob.min_speed, mob.max_speed), 0)
|
|
||||||
mob.linear_velocity = velocity.rotated(direction)
|
|
||||||
|
|
||||||
|
|
||||||
func _on_ScoreTimer_timeout():
|
func _on_ScoreTimer_timeout():
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ _data = {
|
|||||||
|
|
||||||
[node name="Main" type="Node"]
|
[node name="Main" type="Node"]
|
||||||
script = ExtResource( 1 )
|
script = ExtResource( 1 )
|
||||||
mob_scene = ExtResource( 2 )
|
Mob = ExtResource( 2 )
|
||||||
|
|
||||||
[node name="ColorRect" type="ColorRect" parent="."]
|
[node name="ColorRect" type="ColorRect" parent="."]
|
||||||
anchor_right = 1.0
|
anchor_right = 1.0
|
||||||
|
|||||||
@@ -3,16 +3,11 @@ extends RigidBody2D
|
|||||||
#warning-ignore-all:unused_class_variable
|
#warning-ignore-all:unused_class_variable
|
||||||
export var min_speed = 150
|
export var min_speed = 150
|
||||||
export var max_speed = 250
|
export var max_speed = 250
|
||||||
|
var mob_types = ["walk", "swim", "fly"]
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
$AnimatedSprite.playing = true
|
|
||||||
var mob_types = $AnimatedSprite.frames.get_animation_names()
|
|
||||||
$AnimatedSprite.animation = mob_types[randi() % mob_types.size()]
|
$AnimatedSprite.animation = mob_types[randi() % mob_types.size()]
|
||||||
|
|
||||||
|
|
||||||
func _on_VisibilityNotifier2D_screen_exited():
|
func _on_VisibilityNotifier2D_screen_exited():
|
||||||
queue_free()
|
queue_free()
|
||||||
|
|
||||||
|
|
||||||
func _on_start_game():
|
|
||||||
queue_free()
|
|
||||||
|
|||||||
@@ -15,24 +15,22 @@ animations = [ {
|
|||||||
"name": "fly",
|
"name": "fly",
|
||||||
"speed": 3.0
|
"speed": 3.0
|
||||||
}, {
|
}, {
|
||||||
"frames": [ ExtResource( 6 ), ExtResource( 7 ) ],
|
|
||||||
"loop": true,
|
|
||||||
"name": "swim",
|
|
||||||
"speed": 4.0
|
|
||||||
}, {
|
|
||||||
"frames": [ ExtResource( 4 ), ExtResource( 5 ) ],
|
"frames": [ ExtResource( 4 ), ExtResource( 5 ) ],
|
||||||
"loop": true,
|
"loop": true,
|
||||||
"name": "walk",
|
"name": "walk",
|
||||||
"speed": 4.0
|
"speed": 4.0
|
||||||
|
}, {
|
||||||
|
"frames": [ ExtResource( 6 ), ExtResource( 7 ) ],
|
||||||
|
"loop": true,
|
||||||
|
"name": "swim",
|
||||||
|
"speed": 4.0
|
||||||
} ]
|
} ]
|
||||||
|
|
||||||
[sub_resource type="CapsuleShape2D" id=2]
|
[sub_resource type="CapsuleShape2D" id=2]
|
||||||
radius = 35.2706
|
radius = 35.2706
|
||||||
height = 23.3281
|
height = 23.3281
|
||||||
|
|
||||||
[node name="Mob" type="RigidBody2D" groups=[
|
[node name="Mob" type="RigidBody2D"]
|
||||||
"mobs",
|
|
||||||
]]
|
|
||||||
collision_mask = 0
|
collision_mask = 0
|
||||||
gravity_scale = 0.0
|
gravity_scale = 0.0
|
||||||
script = ExtResource( 1 )
|
script = ExtResource( 1 )
|
||||||
@@ -44,6 +42,8 @@ __meta__ = {
|
|||||||
scale = Vector2( 0.75, 0.75 )
|
scale = Vector2( 0.75, 0.75 )
|
||||||
frames = SubResource( 1 )
|
frames = SubResource( 1 )
|
||||||
animation = "walk"
|
animation = "walk"
|
||||||
|
frame = 1
|
||||||
|
playing = true
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||||
rotation = 1.5708
|
rotation = 1.5708
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ extends Area2D
|
|||||||
|
|
||||||
signal hit
|
signal hit
|
||||||
|
|
||||||
export var speed = 400 # How fast the player will move (pixels/sec).
|
export var speed = 400
|
||||||
var screen_size # Size of the game window.
|
var screen_size
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
screen_size = get_viewport_rect().size
|
screen_size = get_viewport_rect().size
|
||||||
@@ -11,22 +11,15 @@ func _ready():
|
|||||||
|
|
||||||
|
|
||||||
func _process(delta):
|
func _process(delta):
|
||||||
var velocity = Vector2.ZERO # The player's movement vector.
|
var velocity = Vector2()
|
||||||
if Input.is_action_pressed("move_right"):
|
velocity.x = Input.get_action_strength("move_right") - Input.get_action_strength("move_left")
|
||||||
velocity.x += 1
|
velocity.y = Input.get_action_strength("move_down") - Input.get_action_strength("move_up")
|
||||||
if Input.is_action_pressed("move_left"):
|
|
||||||
velocity.x -= 1
|
|
||||||
if Input.is_action_pressed("move_down"):
|
|
||||||
velocity.y += 1
|
|
||||||
if Input.is_action_pressed("move_up"):
|
|
||||||
velocity.y -= 1
|
|
||||||
|
|
||||||
if velocity.length() > 0:
|
if velocity.length() > 0:
|
||||||
velocity = velocity.normalized() * speed
|
velocity = velocity.normalized() * speed
|
||||||
$AnimatedSprite.play()
|
$AnimatedSprite.play()
|
||||||
else:
|
else:
|
||||||
$AnimatedSprite.stop()
|
$AnimatedSprite.stop()
|
||||||
|
|
||||||
position += velocity * delta
|
position += velocity * delta
|
||||||
position.x = clamp(position.x, 0, screen_size.x)
|
position.x = clamp(position.x, 0, screen_size.x)
|
||||||
position.y = clamp(position.y, 0, screen_size.y)
|
position.y = clamp(position.y, 0, screen_size.y)
|
||||||
@@ -47,7 +40,6 @@ func start(pos):
|
|||||||
|
|
||||||
|
|
||||||
func _on_Player_body_entered(_body):
|
func _on_Player_body_entered(_body):
|
||||||
hide() # Player disappears after being hit.
|
hide()
|
||||||
emit_signal("hit")
|
emit_signal("hit")
|
||||||
# Must be deferred as we can't change physics properties on a physics callback.
|
|
||||||
$CollisionShape2D.set_deferred("disabled", true)
|
$CollisionShape2D.set_deferred("disabled", true)
|
||||||
|
|||||||
@@ -1,29 +0,0 @@
|
|||||||
# Dodge the Creeps
|
|
||||||
|
|
||||||
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)
|
|
||||||
tutorial in the documentation. For more details,
|
|
||||||
consider following the tutorial in the documentation.
|
|
||||||
|
|
||||||
Language: GDScript
|
|
||||||
|
|
||||||
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).
|
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
Images are from "Abstract Platformer". Created in 2016 by kenney.nl, [CC0 1.0 Universal](http://creativecommons.org/publicdomain/zero/1.0/). Source: https://www.kenney.nl/assets/abstract-platformer
|
|
||||||
|
|
||||||
Font is "Xolonium". Copyright © 2011-2016 Severin Meyer <sev.ch@web.de>, with Reserved Font Name Xolonium, SIL open font license version 1.1. Details are in `fonts/LICENSE.txt`.
|
|
||||||
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.6 KiB |
BIN
2d/dodge_the_creeps/art/set3_tiles.png
Executable file
|
After Width: | Height: | Size: 5.8 KiB |
@@ -2,15 +2,15 @@
|
|||||||
|
|
||||||
importer="texture"
|
importer="texture"
|
||||||
type="StreamTexture"
|
type="StreamTexture"
|
||||||
path="res://.import/paddle.png-0e798fb0912613386507c9904d5cc01a.stex"
|
path="res://.import/set3_tiles.png-7dd06b1fc0bcfaa06e9dd732f61382a2.stex"
|
||||||
metadata={
|
metadata={
|
||||||
"vram_texture": false
|
"vram_texture": false
|
||||||
}
|
}
|
||||||
|
|
||||||
[deps]
|
[deps]
|
||||||
|
|
||||||
source_file="res://paddle.png"
|
source_file="res://art/set3_tiles.png"
|
||||||
dest_files=[ "res://.import/paddle.png-0e798fb0912613386507c9904d5cc01a.stex" ]
|
dest_files=[ "res://.import/set3_tiles.png-7dd06b1fc0bcfaa06e9dd732f61382a2.stex" ]
|
||||||
|
|
||||||
[params]
|
[params]
|
||||||
|
|
||||||
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/
|
||||||
0
2d/dodge_the_creeps/fonts/FONTLOG.txt
Normal file → Executable file
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 2.2 KiB |
@@ -10,18 +10,11 @@ config_version=4
|
|||||||
|
|
||||||
_global_script_classes=[ ]
|
_global_script_classes=[ ]
|
||||||
_global_script_class_icons={
|
_global_script_class_icons={
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[application]
|
[application]
|
||||||
|
|
||||||
config/name="Dodge the Creeps"
|
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'
|
|
||||||
tutorial in the documentation. For more details, consider
|
|
||||||
following the tutorial in the documentation."
|
|
||||||
run/main_scene="res://Main.tscn"
|
run/main_scene="res://Main.tscn"
|
||||||
config/icon="res://icon.png"
|
config/icon="res://icon.png"
|
||||||
|
|
||||||
@@ -64,3 +57,7 @@ move_down={
|
|||||||
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":1,"axis_value":1.0,"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"
|
||||||
|
|||||||
@@ -1,32 +0,0 @@
|
|||||||
# Hierarchical Finite State Machine
|
|
||||||
|
|
||||||
This example shows how to apply the State machine programming
|
|
||||||
pattern in GDscript, including Hierarchical States, and a
|
|
||||||
pushdown automaton.
|
|
||||||
|
|
||||||
Language: GDScript
|
|
||||||
|
|
||||||
Renderer: GLES 2
|
|
||||||
|
|
||||||
Check out this demo on the asset library: https://godotengine.org/asset-library/asset/516
|
|
||||||
|
|
||||||
## Why use a state machine
|
|
||||||
|
|
||||||
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](https://gameprogrammingpatterns.com/state.html).
|
|
||||||
|
|
||||||
## Screenshots
|
|
||||||
|
|
||||||

|
|
||||||
@@ -7,8 +7,8 @@ func _process(_delta):
|
|||||||
var numbers = ""
|
var numbers = ""
|
||||||
var index = 0
|
var index = 0
|
||||||
for state in fsm_node.states_stack:
|
for state in fsm_node.states_stack:
|
||||||
states_names += state.get_name() + "\n"
|
states_names += state.get_name() + '\n'
|
||||||
numbers += str(index) + "\n"
|
numbers += str(index) + '\n'
|
||||||
index += 1
|
index += 1
|
||||||
$States.text = states_names
|
$States.text = states_names
|
||||||
$Numbers.text = numbers
|
$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 )
|
||||||
|
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.3 KiB |
@@ -3,14 +3,12 @@ extends KinematicBody2D
|
|||||||
var direction = Vector2()
|
var direction = Vector2()
|
||||||
export(float) var speed = 1000.0
|
export(float) var speed = 1000.0
|
||||||
|
|
||||||
onready var root = get_tree().root
|
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
set_as_toplevel(true)
|
set_as_toplevel(true)
|
||||||
|
|
||||||
|
|
||||||
func _physics_process(delta):
|
func _physics_process(delta):
|
||||||
if not root.get_visible_rect().has_point(position):
|
if is_outside_view_bounds():
|
||||||
queue_free()
|
queue_free()
|
||||||
|
|
||||||
var motion = direction * speed * delta
|
var motion = direction * speed * delta
|
||||||
@@ -19,5 +17,10 @@ func _physics_process(delta):
|
|||||||
queue_free()
|
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():
|
func _draw():
|
||||||
draw_circle(Vector2(), $CollisionShape2D.shape.radius, Color.white)
|
draw_circle(Vector2(), $CollisionShape2D.shape.radius, Color.white)
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ extends Node2D
|
|||||||
|
|
||||||
var bullet = preload("Bullet.tscn")
|
var bullet = preload("Bullet.tscn")
|
||||||
|
|
||||||
func _unhandled_input(event):
|
func _input(event):
|
||||||
if event.is_action_pressed("fire"):
|
if event.is_action_pressed("fire"):
|
||||||
fire(owner.look_direction)
|
fire(owner.look_direction)
|
||||||
|
|
||||||
|
|||||||
@@ -1,18 +1,12 @@
|
|||||||
extends "res://state_machine/state_machine.gd"
|
extends "res://state_machine/state_machine.gd"
|
||||||
|
|
||||||
onready var idle = $Idle
|
|
||||||
onready var move = $Move
|
|
||||||
onready var jump = $Jump
|
|
||||||
onready var stagger = $Stagger
|
|
||||||
onready var attack = $Attack
|
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
states_map = {
|
states_map = {
|
||||||
"idle": idle,
|
"idle": $Idle,
|
||||||
"move": move,
|
"move": $Move,
|
||||||
"jump": jump,
|
"jump": $Jump,
|
||||||
"stagger": stagger,
|
"stagger": $Stagger,
|
||||||
"attack": attack,
|
"attack": $Attack,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -22,16 +16,16 @@ func _change_state(state_name):
|
|||||||
return
|
return
|
||||||
if state_name in ["stagger", "jump", "attack"]:
|
if state_name in ["stagger", "jump", "attack"]:
|
||||||
states_stack.push_front(states_map[state_name])
|
states_stack.push_front(states_map[state_name])
|
||||||
if state_name == "jump" and current_state == move:
|
if state_name == "jump" and current_state == $Move:
|
||||||
jump.initialize(move.speed, move.velocity)
|
$Jump.initialize($Move.speed, $Move.velocity)
|
||||||
._change_state(state_name)
|
._change_state(state_name)
|
||||||
|
|
||||||
|
|
||||||
func _unhandled_input(event):
|
func _input(event):
|
||||||
# Here we only handle input that can interrupt states, attacking in this case,
|
# Here we only handle input that can interrupt states, attacking in this case,
|
||||||
# otherwise we let the state node handle it.
|
# otherwise we let the state node handle it.
|
||||||
if event.is_action_pressed("attack"):
|
if event.is_action_pressed("attack"):
|
||||||
if current_state in [attack, stagger]:
|
if current_state in [$Attack, $Stagger]:
|
||||||
return
|
return
|
||||||
_change_state("attack")
|
_change_state("attack")
|
||||||
return
|
return
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 427 B After Width: | Height: | Size: 765 B |
@@ -19,26 +19,18 @@ var height = 0.0
|
|||||||
|
|
||||||
func initialize(speed, velocity):
|
func initialize(speed, velocity):
|
||||||
horizontal_speed = speed
|
horizontal_speed = speed
|
||||||
if speed > 0.0:
|
max_horizontal_speed = speed if speed > 0.0 else base_max_horizontal_speed
|
||||||
max_horizontal_speed = speed
|
|
||||||
else:
|
|
||||||
max_horizontal_speed = base_max_horizontal_speed
|
|
||||||
enter_velocity = velocity
|
enter_velocity = velocity
|
||||||
|
|
||||||
|
|
||||||
func enter():
|
func enter():
|
||||||
var input_direction = get_input_direction()
|
var input_direction = get_input_direction()
|
||||||
update_look_direction(input_direction)
|
update_look_direction(input_direction)
|
||||||
|
|
||||||
if input_direction:
|
horizontal_velocity = enter_velocity if input_direction else Vector2()
|
||||||
horizontal_velocity = enter_velocity
|
|
||||||
else:
|
|
||||||
horizontal_velocity = Vector2()
|
|
||||||
vertical_speed = 600.0
|
vertical_speed = 600.0
|
||||||
|
|
||||||
owner.get_node("AnimationPlayer").play("idle")
|
owner.get_node("AnimationPlayer").play("idle")
|
||||||
|
|
||||||
|
|
||||||
func update(delta):
|
func update(delta):
|
||||||
var input_direction = get_input_direction()
|
var input_direction = get_input_direction()
|
||||||
update_look_direction(input_direction)
|
update_look_direction(input_direction)
|
||||||
@@ -48,7 +40,6 @@ func update(delta):
|
|||||||
if height <= 0.0:
|
if height <= 0.0:
|
||||||
emit_signal("finished", "previous")
|
emit_signal("finished", "previous")
|
||||||
|
|
||||||
|
|
||||||
func move_horizontally(delta, direction):
|
func move_horizontally(delta, direction):
|
||||||
if direction:
|
if direction:
|
||||||
horizontal_speed += air_acceleration * delta
|
horizontal_speed += air_acceleration * delta
|
||||||
@@ -62,7 +53,6 @@ func move_horizontally(delta, direction):
|
|||||||
|
|
||||||
owner.move_and_slide(horizontal_velocity)
|
owner.move_and_slide(horizontal_velocity)
|
||||||
|
|
||||||
|
|
||||||
func animate_jump_height(delta):
|
func animate_jump_height(delta):
|
||||||
vertical_speed -= gravity * delta
|
vertical_speed -= gravity * delta
|
||||||
height += vertical_speed * delta
|
height += vertical_speed * delta
|
||||||
|
|||||||
@@ -7,10 +7,9 @@ func handle_input(event):
|
|||||||
|
|
||||||
|
|
||||||
func get_input_direction():
|
func get_input_direction():
|
||||||
var input_direction = Vector2(
|
var input_direction = Vector2()
|
||||||
Input.get_action_strength("move_right") - Input.get_action_strength("move_left"),
|
input_direction.x = Input.get_action_strength("move_right") - Input.get_action_strength("move_left")
|
||||||
Input.get_action_strength("move_down") - Input.get_action_strength("move_up")
|
input_direction.y = Input.get_action_strength("move_down") - Input.get_action_strength("move_up")
|
||||||
)
|
|
||||||
return input_direction
|
return input_direction
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -22,11 +22,7 @@ func update(_delta):
|
|||||||
emit_signal("finished", "idle")
|
emit_signal("finished", "idle")
|
||||||
update_look_direction(input_direction)
|
update_look_direction(input_direction)
|
||||||
|
|
||||||
if Input.is_action_pressed("run"):
|
speed = max_run_speed if Input.is_action_pressed("run") else max_walk_speed
|
||||||
speed = max_run_speed
|
|
||||||
else:
|
|
||||||
speed = max_walk_speed
|
|
||||||
|
|
||||||
var collision_info = move(speed, input_direction)
|
var collision_info = move(speed, input_direction)
|
||||||
if not collision_info:
|
if not collision_info:
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ func _change_state(new_state):
|
|||||||
state = new_state
|
state = new_state
|
||||||
|
|
||||||
|
|
||||||
func _unhandled_input(event):
|
func _input(event):
|
||||||
if not state == States.ATTACK:
|
if not state == States.ATTACK:
|
||||||
return
|
return
|
||||||
if attack_input_state != AttackInputStates.LISTENING:
|
if attack_input_state != AttackInputStates.LISTENING:
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.9 KiB |
@@ -10,15 +10,11 @@ config_version=4
|
|||||||
|
|
||||||
_global_script_classes=[ ]
|
_global_script_classes=[ ]
|
||||||
_global_script_class_icons={
|
_global_script_class_icons={
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[application]
|
[application]
|
||||||
|
|
||||||
config/name="Hierarchical Finite State Machine"
|
config/name="Hierarchical Finite State Machine example"
|
||||||
config/description="This example shows how to apply the State machine programming
|
|
||||||
pattern in GDscript, including Hierarchical States, and a
|
|
||||||
pushdown automaton."
|
|
||||||
run/main_scene="res://Demo.tscn"
|
run/main_scene="res://Demo.tscn"
|
||||||
config/icon="res://icon.png"
|
config/icon="res://icon.png"
|
||||||
|
|
||||||
@@ -26,7 +22,6 @@ config/icon="res://icon.png"
|
|||||||
|
|
||||||
window/size/width=1280
|
window/size/width=1280
|
||||||
window/size/height=720
|
window/size/height=720
|
||||||
window/dpi/allow_hidpi=true
|
|
||||||
window/stretch/mode="2d"
|
window/stretch/mode="2d"
|
||||||
window/stretch/aspect="expand"
|
window/stretch/aspect="expand"
|
||||||
|
|
||||||
@@ -101,6 +96,4 @@ attack={
|
|||||||
|
|
||||||
[rendering]
|
[rendering]
|
||||||
|
|
||||||
quality/driver/driver_name="GLES2"
|
environment/default_environment="res://default_env.tres"
|
||||||
vram_compression/import_etc=true
|
|
||||||
vram_compression/import_etc2=false
|
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 23 KiB |
@@ -7,9 +7,10 @@ extends Node
|
|||||||
|
|
||||||
signal state_changed(current_state)
|
signal state_changed(current_state)
|
||||||
|
|
||||||
# You should set a starting node from the inspector or on the node that inherits
|
# You must set a starting node from the inspector or on
|
||||||
# from this state machine interface. If you don't, the game will default to
|
# the node that inherits from this state machine interface.
|
||||||
# the first state in the state machine's children.
|
# 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
|
export(NodePath) var start_state
|
||||||
var states_map = {}
|
var states_map = {}
|
||||||
|
|
||||||
@@ -21,9 +22,7 @@ func _ready():
|
|||||||
if not start_state:
|
if not start_state:
|
||||||
start_state = get_child(0).get_path()
|
start_state = get_child(0).get_path()
|
||||||
for child in get_children():
|
for child in get_children():
|
||||||
var err = child.connect("finished", self, "_change_state")
|
child.connect("finished", self, "_change_state")
|
||||||
if err:
|
|
||||||
printerr(err)
|
|
||||||
initialize(start_state)
|
initialize(start_state)
|
||||||
|
|
||||||
|
|
||||||
@@ -43,7 +42,7 @@ func set_active(value):
|
|||||||
current_state = null
|
current_state = null
|
||||||
|
|
||||||
|
|
||||||
func _unhandled_input(event):
|
func _input(event):
|
||||||
current_state.handle_input(event)
|
current_state.handle_input(event)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -9,15 +9,10 @@ const IMAGE_SIZE = Vector2(930, 720)
|
|||||||
|
|
||||||
# Enums for the various modes and brush shapes that can be applied.
|
# Enums for the various modes and brush shapes that can be applied.
|
||||||
enum BrushModes {
|
enum BrushModes {
|
||||||
PENCIL,
|
PENCIL, ERASER, CIRCLE_SHAPE, RECTANGLE_SHAPE
|
||||||
ERASER,
|
|
||||||
CIRCLE_SHAPE,
|
|
||||||
RECTANGLE_SHAPE,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
enum BrushShapes {
|
enum BrushShapes {
|
||||||
RECTANGLE,
|
RECTANGLE, CIRCLE
|
||||||
CIRCLE,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# The top-left position of the canvas.
|
# The top-left position of the canvas.
|
||||||
@@ -237,9 +232,11 @@ func _draw():
|
|||||||
draw_circle(brush.brush_pos, brush.brush_shape_circle_radius, brush.brush_color)
|
draw_circle(brush.brush_pos, brush.brush_shape_circle_radius, brush.brush_color)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
func save_picture(path):
|
func save_picture(path):
|
||||||
# Wait until the frame has finished before getting the texture.
|
# Wait a couple frames so the save dialog isn't in the way.
|
||||||
yield(VisualServer, "frame_post_draw")
|
yield (get_tree(), "idle_frame")
|
||||||
|
yield (get_tree(), "idle_frame")
|
||||||
|
|
||||||
# Get the viewport image.
|
# Get the viewport image.
|
||||||
var img = get_viewport().get_texture().get_data()
|
var img = get_viewport().get_texture().get_data()
|
||||||
BIN
2d/gd_paint/PaintTools.png
Normal file
|
After Width: | Height: | Size: 440 B |
@@ -2,15 +2,15 @@
|
|||||||
|
|
||||||
importer="texture"
|
importer="texture"
|
||||||
type="StreamTexture"
|
type="StreamTexture"
|
||||||
path="res://.import/face_happy.png-38d387d31ec13459f749c93ce3d75d80.stex"
|
path="res://.import/PaintTools.png-636e86a6d210b52282c946752bbcc6f1.stex"
|
||||||
metadata={
|
metadata={
|
||||||
"vram_texture": false
|
"vram_texture": false
|
||||||
}
|
}
|
||||||
|
|
||||||
[deps]
|
[deps]
|
||||||
|
|
||||||
source_file="res://face_happy.png"
|
source_file="res://PaintTools.png"
|
||||||
dest_files=[ "res://.import/face_happy.png-38d387d31ec13459f749c93ce3d75d80.stex" ]
|
dest_files=[ "res://.import/PaintTools.png-636e86a6d210b52282c946752bbcc6f1.stex" ]
|
||||||
|
|
||||||
[params]
|
[params]
|
||||||
|
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
[gd_scene load_steps=5 format=2]
|
[gd_scene load_steps=5 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://paint_control.gd" type="Script" id=1]
|
[ext_resource path="res://PaintControl.gd" type="Script" id=1]
|
||||||
[ext_resource path="res://tools_panel.gd" type="Script" id=2]
|
[ext_resource path="res://ToolsPanel.gd" type="Script" id=2]
|
||||||
[ext_resource path="res://paint_tools.png" type="Texture" id=3]
|
[ext_resource path="res://PaintTools.png" type="Texture" id=3]
|
||||||
|
|
||||||
[sub_resource type="StyleBoxFlat" id=1]
|
[sub_resource type="StyleBoxFlat" id=1]
|
||||||
bg_color = Color( 1, 1, 1, 1 )
|
bg_color = Color( 1, 1, 1, 1 )
|
||||||
@@ -10,23 +10,19 @@ bg_color = Color( 1, 1, 1, 1 )
|
|||||||
[node name="PaintRoot" type="Control"]
|
[node name="PaintRoot" type="Control"]
|
||||||
margin_right = 40.0
|
margin_right = 40.0
|
||||||
margin_bottom = 40.0
|
margin_bottom = 40.0
|
||||||
__meta__ = {
|
|
||||||
"_edit_use_anchors_": false
|
|
||||||
}
|
|
||||||
|
|
||||||
[node name="DrawingAreaBG" type="Panel" parent="."]
|
[node name="DrawingAreaBG" type="Panel" parent="."]
|
||||||
margin_left = 350.0
|
margin_left = 350.0
|
||||||
margin_right = 1280.0
|
margin_right = 1280.0
|
||||||
margin_bottom = 720.0
|
margin_bottom = 720.0
|
||||||
|
custom_styles/panelf = SubResource( 1 )
|
||||||
custom_styles/panel = SubResource( 1 )
|
custom_styles/panel = SubResource( 1 )
|
||||||
|
custom_styles/panelnc = SubResource( 1 )
|
||||||
|
|
||||||
[node name="PaintControl" type="Control" parent="."]
|
[node name="PaintControl" type="Control" parent="."]
|
||||||
margin_right = 40.0
|
margin_right = 40.0
|
||||||
margin_bottom = 40.0
|
margin_bottom = 40.0
|
||||||
script = ExtResource( 1 )
|
script = ExtResource( 1 )
|
||||||
__meta__ = {
|
|
||||||
"_edit_use_anchors_": false
|
|
||||||
}
|
|
||||||
|
|
||||||
[node name="TLPos" type="Position2D" parent="PaintControl"]
|
[node name="TLPos" type="Position2D" parent="PaintControl"]
|
||||||
position = Vector2( 350, 0 )
|
position = Vector2( 350, 0 )
|
||||||
@@ -141,6 +137,7 @@ text = "Brush shape: Circle"
|
|||||||
align = 1
|
align = 1
|
||||||
|
|
||||||
[node name="ButtonShapeBox" type="Button" parent="ToolsPanel/BrushSettings"]
|
[node name="ButtonShapeBox" type="Button" parent="ToolsPanel/BrushSettings"]
|
||||||
|
editor/display_folded = true
|
||||||
margin_left = 100.0
|
margin_left = 100.0
|
||||||
margin_top = 100.0
|
margin_top = 100.0
|
||||||
margin_right = 160.0
|
margin_right = 160.0
|
||||||
@@ -154,6 +151,7 @@ region_enabled = true
|
|||||||
region_rect = Rect2( 0, 16, 16, 16 )
|
region_rect = Rect2( 0, 16, 16, 16 )
|
||||||
|
|
||||||
[node name="ButtonShapeCircle" type="Button" parent="ToolsPanel/BrushSettings"]
|
[node name="ButtonShapeCircle" type="Button" parent="ToolsPanel/BrushSettings"]
|
||||||
|
editor/display_folded = true
|
||||||
margin_left = 190.0
|
margin_left = 190.0
|
||||||
margin_top = 100.0
|
margin_top = 100.0
|
||||||
margin_right = 250.0
|
margin_right = 250.0
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
# GD Paint
|
|
||||||
|
|
||||||
GD Paint is a simple image editor made using Godot and GDScript.
|
|
||||||
It supports different types of "brushes": a basic pen/pencil
|
|
||||||
and eraser, as well as a rectangle and a circle brush.
|
|
||||||
|
|
||||||
Language: GDScript
|
|
||||||
|
|
||||||
Renderer: GLES 2
|
|
||||||
|
|
||||||
Check out this demo on the asset library: https://godotengine.org/asset-library/asset/517
|
|
||||||
|
|
||||||
## Screenshots
|
|
||||||
|
|
||||||

|
|
||||||
@@ -1,16 +1,20 @@
|
|||||||
extends Panel
|
extends Panel
|
||||||
|
|
||||||
onready var brush_settings = $BrushSettings
|
var paint_control
|
||||||
onready var label_brush_size = brush_settings.get_node(@"LabelBrushSize")
|
|
||||||
onready var label_brush_shape = brush_settings.get_node(@"LabelBrushShape")
|
|
||||||
onready var label_stats = $LabelStats
|
|
||||||
onready var label_tools = $LabelTools
|
|
||||||
|
|
||||||
onready var _parent = get_parent()
|
onready var brush_settings = $BrushSettings
|
||||||
onready var save_dialog = _parent.get_node(@"SaveFileDialog")
|
onready var label_tools = $LabelTools
|
||||||
onready var paint_control = _parent.get_node(@"PaintControl")
|
onready var label_brush_size = $BrushSettings/LabelBrushSize
|
||||||
|
onready var label_brush_shape = $BrushSettings/LabelBrushShape
|
||||||
|
onready var label_stats = $LabelStats
|
||||||
|
|
||||||
|
var save_dialog
|
||||||
|
|
||||||
func _ready():
|
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
|
# warning-ignore-all:return_value_discarded
|
||||||
# Assign all of the needed signals for the oppersation buttons.
|
# Assign all of the needed signals for the oppersation buttons.
|
||||||
$ButtonUndo.connect("pressed", self, "button_pressed", ["undo_stroke"])
|
$ButtonUndo.connect("pressed", self, "button_pressed", ["undo_stroke"])
|
||||||
@@ -30,7 +34,7 @@ func _ready():
|
|||||||
$ColorPickerBackground.connect("color_changed", self, "background_color_changed")
|
$ColorPickerBackground.connect("color_changed", self, "background_color_changed")
|
||||||
$BrushSettings/HScrollBarBrushSize.connect("value_changed", self, "brush_size_changed")
|
$BrushSettings/HScrollBarBrushSize.connect("value_changed", self, "brush_size_changed")
|
||||||
|
|
||||||
# Assign the "file_selected" signal in SaveFileDialog.
|
# Assign the 'file_selected' signal in SaveFileDialog.
|
||||||
save_dialog.connect("file_selected", self, "save_file_selected")
|
save_dialog.connect("file_selected", self, "save_file_selected")
|
||||||
|
|
||||||
# Set physics process so we can update the status label.
|
# Set physics process so we can update the status label.
|
||||||
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 )
|
||||||
|
Before Width: | Height: | Size: 474 B After Width: | Height: | Size: 884 B |
|
Before Width: | Height: | Size: 273 B |
@@ -10,23 +10,18 @@ config_version=4
|
|||||||
|
|
||||||
_global_script_classes=[ ]
|
_global_script_classes=[ ]
|
||||||
_global_script_class_icons={
|
_global_script_class_icons={
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[application]
|
[application]
|
||||||
|
|
||||||
config/name="GD Paint"
|
config/name="GD Paint"
|
||||||
config/description="GD Paint is a simple image editor made using Godot and GDScript.
|
run/main_scene="res://Paint_root.tscn"
|
||||||
It supports different types of 'brushes': a basic pen/pencil
|
|
||||||
and eraser, as well as a rectangle and a circle brush."
|
|
||||||
run/main_scene="res://paint_root.tscn"
|
|
||||||
config/icon="res://icon.png"
|
config/icon="res://icon.png"
|
||||||
|
|
||||||
[display]
|
[display]
|
||||||
|
|
||||||
window/size/width=1280
|
window/size/width=1280
|
||||||
window/size/height=720
|
window/size/height=720
|
||||||
window/dpi/allow_hidpi=true
|
|
||||||
window/stretch/mode="2d"
|
window/stretch/mode="2d"
|
||||||
window/stretch/aspect="keep"
|
window/stretch/aspect="keep"
|
||||||
|
|
||||||
@@ -36,6 +31,4 @@ singletons=[ ]
|
|||||||
|
|
||||||
[rendering]
|
[rendering]
|
||||||
|
|
||||||
quality/driver/driver_name="GLES2"
|
environment/default_environment="res://default_env.tres"
|
||||||
vram_compression/import_etc=true
|
|
||||||
vram_compression/import_etc2=false
|
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 31 KiB |
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 )
|
||||||
36
2d/grid_based_movement/grid/grid.gd
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
extends TileMap
|
||||||
|
|
||||||
|
enum CellType { EMPTY = -1, ACTOR, OBSTACLE, OBJECT }
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
for child in get_children():
|
||||||
|
set_cellv(world_to_map(child.position), child.type)
|
||||||
|
|
||||||
|
|
||||||
|
func get_cell_pawn(coordinates):
|
||||||
|
for node in get_children():
|
||||||
|
if world_to_map(node.position) == coordinates:
|
||||||
|
return(node)
|
||||||
|
|
||||||
|
|
||||||
|
func request_move(pawn, direction):
|
||||||
|
var cell_start = world_to_map(pawn.position)
|
||||||
|
var cell_target = cell_start + direction
|
||||||
|
|
||||||
|
var cell_target_type = get_cellv(cell_target)
|
||||||
|
match cell_target_type:
|
||||||
|
CellType.EMPTY:
|
||||||
|
return update_pawn_position(pawn, cell_start, cell_target)
|
||||||
|
CellType.OBJECT:
|
||||||
|
var object_pawn = get_cell_pawn(cell_target)
|
||||||
|
object_pawn.queue_free()
|
||||||
|
return update_pawn_position(pawn, cell_start, cell_target)
|
||||||
|
CellType.ACTOR:
|
||||||
|
var pawn_name = get_cell_pawn(cell_target).name
|
||||||
|
print("Cell %s contains %s" % [cell_target, pawn_name])
|
||||||
|
|
||||||
|
|
||||||
|
func update_pawn_position(pawn, cell_start, cell_target):
|
||||||
|
set_cellv(cell_target, pawn.type)
|
||||||
|
set_cellv(cell_start, CellType.EMPTY)
|
||||||
|
return map_to_world(cell_target) + cell_size / 2
|
||||||
BIN
2d/grid_based_movement/icon.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
84
2d/grid_based_movement/pawns/Actor.tscn
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
[gd_scene load_steps=5 format=2]
|
||||||
|
|
||||||
|
[ext_resource path="res://pawns/actor.gd" type="Script" id=1]
|
||||||
|
[ext_resource path="res://pawns/sprites/character.png" type="Texture" id=2]
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id=1]
|
||||||
|
resource_name = "bump"
|
||||||
|
length = 0.1
|
||||||
|
step = 0.01
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/path = NodePath("Pivot/Sprite:position")
|
||||||
|
tracks/0/interp = 1
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PoolRealArray( 0, 0.02, 0.04, 0.06, 0.08, 0.1 ),
|
||||||
|
"transitions": PoolRealArray( 1, 1, 1, 1, 1, 1 ),
|
||||||
|
"update": 0,
|
||||||
|
"values": [ Vector2( 0, 0 ), Vector2( -1.5, -9 ), Vector2( 6.5, 2.5 ), Vector2( -11.5, 8.5 ), Vector2( 4, -5 ), Vector2( 0, 0 ) ]
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id=2]
|
||||||
|
resource_name = "walk"
|
||||||
|
length = 0.25
|
||||||
|
step = 0.05
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/path = NodePath("Pivot/Sprite:self_modulate")
|
||||||
|
tracks/0/interp = 1
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = false
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PoolRealArray( 0, 0.1, 0.25 ),
|
||||||
|
"transitions": PoolRealArray( 1, 1, 1 ),
|
||||||
|
"update": 0,
|
||||||
|
"values": [ Color( 1, 1, 1, 1 ), Color( 1, 0.9375, 0, 1 ), Color( 1, 1, 1, 1 ) ]
|
||||||
|
}
|
||||||
|
tracks/1/type = "value"
|
||||||
|
tracks/1/path = NodePath("Pivot/Sprite:position")
|
||||||
|
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.15, 0.25 ),
|
||||||
|
"transitions": PoolRealArray( 1, 0.303143, 2.61003, 1 ),
|
||||||
|
"update": 0,
|
||||||
|
"values": [ Vector2( 1.43051e-06, -1.90735e-06 ), Vector2( 1.43051e-06, -1.90735e-06 ), Vector2( 0, -20 ), Vector2( 1.43051e-06, -1.90735e-06 ) ]
|
||||||
|
}
|
||||||
|
tracks/2/type = "value"
|
||||||
|
tracks/2/path = NodePath("Pivot/Sprite:scale")
|
||||||
|
tracks/2/interp = 1
|
||||||
|
tracks/2/loop_wrap = true
|
||||||
|
tracks/2/imported = false
|
||||||
|
tracks/2/enabled = true
|
||||||
|
tracks/2/keys = {
|
||||||
|
"times": PoolRealArray( 0, 0.05, 0.15, 0.25 ),
|
||||||
|
"transitions": PoolRealArray( 1, 0.354553, 1, 1 ),
|
||||||
|
"update": 0,
|
||||||
|
"values": [ Vector2( 1, 1 ), Vector2( 1.20007, 0.917384 ), Vector2( 0.916712, 1.13495 ), Vector2( 1, 1 ) ]
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="Actor" type="Node2D"]
|
||||||
|
position = Vector2( 32, 32 )
|
||||||
|
z_index = 1
|
||||||
|
script = ExtResource( 1 )
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_group_": true
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||||
|
anims/bump = SubResource( 1 )
|
||||||
|
anims/walk = SubResource( 2 )
|
||||||
|
|
||||||
|
[node name="Tween" type="Tween" parent="."]
|
||||||
|
|
||||||
|
[node name="Pivot" type="Position2D" parent="."]
|
||||||
|
|
||||||
|
[node name="Sprite" type="Sprite" parent="Pivot"]
|
||||||
|
position = Vector2( 1.43051e-06, -1.90735e-06 )
|
||||||
|
texture = ExtResource( 2 )
|
||||||
|
centered = false
|
||||||
|
offset = Vector2( -32, -32 )
|
||||||
55
2d/grid_based_movement/pawns/actor.gd
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
extends "pawn.gd"
|
||||||
|
|
||||||
|
onready var grid = get_parent()
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
update_look_direction(Vector2.RIGHT)
|
||||||
|
|
||||||
|
|
||||||
|
func _process(_delta):
|
||||||
|
var input_direction = get_input_direction()
|
||||||
|
if not input_direction:
|
||||||
|
return
|
||||||
|
update_look_direction(input_direction)
|
||||||
|
|
||||||
|
var target_position = grid.request_move(self, input_direction)
|
||||||
|
if target_position:
|
||||||
|
move_to(target_position)
|
||||||
|
else:
|
||||||
|
bump()
|
||||||
|
|
||||||
|
|
||||||
|
func get_input_direction():
|
||||||
|
return Vector2(
|
||||||
|
Input.get_action_strength("move_right") - Input.get_action_strength("move_left"),
|
||||||
|
Input.get_action_strength("move_down") - Input.get_action_strength("move_up")
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
func update_look_direction(direction):
|
||||||
|
$Pivot/Sprite.rotation = direction.angle()
|
||||||
|
|
||||||
|
|
||||||
|
func move_to(target_position):
|
||||||
|
set_process(false)
|
||||||
|
$AnimationPlayer.play("walk")
|
||||||
|
|
||||||
|
# Move the node to the target cell instantly,
|
||||||
|
# and animate the sprite moving from the start to the target cell
|
||||||
|
var move_direction = (target_position - position).normalized()
|
||||||
|
$Tween.interpolate_property($Pivot, "position", - move_direction * 32, Vector2(), $AnimationPlayer.current_animation_length, Tween.TRANS_LINEAR, Tween.EASE_IN)
|
||||||
|
position = target_position
|
||||||
|
|
||||||
|
$Tween.start()
|
||||||
|
|
||||||
|
# Stop the function execution until the animation finished
|
||||||
|
yield($AnimationPlayer, "animation_finished")
|
||||||
|
|
||||||
|
set_process(true)
|
||||||
|
|
||||||
|
|
||||||
|
func bump():
|
||||||
|
set_process(false)
|
||||||
|
$AnimationPlayer.play("bump")
|
||||||
|
yield($AnimationPlayer, "animation_finished")
|
||||||
|
set_process(true)
|
||||||
5
2d/grid_based_movement/pawns/pawn.gd
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
extends Node2D
|
||||||
|
|
||||||
|
enum CellType { ACTOR, OBSTACLE, OBJECT }
|
||||||
|
#warning-ignore:unused_class_variable
|
||||||
|
export(CellType) var type = CellType.ACTOR
|
||||||
BIN
2d/grid_based_movement/pawns/sprites/character.png
Normal file
|
After Width: | Height: | Size: 899 B |
34
2d/grid_based_movement/pawns/sprites/character.png.import
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="StreamTexture"
|
||||||
|
path="res://.import/character.png-98ed16816c5b464731c4fa68fe5b8613.stex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://pawns/sprites/character.png"
|
||||||
|
dest_files=[ "res://.import/character.png-98ed16816c5b464731c4fa68fe5b8613.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
|
||||||
BIN
2d/grid_based_movement/pawns/sprites/character_grey.png
Normal file
|
After Width: | Height: | Size: 787 B |
@@ -0,0 +1,34 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="StreamTexture"
|
||||||
|
path="res://.import/character_grey.png-a95d64c2e947e85f04dd1c6474e46965.stex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://pawns/sprites/character_grey.png"
|
||||||
|
dest_files=[ "res://.import/character_grey.png-a95d64c2e947e85f04dd1c6474e46965.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
|
||||||
BIN
2d/grid_based_movement/pawns/sprites/star.png
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
@@ -2,15 +2,15 @@
|
|||||||
|
|
||||||
importer="texture"
|
importer="texture"
|
||||||
type="StreamTexture"
|
type="StreamTexture"
|
||||||
path="res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex"
|
path="res://.import/star.png-4f164f82cf41ace82182660f1be8e68d.stex"
|
||||||
metadata={
|
metadata={
|
||||||
"vram_texture": false
|
"vram_texture": false
|
||||||
}
|
}
|
||||||
|
|
||||||
[deps]
|
[deps]
|
||||||
|
|
||||||
source_file="res://icon.png"
|
source_file="res://pawns/sprites/star.png"
|
||||||
dest_files=[ "res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex" ]
|
dest_files=[ "res://.import/star.png-4f164f82cf41ace82182660f1be8e68d.stex" ]
|
||||||
|
|
||||||
[params]
|
[params]
|
||||||
|
|
||||||
@@ -10,49 +10,23 @@ config_version=4
|
|||||||
|
|
||||||
_global_script_classes=[ ]
|
_global_script_classes=[ ]
|
||||||
_global_script_class_icons={
|
_global_script_class_icons={
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[application]
|
[application]
|
||||||
|
|
||||||
config/name="3D Waypoints"
|
config/name="Grid Movement"
|
||||||
config/description="This is an example of displaying GUI elements such as Labels in a 3D world, without relying on viewports. This results in better readability and performance for use cases such as showing player names."
|
run/main_scene="res://Game.tscn"
|
||||||
run/main_scene="res://main.tscn"
|
|
||||||
config/icon="res://icon.png"
|
config/icon="res://icon.png"
|
||||||
|
|
||||||
[display]
|
[display]
|
||||||
|
|
||||||
|
window/size/width=1280
|
||||||
|
window/size/height=720
|
||||||
window/stretch/mode="2d"
|
window/stretch/mode="2d"
|
||||||
window/stretch/aspect="expand"
|
window/stretch/aspect="expand"
|
||||||
|
|
||||||
[input]
|
[input]
|
||||||
|
|
||||||
move_forward={
|
|
||||||
"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":87,"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":90,"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":16777232,"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_back={
|
|
||||||
"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":83,"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":16777234,"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.51,
|
|
||||||
"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":65,"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":81,"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":16777231,"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={
|
move_right={
|
||||||
"deadzone": 0.5,
|
"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":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":68,"unicode":0,"echo":false,"script":null)
|
||||||
@@ -61,17 +35,31 @@ move_right={
|
|||||||
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":0,"axis_value":1.0,"script":null)
|
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":0,"axis_value":1.0,"script":null)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
toggle_mouse_capture={
|
move_left={
|
||||||
"deadzone": 0.5,
|
"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":16777253,"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":65,"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":16777217,"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":16777231,"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_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":83,"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":16777234,"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_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":87,"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":16777232,"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)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
[rendering]
|
[rendering]
|
||||||
|
|
||||||
quality/driver/driver_name="GLES2"
|
|
||||||
vram_compression/import_etc=true
|
|
||||||
vram_compression/import_etc2=false
|
|
||||||
quality/filters/msaa=2
|
|
||||||
environment/default_environment="res://default_env.tres"
|
environment/default_environment="res://default_env.tres"
|
||||||
19
2d/grid_based_movement/tilesets/grid/GridTiles.tscn
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
[gd_scene load_steps=4 format=2]
|
||||||
|
|
||||||
|
[ext_resource path="res://tilesets/grid/actor.png" type="Texture" id=1]
|
||||||
|
[ext_resource path="res://tilesets/grid/obstacle.png" type="Texture" id=2]
|
||||||
|
[ext_resource path="res://tilesets/grid/object.png" type="Texture" id=3]
|
||||||
|
|
||||||
|
[node name="Node2D" type="Node2D"]
|
||||||
|
|
||||||
|
[node name="Actor" type="Sprite" parent="."]
|
||||||
|
position = Vector2( 32, 32 )
|
||||||
|
texture = ExtResource( 1 )
|
||||||
|
|
||||||
|
[node name="Obstacle" type="Sprite" parent="."]
|
||||||
|
position = Vector2( 96, 32 )
|
||||||
|
texture = ExtResource( 2 )
|
||||||
|
|
||||||
|
[node name="Object" type="Sprite" parent="."]
|
||||||
|
position = Vector2( 160, 32 )
|
||||||
|
texture = ExtResource( 3 )
|
||||||
BIN
2d/grid_based_movement/tilesets/grid/actor.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
@@ -2,15 +2,15 @@
|
|||||||
|
|
||||||
importer="texture"
|
importer="texture"
|
||||||
type="StreamTexture"
|
type="StreamTexture"
|
||||||
path="res://.import/godot.png-5e0da45ed3d6786d5794553e04f58a8c.stex"
|
path="res://.import/actor.png-6a88af8a7bcb079732153877dfb0db8b.stex"
|
||||||
metadata={
|
metadata={
|
||||||
"vram_texture": false
|
"vram_texture": false
|
||||||
}
|
}
|
||||||
|
|
||||||
[deps]
|
[deps]
|
||||||
|
|
||||||
source_file="res://godot.png"
|
source_file="res://tilesets/grid/actor.png"
|
||||||
dest_files=[ "res://.import/godot.png-5e0da45ed3d6786d5794553e04f58a8c.stex" ]
|
dest_files=[ "res://.import/actor.png-6a88af8a7bcb079732153877dfb0db8b.stex" ]
|
||||||
|
|
||||||
[params]
|
[params]
|
||||||
|
|
||||||
37
2d/grid_based_movement/tilesets/grid/grid_tileset.tres
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
[gd_resource type="TileSet" load_steps=4 format=2]
|
||||||
|
|
||||||
|
[ext_resource path="res://tilesets/grid/actor.png" type="Texture" id=1]
|
||||||
|
[ext_resource path="res://tilesets/grid/obstacle.png" type="Texture" id=2]
|
||||||
|
[ext_resource path="res://tilesets/grid/object.png" type="Texture" id=3]
|
||||||
|
|
||||||
|
[resource]
|
||||||
|
|
||||||
|
0/name = "Actor"
|
||||||
|
0/texture = ExtResource( 1 )
|
||||||
|
0/tex_offset = Vector2( 0, 0 )
|
||||||
|
0/modulate = Color( 1, 1, 1, 1 )
|
||||||
|
0/region = Rect2( 0, 0, 64, 64 )
|
||||||
|
0/is_autotile = false
|
||||||
|
0/occluder_offset = Vector2( 32, 32 )
|
||||||
|
0/navigation_offset = Vector2( 32, 32 )
|
||||||
|
0/shapes = [ ]
|
||||||
|
1/name = "Obstacle"
|
||||||
|
1/texture = ExtResource( 2 )
|
||||||
|
1/tex_offset = Vector2( 0, 0 )
|
||||||
|
1/modulate = Color( 1, 1, 1, 1 )
|
||||||
|
1/region = Rect2( 0, 0, 64, 64 )
|
||||||
|
1/is_autotile = false
|
||||||
|
1/occluder_offset = Vector2( 32, 32 )
|
||||||
|
1/navigation_offset = Vector2( 32, 32 )
|
||||||
|
1/shapes = [ ]
|
||||||
|
2/name = "Object"
|
||||||
|
2/texture = ExtResource( 3 )
|
||||||
|
2/tex_offset = Vector2( 0, 0 )
|
||||||
|
2/modulate = Color( 1, 1, 1, 1 )
|
||||||
|
2/region = Rect2( 0, 0, 64, 64 )
|
||||||
|
2/is_autotile = false
|
||||||
|
2/occluder_offset = Vector2( 32, 32 )
|
||||||
|
2/navigation_offset = Vector2( 32, 32 )
|
||||||
|
2/shapes = [ ]
|
||||||
|
_sections_unfolded = [ "0", "1" ]
|
||||||
|
|
||||||
BIN
2d/grid_based_movement/tilesets/grid/object.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
@@ -2,15 +2,15 @@
|
|||||||
|
|
||||||
importer="texture"
|
importer="texture"
|
||||||
type="StreamTexture"
|
type="StreamTexture"
|
||||||
path="res://.import/player.png-1ad27fc2a62fa126eae918723933dd6f.stex"
|
path="res://.import/object.png-3e89ebfb3424e8759914732b2b0130c1.stex"
|
||||||
metadata={
|
metadata={
|
||||||
"vram_texture": false
|
"vram_texture": false
|
||||||
}
|
}
|
||||||
|
|
||||||
[deps]
|
[deps]
|
||||||
|
|
||||||
source_file="res://player/player.png"
|
source_file="res://tilesets/grid/object.png"
|
||||||
dest_files=[ "res://.import/player.png-1ad27fc2a62fa126eae918723933dd6f.stex" ]
|
dest_files=[ "res://.import/object.png-3e89ebfb3424e8759914732b2b0130c1.stex" ]
|
||||||
|
|
||||||
[params]
|
[params]
|
||||||
|
|
||||||
BIN
2d/grid_based_movement/tilesets/grid/obstacle.png
Normal file
|
After Width: | Height: | Size: 522 B |
@@ -2,15 +2,15 @@
|
|||||||
|
|
||||||
importer="texture"
|
importer="texture"
|
||||||
type="StreamTexture"
|
type="StreamTexture"
|
||||||
path="res://.import/obstacle.png-06287f6b2d26dd03335fd87ab78c2cc2.stex"
|
path="res://.import/obstacle.png-9f01dd1d06d7b99515918b65b46bd6c1.stex"
|
||||||
metadata={
|
metadata={
|
||||||
"vram_texture": false
|
"vram_texture": false
|
||||||
}
|
}
|
||||||
|
|
||||||
[deps]
|
[deps]
|
||||||
|
|
||||||
source_file="res://level/obstacle.png"
|
source_file="res://tilesets/grid/obstacle.png"
|
||||||
dest_files=[ "res://.import/obstacle.png-06287f6b2d26dd03335fd87ab78c2cc2.stex" ]
|
dest_files=[ "res://.import/obstacle.png-9f01dd1d06d7b99515918b65b46bd6c1.stex" ]
|
||||||
|
|
||||||
[params]
|
[params]
|
||||||
|
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
[gd_scene load_steps=2 format=2]
|
||||||
|
|
||||||
|
[ext_resource path="res://tilesets/grid_lines/grid_lines.png" type="Texture" id=1]
|
||||||
|
|
||||||
|
[node name="TileSet" type="Node2D"]
|
||||||
|
|
||||||
|
[node name="Grass" type="Sprite" parent="."]
|
||||||
|
position = Vector2( 32, 32 )
|
||||||
|
texture = ExtResource( 1 )
|
||||||
BIN
2d/grid_based_movement/tilesets/grid_lines/grid_lines.png
Normal file
|
After Width: | Height: | Size: 530 B |
@@ -0,0 +1,34 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="StreamTexture"
|
||||||
|
path="res://.import/grid_lines.png-beef853b47aa830c8383e5f6cc4d03ce.stex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://tilesets/grid_lines/grid_lines.png"
|
||||||
|
dest_files=[ "res://.import/grid_lines.png-beef853b47aa830c8383e5f6cc4d03ce.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
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
[gd_resource type="TileSet" load_steps=2 format=2]
|
||||||
|
|
||||||
|
[ext_resource path="res://tilesets/grid_lines/grid_lines.png" type="Texture" id=1]
|
||||||
|
|
||||||
|
[resource]
|
||||||
|
|
||||||
|
0/name = "Grass"
|
||||||
|
0/texture = ExtResource( 1 )
|
||||||
|
0/tex_offset = Vector2( 0, 0 )
|
||||||
|
0/modulate = Color( 1, 1, 1, 1 )
|
||||||
|
0/region = Rect2( 0, 0, 64, 64 )
|
||||||
|
0/is_autotile = false
|
||||||
|
0/occluder_offset = Vector2( 32, 32 )
|
||||||
|
0/navigation_offset = Vector2( 32, 32 )
|
||||||
|
0/shapes = [ ]
|
||||||
|
|
||||||