Compare commits

..

187 Commits
4.2 ... master

Author SHA1 Message Date
Hugo Locurcio
b509950099 Update web exports to Godot 4.5.1 (#1290) 2025-12-30 19:53:58 -08:00
Hugo Locurcio
db745e5e59 Add SMAA option to the 3D antialiasing and graphics settings demos (#1278)
- Rename various labels for readability.
- Use infinity symbol when FPS limit is set to 0.
- Use lossless compression for ship textures since they are low-resolution,
  and applied to a large object (making VRAM compression look bad).
2025-11-26 10:37:17 -08:00
Hugo Locurcio
ecbb2ee713 Use skybox in Platformer 3D demo to improve sky quality (#1282)
- Restore support for multiple aspect ratios which was inadvertently
  removed in a previous PR.
- Fix corner fix preview incorrectly using VRAM compression (it's
  low-resolution, and only displayed in the editor anyway).
2025-11-26 08:26:46 -08:00
Dmitry
bf544aefd9 Improve user experience: Add movement on the Y-axis, Show FPS. List options backwards (#1283)
Co-authored-by: Hugo Locurcio <hugo.locurcio@hugo.pro>
2025-11-26 08:18:40 -08:00
dependabot[bot]
156044e6dd Bump actions/checkout from 5 to 6 (#1281)
Bumps [actions/checkout](https://github.com/actions/checkout) from 5 to 6.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v5...v6)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-11-20 11:24:41 -08:00
Hugo Locurcio
245cbfc66a Revert engine version to 4.5 for demos with upgraded TileMapLayer
The demos still work on 4.5.1.stable, so there's no need to increase
the project version.
2025-11-06 20:02:28 +01:00
staruwos
a90d9d8c9a Update TileMap nodes to TileMapLayer in various demos (#1276) 2025-11-06 20:00:30 +01:00
Hugo Locurcio
51fadd795c Link C# version in Squash the Creeps demo README (#1274)
- Also add a link the other way around (from the C# version
  to the GDScript version) to match Dodge the Creeps.
- Use GitHub admonition syntax.
2025-11-06 17:31:21 +01:00
Aaron Franke
6a0325b0b8 Fix URLs and remove --base from Lychee CI workflow 2025-11-03 22:34:09 -08:00
Marcus Ilgner
41171d85d4 Update isometric dungeon to 4.3+ TileMapLayer (#1268)
After opening the isometric dungeon demo, there was a warning about TileMap
having been deprecated so I updated it to use the new TileMapLayer instead.
2025-11-03 18:43:32 +01:00
Hugo Locurcio
6adcbc912e Fix animations not looping and player materials in 3D Platformer demo (#1266)
- Use Forward+ renderer as intended
  (the project was accidentally changed to Mobile in a recent commit).
2025-10-20 21:27:25 -07:00
Aaron Franke
8a582321ae Skip Shadertoy in Lychee URL checks (#1267) 2025-10-20 16:02:04 -07:00
Aaron Franke
520b4a7870 Improve style in many demos (#1263) 2025-10-11 05:03:59 -07:00
Aaron Franke
0ae09b7e5a Overhaul silly material creator plugin demo (#1261) 2025-10-11 03:22:04 -07:00
A Thousand Ships
0343cedd48 General proofreading (#1262)
* General proofreading for grammar and spelling
* General formatting
* Addition of appropriate literals where appropriate, i.e. `&"foo"` for `StringName` cases and `^"foo/bar"` for `NodePath` cases
2025-10-11 01:39:59 -07:00
Vissa
a01005f397 Add Multiple Windows Demo (#1103) 2025-10-08 15:00:22 -07:00
Šarūnas Ramonas
7d73b8c4cb Refactor Material Creator Plugin Demo to use custom resource-based data (#1219) 2025-10-07 16:02:21 -07:00
Aaron Franke
217436bce6 Merge pull request #1168 from rburing/webxr_demo
Add WebXR demo
2025-10-07 14:36:03 -07:00
Aaron Franke
7c6cd796d7 Style and type safety fixes 2025-10-07 14:17:42 -07:00
Ricardo Buring
a2e97c0a25 Add WebXR demo
Based on https://docs.godotengine.org/en/stable/classes/class_webxrinterface.html
and https://www.snopekgames.com/tutorial/2023/how-make-vr-game-webxr-godot-4

Co-Authored-By: David Snopek <dsnopek@gmail.com>
2025-10-04 12:52:41 +02:00
Aaron Franke
14fcc0e133 Update all demo projects for Godot 4.5 and use path-deterministic UIDs (#1258) 2025-10-03 16:22:39 -07:00
Aaron Franke
de00da353c Remove schedule from Check URLs action
This is going to create lots of noise, especially in forks... how about let's not spam this action every day.
2025-10-03 12:49:32 -07:00
Ruben Garcia
656595a6d2 Update README.md - Indicate demo obsolete for godot 4.3+ (#1204) 2025-10-02 19:38:25 -07:00
captain-redbeard
588c1cd257 Add Squash the Creeps 3D C# demo for Godot mono (#1001) 2025-10-02 19:35:12 -07:00
Bastiaan Olij
082cb16072 Add XR demo for binding modifier logic (#1137) 2025-10-02 18:35:37 -07:00
Aaron Franke
3088473167 Simplify list of branches in the README (#1255) 2025-10-02 15:08:21 -07:00
Mikael Hermansson
d7b6f86b0b Switch back to Jolt Physics in Voxel demo (#1257) 2025-10-02 14:35:34 -07:00
dependabot[bot]
7d5f9269ca Bump actions/checkout from 4 to 5 (#1256)
Bumps [actions/checkout](https://github.com/actions/checkout) from 4 to 5.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-10-02 13:18:15 -07:00
Aaron Franke
94d3d40d70 Make Voxel demo player responsive without using unrealistic gravity (#1253) 2025-10-02 11:00:01 -07:00
Shahriar Labib
84ac7b40a6 Add touch screen support for 3d/platformer (#1128)
Update touch_screen_ui.gd
2025-10-02 10:47:00 -07:00
Hugo Locurcio
af2b9b1f30 Add a 3D sky shaders demo (#809)
This uses https://github.com/Rytelier/godot-sky-and-volumetric-clouds
as a base, with several changes made:

- Spheres are now used to represent radiance map reflections of varying
  roughness and metallic values.
- A day/night cycle is now featured.
- Mipmaps are enabled on the weather texture as an optimization.
- The default radiance map settings are more conservative to account
  for the real-time sky shader.
  - This makes reflections lower quality, but it's not too noticeable
    in most real world scenes (especially if using GI techniques for reflections).
- Debanding is now applied in the project settings, rather than on the sky shader.
  This is significantly faster (over 0.1 ms saved on a RX 6900 XT in 3840×2160).
  It also has the benefit of working on materials, which can exhibit banding
  if not textured.
  - The sky shader has debanding commented out in case it's needed.
    This debanding also applies to the lower half of the sky as well in this case,
    as it was required to get rid of noticeable banding on the lower half.
- Cloud coverage and density uniform hints now allow values as low as 0.001.

Co-authored-by: Rytelier <45795134+Rytelier@users.noreply.github.com>
Co-authored-by: Clay John <claynjohn@gmail.com>
2025-10-02 10:44:01 -07:00
Hugo Locurcio
6424e02ebf Add fallbacks and mention non-working features when using Compatibility or the Web platform (#1132)
- Make 3D lights with shadows darker when using Compatibility to better
  match the appearance of Forward+/Mobile, due to the use of sRGB blending
  for those lights.
- Silence some warnings when running projects with the Compatibility
  rendering method, such as the one about 2D MSAA not being supported.
- Rebake lightmaps in Global Illumination to improve quality and reduce
  light leaking with improvements from 4.3.
  - Increase probe density for dynamic objects, and mark the moving box
    as a dynamic object for GI purposes.

This is done to improve the experience with the web-based demos,
which always run with the Compatibility rendering method.
2025-10-02 10:31:42 -07:00
Hugo Locurcio
a5bce2f144 Fix bright streaks in tunnel in Platformer 3D demo (#1254)
This adjusts reflection probes following the blend distance changes
in 4.4.
2025-10-02 10:15:15 -07:00
Hugo Locurcio
a0f59648f2 GitHub Actions: Check URLs using lychee (#1169)
This makes it possible to be aware of dead links and replace
them with other resources (such as archived versions) as
soon as possible.
2025-10-02 00:33:27 -07:00
Hugo Locurcio
57daa67c23 Fix look_at_from_position() usage in Squash the Creeps (3D) (#1165)
The mob's orientation was previously shifted according to the player's
height, which could lead to collision and movement issues that were
difficult to diagnose.
2025-10-02 00:14:08 -07:00
Bastiaan Olij
711822a319 Modify shader example to show using built-in includes (#1086) 2025-10-02 00:04:11 -07:00
Markus Sauermann
10eb2807b8 Add Split Screen Demo showing input handling (#1023)
* Add Split Screen Demo showing input handling

* Style fixes, layout improvements, update to Godot 4.5

---------

Co-authored-by: Aaron Franke <arnfranke@yahoo.com>
2025-10-01 22:56:48 -07:00
Allyson Chan
0cff177d59 Updated Multiplayer Pong C# to Godot 4.2 (#1045) 2025-10-01 22:12:04 -07:00
Hugo Locurcio
05aeb11de9 Add a 3D visibility ranges (HLOD) demo (#860) 2025-10-01 21:47:36 -07:00
Yaxian
1d8fa9c44d Add player_state dictionary to manage player state names for FSM demo (#1143)
* Add player_state dictionary to manage player state names for FSM demo

* Use a constant typed Dictionary of StringNames and update to Godot 4.5

---------

Co-authored-by: Aaron Franke <arnfranke@yahoo.com>
2025-10-01 21:33:27 -07:00
MJacred
69b317692e Fix content_scale_* updates: properties are in Window not (Sub-)Viewport (#1184)
While the demo seems to work, the editor won't allow the user to jump to the docs when using Ctrl+LMB
2025-10-01 21:09:48 -07:00
Hugo Locurcio
649360f17e Fix FPS-dependent movement in Navigation AStar demo (#1227)
Previously, the way in which the spaceship steered depended
on the rendered framerate.

This moves ship movement to the physics step to avoid this, and
enables physics interpolation for smooth motion.
2025-10-01 19:55:07 -07:00
Hugo Locurcio
a5f9289d13 Fix tickrate-dependent physics in Voxel demo (#1224)
Fix mouse sensitivity being dependent on window size by using `InputEventMouseMotion.screen_relative`.
2025-10-01 19:44:48 -07:00
Hugo Locurcio
5f4a9e409f Use InputEventMouseMotion.screen_relative where relevant in all demos (#1232)
This provides mouse sensitivity that is independent of the viewport
size, without needing to query for project settings.

This also inverts the mouse motion direction in the 3D navigation demo
to better match expectations, and increases mouse sensitivity in the
Window Management demo to be closer to other demos.
2025-10-01 18:54:19 -07:00
bruvzg
bdc33d1568 Add basic accessibility features demo. (#1238) 2025-10-01 18:41:42 -07:00
Hugo Locurcio
dc4abff7d0 Use GodotPhysics3D in Voxel demo to work around performance issue (#1252)
This avoids stuttering during world generation due to mutating
compound shapes being slow in Jolt Physics.

This is especially noticeable in the Flat Grass world due to
the higher number of voxels being generated.
2025-10-01 16:01:17 -07:00
Hugo Locurcio
a64cebdf7a Fix physics joint warning in Truck Town when using tow truck (#1251)
Following the switch to Jolt Physics, 3 warnings were printed every
time you selected the tow truck in Truck Town, as custom joint bias is not supported.

This reverts 3 of the joints to use the default bias, which appears to
have no negative impact on behavior on either Jolt Physics or GodotPhysics3D.
2025-10-01 11:02:59 -07:00
Hugo Locurcio
efb56dcee4 Add a 3D ragdoll physics demo (#1234) 2025-09-30 13:05:04 -07:00
Hugo Locurcio
0540894062 Add a 3D soft body physics demo (#1228) 2025-09-30 11:16:47 -07:00
Aaron Franke
49718c4b16 Merge pull request #1223 from Calinou/add-3d-physics-interpolation-demo
Add 3D physics interpolation demo
2025-09-30 09:37:52 -07:00
lawnjelly
c70741bac0 Add 3D physics interpolation demo
Demonstrate first person shooter and third person shooter cameras.
2025-09-30 18:14:22 +02:00
Lukas Tenbrink
78c04bbd28 Migrate contributing guidelines to the contributing docs (#1246) 2025-09-30 08:43:17 -07:00
Hugo Locurcio
9fb7d5d211 Add a custom logging demo (#1242)
This demo showcases a custom logger implementation, which runs in parallel
to the built-in logging facilities (including file logging). The custom logger
displays all messages printed by the engine in an in-game console.
2025-09-26 23:11:38 +02:00
Hugo Locurcio
84eabb3cf7 Add .clang-format and use it to format shader files (#1249) 2025-09-22 16:15:54 +02:00
David Briscoe
aecf661c9c Fix and improve Role Playing Game: Gamepad, TileMapLayer, upgrade for 4.4.1 (#1248)
* Improve gamepad behaviour in rpg

Fix gamepad can't do dialogue.
Fix character often plays bump animation with gamepad when there's no
obstacles around.

Add gamepad A to ui_accept so gamepads can press buttons in dialogue and
combat.

Use get_vector so we get an automatic deadzone on our input.

Round our input direction so we don't pass Vector2i(0,0) to
request_move, get denied, and then do a bump animation.

* Use SpriteFrames instead of animating texture

Seems like Godot 4 doesn't allow toggling AnimationPlayer tracks by
making children editable so the texture is no longer being set and the
player is invisible. Regardless, this workflow is also not scalable to
multiple enemy types. Instead, use SpriteFrames to setup different
visuals for each slime.

Triggers animations from code alongside AnimationPlayer calls because
doing it in AnimationPlayer seemed unnecessarily complex.

* Give all slimes a common base class

Split player input handling from walker to allow both slimes to use the
same visual setup. In a real game, you'd want this kind of setup so
enemies are able to walk on the grid too.

Remove unused actor.gd -- looks like this was an early version of
walker.gd.

Setup opponent slime as type=Actor because otherwise you can't fight
them.

* Convert TileMap to TileMapLayer

Used "Extract TileMap layers as individual TileMapLayer nodes" in the
TileMap editor and removed the 0 layer argument from functions in
grid.gd

* Explain and rename facing direction node

When I first started looking into the character, I couldn't figure out
what this play button texture was for. After experimenting, it might be
an old version of the character visuals or a demo to show how to make
your character rotate.

* Fade to black between scenes

Fix blue screen when entering combat.

Our fade ColorRect was hidden so it never displayed. We removed the
exploration scene before fading so the fade started with an empty scene
with a blue skybox.

* Loop idle animation in combat

Add AnimationTree to combat character setup so we can tell when the
take_damage animation completes. This was harder than expected because
by default Godot modulates to black and sets scale to 0 unless you
specify otherwise with the RESET animation.

* Add a CanvasLayer above each clickable Control root

Fix mouse can't click buttons.

Seems like we're not able to click buttons in Godot 4 without a
CanvasLayer root. Adding that makes it work, but required some
restructuring to point at the correct node. In cases like combat+ui,
change it to emit a signal to use the "call down, signal up" pattern.

* Remove error comment that no longer occurs

Neither winning nor fleeing triggers this warning on Godot
v4.4.1.stable.official [49a5bc7b6].

* Rename parent -> grid

Make it clearer that the parent of the player and other pawns is
expected to be our Grid class.
2025-09-16 15:42:25 +02:00
0x1hue
b45ef5497b Fix uniform sets in Compute Texture demo (#1247)
- Move texture references into separate vars for clarity.

This fixes compatibility with 4.5 while preserving compatibility with 4.4.1.
2025-09-14 01:35:59 +02:00
Aaron Franke
2fc0497915 Merge pull request #1237 from godotengine/dependabot/github_actions/actions/checkout-5
Bump actions/checkout from 4 to 5
2025-08-11 21:51:41 -07:00
dependabot[bot]
d588eb58ce Bump actions/checkout from 4 to 5
Bumps [actions/checkout](https://github.com/actions/checkout) from 4 to 5.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-08-12 02:09:28 +00:00
Christen Lofland
bf4d1038d6 Minor spelling fixes in strings, comments and non-code files. (#1236)
Co-authored-by: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com>
2025-08-04 17:19:57 -07:00
Wilson Enrique Alvarez Torres
48aaefbf12 Simplify mesh custom drawing demo (#1231)
Co-authored-by: Hugo Locurcio <hugo.locurcio@hugo.pro>
2025-07-22 02:52:01 +02:00
Switchbreak
ba8718ed09 Fix "Parse message failed" error in WebRTC Signaling Demo Project (#1209) 2025-07-18 16:36:02 +02:00
Matthew
219eeacced Merge pull request #1218 from BastiaanOlij/openxr_render_models_demo
Added an OpenXR render models demo
2025-07-14 15:59:26 -04:00
Matthew
28e2fc1f15 Merge pull request #1229 from Calinou/control-gallery-add-foldablecontainer
Add FoldableContainer to the Control Gallery demo
2025-07-13 08:32:49 -04:00
Bastiaan Olij
d438fcc8d6 Added an OpenXR render models demo 2025-07-11 12:57:44 +10:00
Hugo Locurcio
7d525f4c9b Add FoldableContainer to the Control Gallery demo
This bumps the demo requirement to Godot 4.5, as FoldableContainer
is only present in 4.5 and later.
2025-07-08 01:04:55 +02:00
Simon Ruderich
89b2660d69 Migrate Navigation AStar demo to TileMapLayer and perform various cleanups (#1208)
* navigation_astar: replace deprecated TileMap with TileMapLayer

* navigation_astar: use get_used_cells() instead of iterating over region

This also removes the confusing use of Tile.OBSTACLE. The tile enum is
mostly used for atlas coordinates but in this case it is compared with
the source id which only happens to be zero as well.

* navigation_astar: use constants for atlas coordinates

This makes it more obvious how to set cells in larger tilesets where the
second position is not zero.

It also removes the constant OBSTACLE which is unused since the last
commit.

* navigation_astar: mention get_used_rect()

Using it in this example is more complex (as the border has no cells)
but it's good to know.
2025-06-30 18:09:02 +02:00
smix8
9acb5528b6 Update NavigationChunk demos (#1221)
Updates NavigationChunk demos for `NavigationMeshSourceGeometryData2D.get_bounds()`
function and new NavigationAgent no post-processing option.
2025-06-25 19:21:12 +02:00
Sebastian Javier D'Alessandro Szymanowski
1280ef63e7 Fix project main scene path in Pong demos (#1217)
Signed-off-by: Sebastian Javier D'Alessandro Szymanowski <sdalessandro@fi.uba.ar>
2025-06-25 19:09:48 +02:00
Aaron Franke
0d6b7722c0 Merge pull request #1098 from BastiaanOlij/openxr_hand_tracking_demo_settings
Updated hand tracking demo based on Godot changes in PR 95153
2025-06-24 03:29:37 -05:00
Bastiaan Olij
dbe9f48dcc Updated OpenXR hand tracking demo based on Godot changes in PR 95153 2025-06-24 11:45:33 +10:00
Rémi Verschelde
8be477ce38 Merge pull request #1212 from BastiaanOlij/mobile_vr_interface_demo
Simple demo for Mobile VR Interface
2025-06-21 11:43:49 +02:00
Bastiaan Olij
16f4b10bc6 Simple demo for Mobile VR Interface 2025-06-19 15:01:40 +10:00
Rémi Verschelde
1cd5f27f8e Merge pull request #1211 from Calinou/move-compute-shader-heightmap-demo
Move Compute Shader Heightmap demo to the `compute/` folder
2025-06-09 16:55:12 +02:00
Hugo Locurcio
da2f21baac Move Compute Shader Heightmap demo to the compute/ folder
- Use GitHub admonition syntax in its README.
2025-06-09 16:31:35 +02:00
Hugo Locurcio
c97a648356 Improve Run-time File Saving and Loading demo (#1196)
- Add runtime MP3 and WAV loading with example files.
- Add runtime FBX loading (but no example files, due to known issues with
  the current FBX runtime loading implementation).
- Use supersampling for the 3D preview to further improve quality.
- Shorten file path to example glTF scene.
- Mention audio duration in the UI when loading an audio file.
2025-05-30 20:13:31 +02:00
Hugo Locurcio
f78efc69ee Add a custom drawing in 2D demo (#1185) 2025-05-30 17:29:06 +02:00
Hugo Locurcio
dc3670e25a Add a 3D tonemapping and color correction demo (#857)
This showcases various tonemapping operators and their interaction
with several color correction textures (1D and 3D).

A script generating neutral 3D LUT textures is also included.

Co-authored-by: Allen Pestaluky <allenpestaluky@gmail.com>
2025-05-30 16:08:51 +02:00
Varga
a445398c60 Add an audio effects demo (#1201)
Co-authored-by: dkleitsas <86194775+dkleitsas@users.noreply.github.com>
Co-authored-by: Hugo Locurcio <hugo.locurcio@hugo.pro>
2025-05-29 02:43:03 +02:00
K. S. Ernest (iFire) Lee
3ced51c91c Merge pull request #1183 from BastiaanOlij/openxr_hand_fallback_modifier
OpenXR: Added a fallback modifier implementation
2025-05-27 22:33:28 -07:00
K. S. Ernest (iFire) Lee
1f58baa94c Merge pull request #1197 from PizzaLovers007/rhythm-game
Add a simple rhythm game demo
2025-05-22 14:15:54 -07:00
Alex
6a2de9c3ee Disable GitHub Actions export_web workflow in forks (#1205) 2025-05-19 01:44:35 +02:00
PizzaLovers007
be7a046c1e Add a simple rhythm game demo 2025-05-17 16:55:21 -05:00
Varga
ba2755359d Fix nonexistent function error in Multiplayer Bomber demo (#1202) 2025-05-08 00:19:16 +02:00
Hugo Locurcio
2d64c95990 Update 3D Sprites screenshot to match the recent bugfix 2025-04-28 16:05:47 +02:00
Tianle
9456158841 Fix the bug of shader effect (#1198)
The normal was not calculated correctly

Remove extra parenthesis
2025-04-24 10:06:53 -07:00
Tianle
90f309174d Add Sprite3D and AnimatedSprite3D demo (#1191) 2025-04-24 17:45:14 +02:00
Hugo Locurcio
a531235db3 Use Jolt Physics in all 3D demos that use physics, improve physics tests demos (#1195)
- Add options for physics ticks per second, time scale, max physics steps per frame
  and physics interpolation to the 2D and 3D physics tests demos.
  - Physics ticks per second are always multiplied by time scale so that
    time scale does not affect the physics simulation quality.
- Enable 4× MSAA for better debug shape display. Remove meshes/lights as
  the debug collision fill make these unnecessary.
  - Switch to the Mobile rendering method in the 2D physics tests demo
    to allow for 2D MSAA, as it's not implemented in Compatibility yet.
- Improve collision shapes color in the 2D and 3D physics tests demos
  for better visibility. Each PhysicsBody type now has its own collision
  shape color.
2025-04-21 21:59:31 +02:00
Bastiaan Olij
debdec8469 OpenXR: Added a fallback modifier implementation to the hand tracking demo, if hand tracking is not available 2025-04-21 13:17:21 +10:00
Hugo Locurcio
819d201cc4 Enable physics interpolation in all 3D demos (#1074)
This makes use of the new built-in 3D physics interpolation
added in Godot 4.4.
2025-04-15 16:54:41 +02:00
Hugo Locurcio
a88ca219b8 Add block placement preview to Voxel demo, improve debug display (#1190)
- Allow placing/breaking blocks when further away (up to 5 blocks instead of 4).
- Add a background to the debug display to improve readability on bright backgrounds.
- Simplify coordinate display using the `%v` placeholder available in 4.3 onwards.
2025-04-15 16:53:12 +02:00
Hugo Locurcio
c05d05009b Improve flat terrain generation in the Voxel demo (#1189)
This adds 2 layers of dirt below the grass layer and a layer of indestructible
bedrock below it so you can't fall off the world.
2025-04-15 15:03:12 +02:00
Hugo Locurcio
b06917acaa Fix incorrect class_name declaration in 2D physics tests demo (#1188) 2025-04-14 22:51:18 +02:00
Mikael Hermansson
9db52662cb Change physics joint tests to freeze bodies as kinematic in the Physics tests demos (#1177) 2025-04-14 18:58:55 +02:00
Hugo Locurcio
7befd7c718 Enable physics interpolation in all 2D demos (#1070)
This makes uses of the new built-in 2D physics interpolation
added in 4.3.

For 3D demos, a separate PR requiring `master` will be made later.
2025-04-14 18:58:38 +02:00
Hugo Locurcio
90617ba1e8 Fix camera colliding with the player in 3D platformer demo (#1187)
This was most common at low physics tick rates like 20 TPS.

This also fixes an issue with the RigidBody character demo having
movement speed depending on the physics tick rate.
2025-04-14 17:05:50 +02:00
Aaron Franke
f7a1433739 Fix pick block in Voxel demo 2025-04-13 04:57:12 -07:00
J.M. de Jong
d21c03d09c Remove broken int type check in WebRTC Signaling demo (#1186)
JSON.parse_string() parses all numbers as floats, even if there are no decimals.
`str(JSON.parse_string('{"type": 3}').asdf)` would result in `"3.0"`, which is not a valid int.
Because of this, the demo is not working.
2025-04-06 23:15:48 +02:00
Aaron Franke
d169ec17e2 Fix block face checks and explicitly define normals in voxel demo (#1182) 2025-04-02 08:41:10 -07:00
Aaron Franke
fad2469531 Merge pull request #1179 from Calinou/update-for-4.4
Update demos for Godot 4.4
2025-03-20 20:43:57 -05:00
Hugo Locurcio
4d49bbd1b8 Update demos for Godot 4.4
- Resave all files with Godot 4.4 to make use of script/shader UIDs.
- Use AgX tonemapping in all demos that used a tonemapper other than Linear.
2025-03-21 02:00:41 +01:00
utsav132
5557b10cfa Fix mob playback animation being started before the animation is set in Dodge the Creeps (#1175)
The '$AnimatedSprite2D.play()' is called at the beginning in the '_ready' function,
when it should actually be called at the end, after selecting the animation.
2025-03-07 19:43:58 +01:00
Hugo Locurcio
fdb2f50a20 Add a graphics tablet input demo (#1162) 2025-02-10 18:17:34 +01:00
Jason Yundt
0d46333c4e Update Platformer 2D to Godot 4.3 (#1145)
* Update Platformer 2D to Godot v4.3

Before this change, if you tries to import the Platformer 2D project
using Godot v4.3 (the latest stable version of Godot, at the moment),
you would get the following warning:

> Warning: This project was last edited in Godot 4.2.
> Opening will change it to Godot 4.3.
>
> Open anyway? Project will be modified.

This change updates the project to Godot 4.3 so that that warning no
longer appears. When you upgrade to a newer version of Godot, sometimes
certain files will automatically be updated by the Godot Editor after
the upgrade has been completed. Specifically, the files won’t get
updated until after they’re opened in the Godot Editor. When creating
this commit, I tried to open every single file for Platformer 2D in the
Godot Editor to make sure that all of those automatic changes are
included in this commit.

* Replace Platformer2D’s TileMap with a TileMapLayer

Before this change, the Platformer 2D used a TileMap Node. TileMaps are
deprecated. TileMapLayers should be used instead [1].

[1]: <https://docs.godotengine.org/en/4.3/classes/class_tilemap.html#tilemap>
2025-02-06 15:23:15 +01:00
Hugo Locurcio
c3b0331d8a Fix invalid icon reference in C# Android IAP demo (#1159) 2025-01-21 02:39:47 +01:00
Wayne Mwashuma
0e24c8eb2e Update to TileMapLayer in Multiplayer Bomber demo (#1155) 2025-01-10 22:39:38 +01:00
Mohamed Koubaa
be77353917 Move position setting code to be before direction in Dodge the Creeps (#1151) 2025-01-10 19:52:54 +01:00
Fabio Alessandrelli
d3c71ddb20 Fix typo in WebSocketServer class name (#1154) 2025-01-10 19:51:29 +01:00
David Briscoe
c49e134e13 Explain how to setup GUI in 3D (#1149)
Make it more obvious to newcomers how this demo works so they can
replicate it in their projects.

Change the text to point to how this is working.

Add Editor Descriptions to make it clearer how this is setup.

Co-authored-by: Aaron Franke <arnfranke@yahoo.com>
2024-12-23 18:55:20 +01:00
Jorrit Rouwe
81249b3f4a Increase Jolt Physics limit settings so performance tests run without errors (#1146) 2024-12-13 16:39:29 +01:00
Aaron Franke
51a7d389af Merge pull request #1138 from Calinou/truck-town-add-moods
Add moods (times of day) to Truck Town demo
2024-11-25 12:05:53 -08:00
Hugo Locurcio
5f0e0ce205 Improve GUI in 3D demo (#1140)
- Increase physics ticks per second to 120, so that UI interactions feel
  smoother and have lower input lag. This happens since input is governed
  by the physics tick due to the use of physics picking.
- Add a placeholder to the LineEdit and select a default option in the OptionButton.
2024-11-25 12:04:29 -08:00
Markus Sauermann
6f44371df1 Fix physics picking in Gui in 3D Demo (#1139)
Physics picking requires that the SubViewport has a consistent state
of the mouse-enter/exit notifications.

Godot V4.3 was changed in comparison to V4.2, so that it now requires
this additional step.

Co-authored-by: Hugo Locurcio <hugo.locurcio@hugo.pro>
Co-authored-by: Aaron Franke <arnfranke@yahoo.com>
2024-11-25 18:38:26 +01:00
Hugo Locurcio
15bcb941de Add moods (times of day) to Truck Town demo
Four moods are available: sunrise, day, sunset, night. Sunset and night
also feature artificial point lights placed in the town scene.

The mood can be set on the main menu before playing. It can also be cycled
during gameplay by pressing M or D-Pad Down.
2024-11-25 18:35:05 +01:00
Aaron Franke
5d9542113a Improve Truck Town model, fix issues, use OMI glTF Physics (#1110) 2024-11-25 06:56:02 -08:00
smix8
0fb1b4e09c Update 2D navigation demo NavigationPolygon for 4.3+ (#1135)
Updates NavigationPolygon with data that has compatibility with newer 2D navigation mesh baking.
2024-11-17 00:32:38 +01:00
Yaxian
1e02914267 Use TileMapLayer in Dynamic TileMap Layers (#1133)
TileMap is deprecated in 4.3 as TileMapLayer supersedes it.

Co-authored-by: Hugo Locurcio <hugo.locurcio@hugo.pro>
2024-11-15 19:04:15 +01:00
Bastiaan Olij
6db1062768 Fix recenter code in OpenXR Character Centric Movement (#1131)
Co-authored-by: Hugo Locurcio <hugo.locurcio@hugo.pro>
Co-authored-by: Aaron Franke <arnfranke@yahoo.com>
2024-11-15 19:03:19 +01:00
Hugo Locurcio
adf6d7e08d Disable non-functional XR demos in web exports (#1130)
These demos could work if they are redesigned to account for WebXR's
limitations when running on the web platform.
2024-11-08 11:33:19 +01:00
Danil Alexeev
c492e5fd73 Update some GDScript files for Godot 4.3 (#1129) 2024-11-04 12:00:59 +01:00
Hugo Locurcio
7ed5b1c116 Update web demo exports for Godot 4.3 (#1127)
This comes with other improvements:

- Demos now work on desktop and mobile browsers, as ETC2 import is now
  automatically enabled before exporting each demo.
- Progressive web app is available for each project.
  - Can be added to the home screen on a device for a closer-to-native experience.
  - Cross-origin isolation headers are automatically added, so that the export
    works with threads enabled despite being hosted on GitHub Pages
    (which doesn't send these headers).

Several demos will need further tweaks to look better when using
the Compatibility rendering method. Currently, many 3D demos appear
too bright due to lights with shadows enabled using sRGB blending.

Also, many demos will need to be modified to indicate which parts
of them are not supported when running on the web platform, or
when using the Compatibility rendering method.
2024-10-30 17:13:23 +01:00
Hugo Locurcio
53d3f9cdde Improve Operating System Testing demo (#1124)
- Display more return values of Engine/OS methods such as system fonts,
  memory information and security information.
- Add headless support (the generated report is also printed to stdout).
- Improve theming in the generated report.
- Hide video adapter type if this information can't be queried in the
  current rendering method.
- Update C# script for Godot 4.x platform names.
2024-10-23 23:09:23 +02:00
Hugo Locurcio
edccce8563 Fix normal map direction in 2D Lights and Shadows (#1123)
- Group Light2D nodes for easier dragging in the editor.
2024-10-18 23:30:07 +02:00
Raymond DiDonato
a87fded4cf Fix VRAM leak in compositor effect demo (#1115) 2024-09-17 01:36:20 +02:00
Montandalar
fdae025495 Add full license information for Voxel demo textures (#1113) 2024-09-15 15:04:34 +02:00
Tyler Breisacher
fa6061c623 Add static types in 2D Navigation AStar demo (#1008) 2024-08-31 03:48:17 +02:00
Ryhon
8ab921d5b4 Add FSR 2.2, exclusive fullscreen and ultra SSAO/SSIL to 3D Graphics Settings demo 2024-08-31 03:21:22 +02:00
shahriarlabib000
723331f814 updated README and Screenshots (#1111) 2024-08-28 18:09:22 -07:00
JavierStark
71630e80e4 Fix updated Android IAP project in c# (#1105)
* Update project to 4.3

Co-authored-by: Hugo Locurcio <hugo.locurcio@hugo.pro>
2024-08-28 16:58:41 -07:00
Aaron Franke
5646c6a7a8 Open and save 3D demos in Godot 4.3 stable (#1109) 2024-08-27 13:40:06 -07:00
Hugo Locurcio
582229e17c Improve Material Testers demo project (#1068)
- Add reflection probes for each test sphere, which can be toggled using
  a new dropdown with 3 options (no reflection probe, reflection only,
  reflection + ambient). The cull and reflection masks are configured
  on each reflection probe so that spheres don't self-reflect, but other
  spheres still appear in each sphere's reflections. Probe extents are made
  very large to prevent any visible fading, and the test beds don't
  receive the reflection probe's ambient or reflection.
- Improve ice material visuals by giving it some opacity.
- Use lossless compression on all textures, as their relatively low
  resolution and count by today's standards makes them not use much VRAM
  anyway.
2024-08-27 05:32:12 -07:00
Christen Lofland
7e2a55aa07 3D Inverse Kinematics Godot 4 Conversion (Partial) (#1036)
* These changes allow the project to start and run in Godot 4.2

I hit some of the files with my formatter, if whitespace updates are not wanted I can remove those.
The project doesn't entirely work yet, but it runs. I am still working on making it work properly fully, but at least it starts now instead of crashing.

* Center text to match Godot 3 example better.
2024-08-27 05:13:54 -07:00
shahriarlabib000
b05fb07d77 updated meshes to obj instead of res (#1107) 2024-08-27 05:06:22 -07:00
Mikael Hermansson
7e60538469 Change semi-truck in Truck Town demo to use 6DOF joint (#1102) 2024-08-27 04:31:10 -07:00
shahriarlabib000
9f59648c26 Update robot mesh for Godot 4 in 3D in 2D demo (#1106) 2024-08-26 00:07:36 +02:00
JavierStark
13b2787173 Update Android IAP in C# project to Godot 4.3 (#1104)
Co-authored-by: Hugo Locurcio <hugo.locurcio@hugo.pro>
2024-08-23 04:00:10 +02:00
Rémi Verschelde
6c635fe75a Merge pull request #1080 from BastiaanOlij/openxr_composition_layers
OpenXR composition layer example
2024-08-22 07:35:28 +02:00
Zi Fan
6d5ded3c7d Fix incorrect asset library link in 3D Lights and Shadows README (#1100) 2024-08-11 02:15:38 +02:00
smix8
cbb68060c6 Add navigation mesh chunks demos (#1099)
Adds 2D and 3D demo project for how to bake navigation meshes for large world chunk systems.
2024-08-08 17:22:47 +02:00
esainane
0fba875c72 Fix theme properties in various demos (#1097)
3.x -> 4.x:
`font_color_shadow` -> `font_shadow_color`
`font_color_selected` -> `font_selected_color`
`hseparation` -> `h_separation`
`vseparation` -> `v_separation`
`shadow_as_outline` -> `shadow_outline_size`

`panelf` and `panelnc` were removed in 3.2, as the options were never used.
See: godotengine/godot#28639

`font_color_shadow` is not a property of ProgressBar's theme, and there
doesn't seem to be an equivalent. The term "shadow" does not appear in any of:
{scene/{gui/{progress_bar,range,control},main/{canvas_item,node}},core/object/object}.{cpp,h}
2024-08-02 03:01:04 -07:00
Bastiaan Olij
98899881e7 OpenXR composition layer example 2024-07-31 15:44:50 +10:00
Fabio Alessandrelli
8fd41702c6 Fix typing errors in webrtc_signaling demo (#1096) 2024-07-28 01:35:33 +02:00
Russell Sanborn
34d174e315 Add JetBrains IDE files to .gitignore (#1094)
For reference, this exists in other godotengine repositories. Examples:

* https://github.com/godotengine/godot/blob/master/.gitignore#L157
* https://github.com/godotengine/godot-docs/blob/master/.gitignore#L52
2024-07-26 17:44:57 +02:00
Rémi Verschelde
3265d3fcd4 Merge pull request #1082 from Calinou/add-2d-polygons-lines-demo-4.x
Add a 2D polygons and lines demo
2024-07-25 13:31:10 +02:00
Russell Sanborn
7d42ae3c9a Rename Dodge The Creeps files to snake case (#1084)
This follows the style guide:

- https://docs.godotengine.org/en/stable/tutorials/best_practices/project_organization.html#style-guide

For reference, a documentation PR exists to update references to the
demo.
2024-07-15 00:36:11 +02:00
Matthew
e6fcf24f89 Merge pull request #973 from BastiaanOlij/openxr_hand_tracking_demo
Add OpenXR hand tracking demo
2024-07-13 15:04:58 -04:00
Hugo Locurcio
16d8ba09fb Replace instances of KinematicBody with CharacteBody in READMEs
KinematicBody was replaced by CharacterBody in Godot 4.0.

This also adds the 3D suffix to 3D physics classes.
2024-07-12 23:06:00 +02:00
Hugo Locurcio
7223aec001 Fix incorrect static typing in 2.5D demo 2024-07-03 17:18:29 +02:00
Hugo Locurcio
0ec2fff5bf Fix incorrect typed Array assignment in XR demo scripts (#1081) 2024-06-26 17:20:58 +02:00
Hugo Locurcio
78bbd99f0d Add a 2D polygons and lines demo 2024-06-25 18:09:34 +02:00
ShatteredReality
b4c73f4888 Fix README links to asset library (#1078)
This updates all links to point to the 4.2 demos instead of the 3.5 ones.

Co-authored-by: A Thousand Ships (she/her) <96648715+AThousandShips@users.noreply.github.com>
2024-06-24 19:29:58 +02:00
Bastiaan Olij
677dc46eeb Add OpenXR hand tracking demo 2024-06-15 14:04:49 +10:00
Hugo Locurcio
fbb7cb442c Fix ball speedup logic in Pong demo (#1073) 2024-06-13 12:31:10 +02:00
Bastiaan Olij
909331ac51 Add Compositor Effects (Post-Processing) demo (#1058)
Co-authored-by: Hugo Locurcio <hugo.locurcio@hugo.pro>
2024-06-07 22:19:25 +02:00
Hugo Locurcio
785e3213d5 Use higher shadow filtering quality settings in 3D demos (#1067)
The 3D demos aren't very demanding and Godot has been optimized
a bit since 4.0's release, so we can afford using higher quality
shadow settings for less noisy shadow filtering.

This also tweaks shadow bias to reduce shadow acne in the Voxel demo.

The time slider in the Physical Light and Camera units demo now
allows for more precise adjustments.
2024-06-06 22:11:18 +02:00
Hugo Locurcio
fad6cc2e1b Add turbulence example to 3D Particles demo (#1066)
- Make the attractor in the example dynamic to better showcase its functionality,
  and add a visual representation to it.
- Tweak the appearance of attracted particles.
- Fix force field particle display (it wasn't using Local Coords as intended).
- Lower the sun angle to make the background darker (and particles easier to see).
2024-06-06 22:07:00 +02:00
Hugo Locurcio
9a0c857131 Fix incorrect class_name declarations being swapped with extends
This was caused by an automatic text replacement issue.
2024-06-03 20:13:55 +02:00
Hugo Locurcio
bac1e69164 Use static typing in all demos (#1063)
This leads to code that is easier to understand and runs
faster thanks to GDScript's typed instructions.

The untyped declaration warning is now enabled on all projects
where type hints were added. All projects currently run without
any untyped declration warnings.

Dodge the Creeps and Squash the Creeps demos intentionally don't
use type hints to match the documentation, where type hints haven't
been adopted yet (given its beginner focus).
2024-06-01 12:12:18 +02:00
Sectonidse
8e9c180278 Use match case instead of if else in Audio Mic Record demo (#1053)
* Use match case instead of if else

This is my first pull request.

* Apply suggestions from code review

---------

Co-authored-by: Hugo Locurcio <hugo.locurcio@hugo.pro>
2024-05-13 19:57:04 +02:00
Christen Lofland
3859c66f0e Remove modulate/albedo mix changes from Distance Fade example in Decals (#1054) 2024-05-13 19:50:07 +02:00
Tarik Belabbas
9a5176e430 Fixed minor Godot 3 bit in "gui_in_3d" demo's billboard specific code (#1052) 2024-05-06 23:04:36 -07:00
谢天
95cfb076d1 Add missing tags to several demos (#1048) 2024-04-18 22:24:47 +02:00
Colter
9043224bb2 Fix upward movement key to be W in Multiplayer Bomber (#1049)
It was accidentally set to Z instead.
2024-04-18 22:23:59 +02:00
Lisandro Lorea
01db4a6f99 Fix joypad demo for Godot 4.x (#943) 2024-04-13 14:50:02 -07:00
Bastiaan Olij
035e905a3e XR demos: Add check for VRS/foveation in start vr script, and enable foveation in project settings (#1022)
Co-authored-by: Aaron Franke <arnfranke@yahoo.com>
2024-04-12 14:16:23 -07:00
Christen Lofland
b2ed2d6f6d Remove tiles outside of texture to elliminate these errors on loading the project: (#1035)
```
ERROR: Cannot create tile. The tile is outside the texture or tiles are already present in the space the tile would cover.
   at: (scene\resources\2d\tile_set.cpp:4963)
ERROR: The TileSetAtlasSource atlas has no tile at (1, 0).
   at: (scene\resources\2d\tile_set.cpp:5400)
ERROR: TileSetAtlasSource has no tile at (1, 0).
   at: (scene\resources\2d\tile_set.cpp:5348)
```
2024-04-12 14:16:04 -07:00
captain-redbeard
fbef18f58b Updated Dodge the Creeps C# to Godot mono 4.2 (#1000)
Co-authored-by: Ivan Shakhov <van800@gmail.com>
Co-authored-by: Aaron Franke <arnfranke@yahoo.com>
2024-04-12 00:56:02 -07:00
Hugo Locurcio
4f866f2a9a Add doors as an example of dynamic occluders in the Occlusion culling demo (#807)
The occluders don't actually move, but are toggled when the door starts
opening and finishes closing to avoid unnecessary BVH rebuilds.
2024-04-11 21:07:55 -07:00
Muller-Castro
af93126e05 Fix missing baked_exposure (#1043) 2024-04-11 20:57:52 -07:00
Hugo Locurcio
5bda007763 Update GUI Translation demo for 4.0 (#930)
- Add PO support in addition to CSV.

Co-authored-by: SkyJJ <jjchai01@hotmail.com>
2024-04-11 20:55:49 -07:00
Christen Lofland
f70868ce22 Use @onready to init previous_position to prevent errors (#1042) 2024-04-11 20:36:15 -07:00
Aaron Franke
6e44341d67 Merge pull request #1041 from chrisl8/2.5d-editor-view-update
Update 2.5D GDScript demo to display the editor plugin in Godot 4.
2024-04-11 20:33:37 -07:00
Aaron Franke
3788da41cd Fix 2.5D editor viewport and gizmo for Godot 4.x 2024-04-11 20:30:58 -07:00
Aaron Franke
57c1cb9ffa More tweaks to the 2.5D demo for Godot 4.x 2024-04-11 13:50:34 -07:00
Christen Lofland
85b8f10778 Prefer using guard clauses as suggested by aaronfranke. 2024-04-10 16:33:46 -05:00
Christen Lofland
0a35055aa0 Undue some formatting changes that were in dispute. 2024-04-10 16:31:51 -05:00
Christen Lofland
3ef6a15741 Update 2.5D GDScript demo to display the editor plugin in Godot 4. 2024-04-10 11:52:08 -05:00
Christen Lofland
d190e73ad3 Only print MIDI device list if any are found in MIDI Piano (#1039)
This is a silly "fix", but it prevents an empty `[]` from being printed every time
this demo is run without a MIDI device plugged into the computer.

The MIDI devices list is printed if one is plugged into the computer, which I have tested.
2024-04-10 01:30:09 +02:00
Clay John
79d30931c3 Switch to single safe threaded model in TextureRD demo (#1038)
Multithreaded rendering is not safe in 4.2, so it should not be used
in our official demos for now.
2024-04-09 02:09:27 +02:00
iltenahmet
56f103953d Update dodge-the-creeps asset library link (#1034) 2024-04-03 15:32:10 -07:00
Christen Lofland
be7be4c1cc Disable 2D MSAA in Dynamic TileMap Layers to avoid warning on start (#1030)
The demo uses the Compatibility rendering method, which currently
doesn't support 2D MSAA.
2024-04-02 03:19:56 +02:00
Christen Lofland
5553ecfd88 Fix font code for Godot 4 in Finite State Machine (#1027)
This clears out some errors that happen on every load of this demo in Godot 4 onward.
It also makes the fonts actually work, as they did not before.

We probably don't strictly **need** these font settings for a demo, but they were here before.

I don't think `SourceCodePro-Black.ttf` was ever used, based on looking at history. So I removed it.

Both `.tres` files are gone too, as those are not used in Godot 4.

I have updated everything that used `SourceCodePro-Bold.ttf` to the new setup.
2024-04-02 01:52:04 +02:00
Christen Lofland
ab9ffb7558 Fix font setup in Dodge the Creeps (#1026) 2024-04-02 01:50:12 +02:00
谢天
c181965682 Fix incorrect toggle_mouse_capture key in Global Illumination (#1029) 2024-04-02 01:21:01 +02:00
Hugo Locurcio
31d1c0c112 Remove old and unused project settings, update various demos for 4.2 (#1024)
- Move all demo projects that don't require Forward+/Mobile-only features
  to the Compatibility rendering method. This improves performance significantly
  on low-end devices and ensures visuals are identical to a web export
  of the demo.
- Set deadzone on all inputs to 0.2 for better gamepad usability.
- Remove reliance on `default_env.tres` to use built-in Environment
  resources in the main scene instead (which follows the preview environment
  workflow).
- Remove notices pointing to GDNative or VisualScript, since both were
  removed in 4.0.
- Various bug fixes and usability tweaks to 10+ demos.
2024-03-26 18:01:58 +01:00
A Thousand Ships
82913393a8 Improve code style (#1021)
* Remove unnecessary use of `self`
* Connect to signals directly over `connect("name")`
* Use `call_deferred` on callables over `call_deferred("name"))`
* Emit signals directly over `emit_signal("name"...)`
2024-03-25 17:06:52 +01:00
behrooz bozorgchamy
523c7d34c0 Update Pong with C# to Godot 4.2.1 (#966) 2024-03-25 16:25:51 +01:00
Hugo Locurcio
71eea49eba Fix player and mob animations not looping in Squash the Creeps (#1020)
This was missed in the upgrade to 4.0, which reset loop mode properties
in Animation.
2024-03-06 23:08:05 +01:00
2921 changed files with 58040 additions and 20855 deletions

21
.clang-format Normal file
View File

@@ -0,0 +1,21 @@
BasedOnStyle: LLVM
AlignAfterOpenBracket: DontAlign
AlignOperands: DontAlign
AlignTrailingComments:
Kind: Never
OverEmptyLines: 0
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortFunctionsOnASingleLine: Inline
BreakConstructorInitializers: AfterColon
ColumnLimit: 0
ContinuationIndentWidth: 8
IndentCaseLabels: true
IndentWidth: 4
InsertBraces: true
KeepEmptyLinesAtTheStartOfBlocks: false
RemoveSemicolon: true
SpacesInLineCommentPrefix:
Minimum: 0 # We want a minimum of 1 for comments, but allow 0 for disabled code.
Maximum: -1
TabWidth: 4
UseTab: Always

View File

@@ -1,23 +1,41 @@
[preset.0]
name="HTML5"
platform="HTML5"
name="Web"
platform="Web"
runnable=true
advanced_options=false
dedicated_server=false
custom_features=""
export_filter="all_resources"
include_filter="*.json"
include_filter=""
exclude_filter=""
export_path=""
script_export_mode=1
script_encryption_key=""
encryption_include_filters=""
encryption_exclude_filters=""
encrypt_pck=false
encrypt_directory=false
script_export_mode=2
[preset.0.options]
custom_template/debug=""
custom_template/release=""
variant/export_type=0
variant/extensions_support=false
variant/thread_support=true
vram_texture_compression/for_desktop=true
vram_texture_compression/for_mobile=false
vram_texture_compression/for_mobile=true
html/export_icon=true
html/custom_html_shell=""
html/head_include=""
html/full_window_size=true
html/canvas_resize_policy=2
html/focus_canvas_on_start=true
html/experimental_virtual_keyboard=true
progressive_web_app/enabled=true
progressive_web_app/ensure_cross_origin_isolation_headers=true
progressive_web_app/offline_page=""
progressive_web_app/display=0
progressive_web_app/orientation=1
progressive_web_app/icon_144x144=""
progressive_web_app/icon_180x180=""
progressive_web_app/icon_512x512=""
progressive_web_app/background_color=Color(0, 0, 0, 1)

View File

@@ -1,20 +1,38 @@
<!-- 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 class="unsupported-demos">
<li><code>2d/glow</code>: Not supported on the Compatibility rendering method (which the web platform always uses).</li>
<li><code>2d/navigation_mesh_chunks</code>: Relies on debug-only drawing functionality which is not available in projects exported in release mode.</li>
<li><code>2d/physics_tests</code>: Relies on debug-only drawing functionality which is not available in projects exported in release mode.</li>
<li><code>3d/labels_and_texts</code>: Does not export in headless mode due to an engine bug (font importing infinite loop).</li>
<li><code>3d/decals</code>: Not supported on the Compatibility rendering method (which the web platform always uses).</li>
<li><code>3d/ik</code>: Demo is not fully ported to Godot 4 yet (even though the feature works on the web).</li>
<li><code>3d/navigation_mesh_chunks</code>: Relies on debug-only drawing functionality which is not available in projects exported in release mode.</li>
<li><code>3d/occlusion_culling_mesh_lod</code>: Occlusion culling is disabled by default in web builds to decrease binary size.</li>
<li><code>3d/particles</code>: Demo mostly showcases features that are not available in Compatibility (which the web platform always uses).</li>
<li><code>3d/physical_light_camera_units</code>: Demo is not tuned for the Compatibility rendering method (which the web platform always uses).</li>
<li><code>3d/physics_tests</code>: Relies on debug-only drawing functionality which is not available in projects exported in release mode.</li>
<li><code>3d/variable_rate_shading</code>: Not supported on the Compatibility rendering method (which the web platform always uses)</li>
<li><code>3d/volumetric_fog</code>: Not supported on the Compatibility rendering method (which the web platform always uses)</li>
<li><code>3d/voxel</code>: Freezes after a few seconds of gameplay due to web platform-specific threading issues.</li>
<li><code>audio/bpm_sync</code>: Not functional on the web platform due to differences in the audio playback implementation.</li>
<li><code>audio/device_changer</code>: Not relevant for the web platform, as the web browser always chooses the audio output device.</li>
<li><code>audio/midi_piano</code>: Not functional on the web platform due to differences in the audio playback implementation.</li>
<li><code>audio/spectrum</code>: Not functional on the web platform due to differences in the audio playback implementation.</li>
<li><code>compute/*</code>: Not supported on the Compatibility rendering method (which the web platform always uses).</li>
<li><code>gui/msdf_font</code>: Does not export in headless mode due to an engine bug (font importing crashes).</li>
<li><code>gui/translation</code>: Does not export in headless mode due to an engine bug (font importing crashes).</li>
<li><code>loading/runtime_save_load</code>: Native filesystem access is not available on the web platform.</li>
<li><code>misc/compute_shader_heightmap</code>: Not supported on the Compatibility rendering method (which the web platform always uses).</li>
<li><code>misc/large_world_coordinates</code>: Not supported on the Compatibility rendering method (which the web platform always uses).</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 the web platform.</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>
<li><code>xr/openxr_*</code>: Not functional on the web platform, as these demos are not designed for WebXR.</li>
</ul>
</body>
</html>

View File

@@ -4,13 +4,15 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Godot demos exported to HTML5</title>
<title>Official Godot demos exported to Web</title>
<style>
:root {
--background-color: #fff;
--text-color: #222;
--link-color: hsl(220, 100%, 45%);
--link-visited-color: hsl(270, 100%, 55%);
--link-underline-color: hsla(220, 100%, 45%, 0.3);
--link-underline-visited-color: hsla(270, 100%, 45%, 0.3);
}
@media (prefers-color-scheme: dark) {
@@ -18,7 +20,9 @@
--background-color: #222;
--text-color: #eee;
--link-color: hsl(200, 100%, 70%);
--link-visited-color: hsl(250, 100%, 80%);
--link-underline-color: hsla(200, 100%, 70%, 0.3);
--link-underline-visited-color: hsla(250, 100%, 70%, 0.3);
}
}
@@ -52,6 +56,11 @@
text-decoration-thickness: 0.125rem;
}
a:visited {
color: var(--link-visited-color);
text-decoration-color: var(--link-visited-color);
}
a:hover {
filter: brightness(117.5%);
}
@@ -88,6 +97,9 @@
margin: 20px 10px;
}
.unsupported-demos li {
margin-bottom: 1.5rem;
}
</style>
</head>
@@ -96,21 +108,21 @@
<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
exported to the web 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,
The web exports on this page are provided for demonstration purposes only.
Some of these demos may not function or render correctly on the web platform,
especially on mobile devices.
For best performance, it's recommended to
<a href="https://godotengine.org/download">download</a> a native editor
<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.
<a href="https://docs.godotengine.org/en/stable/tutorials/export/exporting_for_web.html">Exporting for the Web</a>
documentation for information on exporting your own projects to the web.
</p>
<h2>List of demos</h2>

28
.github/workflows/check_urls.yml vendored Normal file
View File

@@ -0,0 +1,28 @@
name: 🌐 Check URLs
on: [push, pull_request]
jobs:
check-urls:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v6
- name: Restore lychee cache
uses: actions/cache@v4
with:
path: .lycheecache
key: cache-lychee-${{ github.sha }}
restore-keys: cache-lychee-
- name: Run lychee
uses: lycheeverse/lychee-action@v2
with:
args: >
--no-progress
--cache
--max-cache-age 1d
"**/*.md" "**/*.gd" "**/*.cs" "**/*.tscn" "**/*.tres" "**/*.html"
- name: Fail if there were link errors
run: exit ${{ steps.lc.outputs.exit_code }}

128
.github/workflows/export_web.yml vendored Normal file
View File

@@ -0,0 +1,128 @@
name: Export projects to Web and deploy to GitHub Pages
on:
push:
branches:
- master
env:
GODOT_VERSION: 4.5.1
jobs:
export-html5:
if: github.repository == 'godotengine/godot-demo-projects'
name: Export projects to Web and deploy to GitHub Pages
runs-on: ubuntu-24.04
container:
image: barichello/godot-ci:4.5.1
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup
run: |
mkdir -p ~/.local/share/godot/export_templates/
mv /root/.local/share/godot/export_templates/$GODOT_VERSION.stable ~/.local/share/godot/export_templates/$GODOT_VERSION.stable
- name: Export projects to Web
run: |
apt-get update -qq && apt-get install -qqq imagemagick
# Don't export Mono demos (not supported yet), demos that can't be run in Web
# since they're platform-specific or demos that are currently broken in Web.
# Remember to update `.github/dist/footer.html` when updating the list of excluded demos.
rm -rf \
2d/glow/ \
2d/navigation_mesh_chunks/ \
2d/physics_tests/ \
3d/labels_and_texts/ \
3d/decals/ \
3d/ik/ \
3d/navigation_mesh_chunks/ \
3d/occlusion_culling_mesh_lod/ \
3d/particles/ \
3d/physical_light_camera_units/ \
3d/physics_tests/ \
3d/variable_rate_shading/ \
3d/volumetric_fog/ \
3d/voxel/ \
audio/bpm_sync/ \
audio/device_changer/ \
audio/midi_piano/ \
audio/spectrum/ \
compute/ \
gui/msdf_font/ \
gui/translation/ \
loading/runtime_save_load \
misc/compute_shader_heightmap \
misc/large_world_coordinates/ \
misc/matrix_transform/ \
mobile/android_iap/ \
mobile/sensors/ \
mono/ \
networking/ \
plugins/ \
xr/openxr_character_centric_movement \
xr/openxr_composition_layers \
xr/openxr_hand_tracking_demo \
xr/openxr_origin_centric_movement
for panorama in 3d/material_testers/backgrounds/*.hdr; do
# Decrease the resolution to get below the 100 MB PCK size limit.
# Otherwise, the website can't be deployed as files larger than 100 MB
# can't be pushed to GitHub.
mogrify -resize 66.667% "$panorama"
done
BASEDIR="$PWD"
# Use absolute paths so that we can `cd` without having to go back to the parent directory manually.
for demo in */*/; do
echo ""
echo ""
echo "================================================================================"
echo "Exporting demo $demo..."
echo "================================================================================"
mkdir -p "$BASEDIR/.github/dist/$demo"
cd "$BASEDIR/$demo"
# Copy an export template preset file configured for Web exporting.
# This way, we don't have to commit `export_presets.cfg` for each project.
cp "$BASEDIR/.github/dist/export_presets.cfg" .
# Enable ETC2 texture importing, which is disabled by default (but required for web exports to work on mobile platforms).
echo "[rendering]\n\ntextures/vram_compression/import_etc2_astc=true" >> project.godot
# Enable WebXR Polyfill and WebXR Layers Polyfill for the WebXR demo.
if [ "$demo" == "xr/webxr/" ]; then
sed -i 's~^html/head_include=""$~html/head_include="<script src=\\"https://cdn.jsdelivr.net/npm/webxr-polyfill@latest/build/webxr-polyfill.min.js\\"></script>\n<script>\nvar polyfill = new WebXRPolyfill();\n</script>\n<script src=\\"https://cdn.jsdelivr.net/npm/webxr-layers-polyfill@latest/build/webxr-layers-polyfill.min.js\\"></script>\n<script>\nvar layersPolyfill = new WebXRLayersPolyfill();\n</script>"~g' export_presets.cfg
fi
godot --verbose --headless --export-release "Web" "$BASEDIR/.github/dist/$demo/index.html"
# Replace the WASM file with a symbolic link to avoid duplicating files in the pushed branch.
# (WASM files are identical across projects, but not PCK or HTML/JavaScript files.)
mv -f "$BASEDIR/.github/dist/$demo/index.wasm" "$BASEDIR/.github/dist/index.wasm"
# The symlink must be relative as it needs to point to a file within the pushed repository.
ln -s "../../index.wasm" "$BASEDIR/.github/dist/$demo/index.wasm"
# Append the demo to the list of demos for the website.
PROJECT_NAME=$(cat project.godot | grep "config/name" | cut -d '"' -f 2 | tr -d "\n")
echo "<li><a href='$demo'><img width="64" height="64" src="$demo/index.icon.png" alt=""><p>$PROJECT_NAME</p></a></li>" >> "$BASEDIR/.github/dist/demos.html"
done
cat "$BASEDIR/.github/dist/header.html" "$BASEDIR/.github/dist/demos.html" "$BASEDIR/.github/dist/footer.html" > "$BASEDIR/.github/dist/index.html"
# Clean up files that don't need to be deployed.
rm -f "$BASEDIR/.github/dist/header.html" "$BASEDIR/.github/dist/demos.html" "$BASEDIR/.github/dist/footer.html" "$BASEDIR/.github/dist/export_presets.cfg"
# Installing rsync is needed in order to deploy to GitHub Pages. Without it, the build will fail.
- name: Install rsync 📚
run: |
apt-get update -qq && apt-get install -qqq rsync
- name: Deploy to GitHub Pages 🚀
uses: JamesIves/github-pages-deploy-action@releases/v4
with:
# The folder the action should deploy.
folder: .github/dist
# Artifacts are large; don't keep the branch's history.
single-commit: true

View File

@@ -7,7 +7,7 @@ jobs:
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v5
uses: actions/checkout@v6
- name: Install dependencies
run: |

6
.gitignore vendored
View File

@@ -21,3 +21,9 @@ mono_crash.*.json
.DS_Store
*~
*.blend1
# Jetbrains IDE files
.idea/
# Ignore addon plugins
3d/sprite3d/addons

31
.lycheeignore Normal file
View File

@@ -0,0 +1,31 @@
# Don't read Godot's own URL schemes as web URLs.
user:\/\/.*
res:\/\/.*
uid:\/\/.*
# Don't read WebSockets or TCP URLs as web URLs.
ws(s?):\/\/.*
tcp:\/\/.*
# Security checks prevent checking the URLs of these websites automatically,
# typically returning 403 errors.
.*asecuritysite\.com.*
.*intel\.com.*
.*reddit\.com.*
# Don't check URLs from these websites due to frequent rate limits (error 429) or timeouts.
.*adobe\.com.*
.*gamedevartisan\.com.*
.*github\.com.*
.*gnu\.org.*
.*loopit\.dk.*
.*meta\.com.*
.*shadertoy\.com.*
.*sourceforge\.io.*
# Not a valid URL with the GET method, which lychee always sends.
# Mentioned in the class reference.
.*httpbin\.org\/post
# Class reference mentions `example.com/index.php` in an example, which is 404.
.*example\.com.*

View File

@@ -3,6 +3,6 @@
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)
[Godot shader language](https://docs.godotengine.org/en/latest/tutorials/shaders/shader_reference/shading_language.html)
Renderers: 4 of them are GLES 3, but most are GLES 2
Renderers: Glow for 2D and Physics Platformer use Forward+, 2D Particles uses Mobile, and the rest use Compatibility

View File

@@ -9,9 +9,9 @@ in the documentation for more information.
Language: GDScript
Renderer: Vulkan Mobile
Renderer: Compatibility
Check out this demo on the asset library: https://godotengine.org/asset-library/asset/887
Check out this demo on the asset library: https://godotengine.org/asset-library/asset/2711
## Screenshots

View File

@@ -2,7 +2,7 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://bcoiuym4nw1ua"
uid="uid://b1yd0wl8kt2i7"
path="res://.godot/imported/bullet.png-ff1424653e10246c11e3724e402c519e.ctex"
metadata={
"vram_texture": false
@@ -18,6 +18,8 @@ dest_files=["res://.godot/imported/bullet.png-ff1424653e10246c11e3724e402c519e.c
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
@@ -25,6 +27,10 @@ mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false

View File

@@ -1,5 +1,5 @@
extends Node2D
# This demo is an example of controling a high number of 2D objects with logic
# This demo is an example of controlling 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.
@@ -8,28 +8,28 @@ const BULLET_COUNT = 500
const SPEED_MIN = 20
const SPEED_MAX = 80
const bullet_image = preload("res://bullet.png")
const bullet_image := preload("res://bullet.png")
var bullets := []
var shape
var shape := RID()
class Bullet:
var position = Vector2()
var speed = 1.0
# The body is stored as a RID, which is an "opaque" way to access resources.
var position := Vector2()
var speed := 1.0
# The body is stored as an 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()
var body := RID()
func _ready():
func _ready() -> void:
shape = PhysicsServer2D.circle_shape_create()
# Set the collision shape's radius for each bullet in pixels.
PhysicsServer2D.shape_set_data(shape, 8)
for _i in BULLET_COUNT:
var bullet = Bullet.new()
var bullet := Bullet.new()
# Give each bullet its own random speed.
bullet.speed = randf_range(SPEED_MIN, SPEED_MAX)
bullet.body = PhysicsServer2D.body_create()
@@ -42,25 +42,25 @@ func _ready():
# Place bullets randomly on the viewport and move bullets outside the
# play area so that they fade in nicely.
bullet.position = Vector2(
randf_range(0, get_viewport_rect().size.x) + get_viewport_rect().size.x,
randf_range(0, get_viewport_rect().size.y)
)
var transform2d = Transform2D()
randf_range(0, get_viewport_rect().size.x) + get_viewport_rect().size.x,
randf_range(0, get_viewport_rect().size.y)
)
var transform2d := Transform2D()
transform2d.origin = bullet.position
PhysicsServer2D.body_set_state(bullet.body, PhysicsServer2D.BODY_STATE_TRANSFORM, transform2d)
bullets.push_back(bullet)
func _process(_delta):
func _process(_delta: float) -> void:
# Order the CanvasItem to update every frame.
queue_redraw()
func _physics_process(delta):
var transform2d = Transform2D()
var offset = get_viewport_rect().size.x + 16
for bullet in bullets:
func _physics_process(delta: float) -> void:
var transform2d := Transform2D()
var offset := get_viewport_rect().size.x + 16
for bullet: Bullet in bullets:
bullet.position.x -= bullet.speed * delta
if bullet.position.x < -16:
@@ -73,15 +73,15 @@ func _physics_process(delta):
# 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:
func _draw() -> void:
var offset := -bullet_image.get_size() * 0.5
for bullet: 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:
func _exit_tree() -> void:
for bullet: Bullet in bullets:
PhysicsServer2D.free_rid(bullet.body)
PhysicsServer2D.free_rid(shape)

View File

@@ -0,0 +1 @@
uid://e3fsq0i746o1

View File

@@ -2,7 +2,7 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://d3u7k0742d5ug"
uid="uid://c33jd3nwdqtb4"
path="res://.godot/imported/face_happy.png-38d387d31ec13459f749c93ce3d75d80.ctex"
metadata={
"vram_texture": false
@@ -18,6 +18,8 @@ dest_files=["res://.godot/imported/face_happy.png-38d387d31ec13459f749c93ce3d75d
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
@@ -25,6 +27,10 @@ mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false

View File

@@ -2,7 +2,7 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://8j32onnr4qo3"
uid="uid://b63ok8dbyysfs"
path="res://.godot/imported/face_sad.png-0ac7165eab24f595aba17a746a66c550.ctex"
metadata={
"vram_texture": false
@@ -18,6 +18,8 @@ dest_files=["res://.godot/imported/face_sad.png-0ac7165eab24f595aba17a746a66c550
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
@@ -25,6 +27,10 @@ mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false

View File

@@ -2,7 +2,7 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://brwp8bimc75uu"
uid="uid://44incao8gryo"
path="res://.godot/imported/icon.webp-e94f9a68b0f625a567a797079e4d325f.ctex"
metadata={
"vram_texture": false
@@ -18,6 +18,8 @@ dest_files=["res://.godot/imported/icon.webp-e94f9a68b0f625a567a797079e4d325f.ct
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
@@ -25,6 +27,10 @@ mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false

View File

@@ -1,35 +1,35 @@
extends Node2D
# This demo is an example of controling a high number of 2D objects with logic
# This demo is an example of controlling 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
## The number of bullets currently touched by the player.
var touching: int = 0
@onready var sprite = $AnimatedSprite2D
@onready var sprite: AnimatedSprite2D = $AnimatedSprite2D
func _ready():
func _ready() -> void:
# 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):
func _input(input_event: InputEvent) -> void:
# Getting the movement of the mouse so the sprite can follow its position.
if event is InputEventMouseMotion:
position = event.position - Vector2(0, 16)
if input_event is InputEventMouseMotion:
position = input_event.position - Vector2(0, 16)
func _on_body_shape_entered(_body_id, _body, _body_shape, _local_shape):
func _on_body_shape_entered(_body_id: RID, _body: Node2D, _body_shape_index: int, _local_shape_index: int) -> void:
# Player got touched by a bullet so sprite changes to sad face.
touching += 1
if touching >= 1:
sprite.frame = 1
func _on_body_shape_exited(_body_id, _body, _body_shape, _local_shape):
func _on_body_shape_exited(_body_id: RID, _body: Node2D, _body_shape_index: int, _local_shape_index: int) -> void:
touching -= 1
# When non of the bullets are touching the player,
# sprite changes to happy face.

View File

@@ -0,0 +1 @@
uid://eu1k1ulu68o2

View File

@@ -14,9 +14,13 @@ config/name="Bullet Shower"
config/description="Demonstrates how to manage large amounts of objects efficiently using low-level Servers."
config/tags=PackedStringArray("2d", "demo", "official", "performance")
run/main_scene="res://shower.tscn"
config/features=PackedStringArray("4.2")
config/features=PackedStringArray("4.5")
config/icon="res://icon.webp"
[debug]
gdscript/warnings/untyped_declaration=1
[display]
window/stretch/mode="canvas_items"
@@ -26,10 +30,7 @@ window/stretch/aspect="expand"
2d_physics/layer_1="Player"
[physics]
2d/cell_size=64
[rendering]
renderer/rendering_method="mobile"
renderer/rendering_method="gl_compatibility"
renderer/rendering_method.mobile="gl_compatibility"

View File

@@ -1,9 +1,9 @@
[gd_scene load_steps=7 format=3 uid="uid://c78by7hc4fmwx"]
[gd_scene load_steps=7 format=3 uid="uid://dxq1b4cth265d"]
[ext_resource type="Script" path="res://bullets.gd" id="2"]
[ext_resource type="Texture2D" uid="uid://d3u7k0742d5ug" path="res://face_happy.png" id="3"]
[ext_resource type="Texture2D" uid="uid://8j32onnr4qo3" path="res://face_sad.png" id="4"]
[ext_resource type="Script" path="res://player.gd" id="5"]
[ext_resource type="Script" uid="uid://e3fsq0i746o1" path="res://bullets.gd" id="2"]
[ext_resource type="Texture2D" uid="uid://c33jd3nwdqtb4" path="res://face_happy.png" id="3"]
[ext_resource type="Texture2D" uid="uid://b63ok8dbyysfs" path="res://face_sad.png" id="4"]
[ext_resource type="Script" uid="uid://eu1k1ulu68o2" path="res://player.gd" id="5"]
[sub_resource type="SpriteFrames" id="1"]
animations = [{

View File

@@ -0,0 +1,23 @@
# Custom drawing in 2D
A demo showing how to draw 2D elements in Godot without using nodes. This can be done
to create procedural graphics, perform debug drawing to help troubleshoot issues in
game logic, or to improve performance by not creating a node for every visible element.
Antialiasing can be performed using two approaches: either by enabling the `antialiasing`
parameter provided by some of the CanvasItem `draw_*` methods, or by enabling 2D MSAA
in the Project Settings. 2D MSAA is generally slower, but it works with any kind of line-based
or polygon-based 2D drawing, even for `draw_*` methods that don't support an `antialiasing`
parameter. Note that 2D MSAA is only available in the Forward+ and Mobile
renderers, not Compatibility.
See [Custom drawing in 2D](https://docs.godotengine.org/en/latest/tutorials/2d/custom_drawing_in_2d.html)
in the documentation for more information.
Language: GDScript
Renderer: Mobile
## Screenshots
![Screenshot](screenshots/custom_drawing.webp)

View File

@@ -0,0 +1,43 @@
# This is a `@tool` script so that the custom 2D drawing can be seen in the editor.
@tool
extends Panel
var use_antialiasing: bool = false
var time := 0.0
func _process(delta: float) -> void:
# Increment a counter variable that we use in `_draw()`.
time += delta
# Force redrawing on every processed frame, so that the animation can visibly progress.
# Only do this when the node is visible in tree, so that we don't force continuous redrawing
# when not needed (low-processor usage mode is enabled in this demo).
if is_visible_in_tree():
queue_redraw()
func _draw() -> void:
var margin := Vector2(240, 70)
var offset := Vector2()
# Line width of `-1.0` is only usable with draw antialiasing disabled,
# as it uses hardware line drawing as opposed to polygon-based line drawing.
# Automatically use polygon-based line drawing when needed to avoid runtime warnings.
# We also use a line width of `0.5` instead of `1.0` to better match the appearance
# of non-antialiased line drawing, as draw antialiasing tends to make lines look thicker.
var line_width_thin := 0.5 if use_antialiasing else -1.0
# Draw an animated arc to simulate a circular progress bar.
# The start angle is set so the arc starts from the top.
const POINT_COUNT = 48
var progress := wrapf(time, 0.0, 1.0)
draw_arc(
margin + offset,
50.0,
0.75 * TAU,
(0.75 + progress) * TAU,
POINT_COUNT,
Color.MEDIUM_AQUAMARINE,
line_width_thin,
use_antialiasing
)

View File

@@ -0,0 +1 @@
uid://m1872t0qa0i4

View File

@@ -0,0 +1,38 @@
extends Control
var use_antialiasing: bool = false
func _draw() -> void:
var margin := Vector2(240, 70)
var offset := Vector2(0, 150)
# This is an example of using draw commands to create animations.
# For "continuous" animations, you can use a timer within `_draw()` and call `queue_redraw()`
# in `_process()` to redraw every frame.
# Animation length in seconds. The animation will loop after the specified duration.
const ANIMATION_LENGTH = 2.0
# 5 frames per second.
const ANIMATION_FRAMES = 10
# Declare an animation frame with randomized rotation and color for each frame.
# `draw_animation_slice()` makes it so the following draw commands are only visible
# on screen when the current time is within the animation slice.
# NOTE: Pause does not affect animations drawn by `draw_animation_slice()`
# (they will keep playing).
for frame in ANIMATION_FRAMES:
# `remap()` is useful to determine the time slice in which a frame is visible.
# For example, on the 2nd frame, `slice_begin` is `0.2` and `slice_end` is `0.4`.
var slice_begin := remap(frame, 0, ANIMATION_FRAMES, 0, ANIMATION_LENGTH)
var slice_end := remap(frame + 1, 0, ANIMATION_FRAMES, 0, ANIMATION_LENGTH)
draw_animation_slice(ANIMATION_LENGTH, slice_begin, slice_end)
draw_set_transform(margin + offset, deg_to_rad(randf_range(-5.0, 5.0)))
draw_rect(
Rect2(Vector2(), Vector2(100, 50)),
Color.from_hsv(randf(), 0.4, 1.0),
true,
-1.0,
use_antialiasing
)
draw_end_animation()

View File

@@ -0,0 +1 @@
uid://dxbst4jd731sx

View File

@@ -0,0 +1,14 @@
extends Control
func _on_msaa_2d_item_selected(index: int) -> void:
get_viewport().msaa_2d = index as Viewport.MSAA
func _on_draw_antialiasing_toggled(toggled_on: bool) -> void:
var nodes: Array[Node] = %TabContainer.get_children()
nodes.push_back(%AnimationSlice)
for tab: Control in nodes:
tab.use_antialiasing = toggled_on
# Force all tabs to redraw so that the antialiasing updates.
tab.queue_redraw()

View File

@@ -0,0 +1 @@
uid://k86266poffsc

View File

@@ -0,0 +1,272 @@
[gd_scene load_steps=10 format=3 uid="uid://e3ko2k5vfsph"]
[ext_resource type="Script" uid="uid://k86266poffsc" path="res://custom_drawing.gd" id="1_rtndo"]
[ext_resource type="Script" uid="uid://bs2i4k2suatwx" path="res://lines.gd" id="2_exx0l"]
[ext_resource type="Script" uid="uid://kr0artw8tmec" path="res://rectangles.gd" id="3_yrx86"]
[ext_resource type="Script" uid="uid://bavbrayrl4aqv" path="res://polygons.gd" id="4_obj11"]
[ext_resource type="Script" uid="uid://dmgkvc33ohsn1" path="res://textures.gd" id="5_84cac"]
[ext_resource type="Script" uid="uid://cmgvk2l7icywj" path="res://meshes.gd" id="5_exx0l"]
[ext_resource type="Script" uid="uid://by5ufa6o3liw" path="res://text.gd" id="6_4w081"]
[ext_resource type="Script" uid="uid://m1872t0qa0i4" path="res://animation.gd" id="8_yrx86"]
[ext_resource type="Script" uid="uid://dxbst4jd731sx" path="res://animation_slice.gd" id="9_obj11"]
[node name="CustomDrawing" type="Control"]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_rtndo")
[node name="TabContainer" type="TabContainer" parent="."]
unique_name_in_owner = true
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
current_tab = 0
[node name="Lines" type="Panel" parent="TabContainer"]
layout_mode = 2
script = ExtResource("2_exx0l")
metadata/_tab_index = 0
[node name="DrawLine" type="Label" parent="TabContainer/Lines"]
layout_mode = 0
offset_left = 24.0
offset_top = 48.0
offset_right = 172.0
offset_bottom = 97.0
theme_override_colors/font_color = Color(0.501961, 1, 0.501961, 1)
text = "draw_line()
draw_dashed_line()"
[node name="DrawCircle" type="Label" parent="TabContainer/Lines"]
layout_mode = 0
offset_left = 24.0
offset_top = 154.0
offset_right = 122.0
offset_bottom = 177.0
theme_override_colors/font_color = Color(0.501961, 1, 0.501961, 1)
text = "draw_circle()"
[node name="DrawArc" type="Label" parent="TabContainer/Lines"]
layout_mode = 0
offset_left = 24.0
offset_top = 264.0
offset_right = 109.0
offset_bottom = 287.0
theme_override_colors/font_color = Color(0.501961, 1, 0.501961, 1)
text = "draw_arc()"
[node name="Rectangles" type="Panel" parent="TabContainer"]
visible = false
layout_mode = 2
script = ExtResource("3_yrx86")
metadata/_tab_index = 1
[node name="DrawRect" type="Label" parent="TabContainer/Rectangles"]
layout_mode = 0
offset_left = 24.0
offset_top = 48.0
offset_right = 109.0
offset_bottom = 71.0
theme_override_colors/font_color = Color(0.501961, 1, 0.501961, 1)
text = "draw_rect()"
[node name="DrawStyleBox" type="Label" parent="TabContainer/Rectangles"]
layout_mode = 0
offset_left = 24.0
offset_top = 296.0
offset_right = 153.0
offset_bottom = 319.0
text = "draw_style_box()"
[node name="Polygons" type="Panel" parent="TabContainer"]
visible = false
layout_mode = 2
script = ExtResource("4_obj11")
metadata/_tab_index = 2
[node name="DrawPrimitive" type="Label" parent="TabContainer/Polygons"]
layout_mode = 0
offset_left = 24.0
offset_top = 48.0
offset_right = 207.0
offset_bottom = 97.0
text = "draw_primitive()"
[node name="DrawPolygon" type="Label" parent="TabContainer/Polygons"]
layout_mode = 0
offset_left = 24.0
offset_top = 168.0
offset_right = 207.0
offset_bottom = 217.0
text = "draw_polygon()
draw_colored_polygon()"
[node name="DrawPolyline" type="Label" parent="TabContainer/Polygons"]
layout_mode = 0
offset_left = 24.0
offset_top = 264.0
offset_right = 195.0
offset_bottom = 313.0
theme_override_colors/font_color = Color(0.501961, 1, 0.501961, 1)
text = "draw_polyline()
draw_polyline_colors()"
[node name="DrawMultiline" type="Label" parent="TabContainer/Polygons"]
layout_mode = 0
offset_left = 24.0
offset_top = 392.0
offset_right = 203.0
offset_bottom = 441.0
theme_override_colors/font_color = Color(0.501961, 1, 0.501961, 1)
text = "draw_multiline()
draw_multiline_colors()"
[node name="Meshes" type="Panel" parent="TabContainer"]
visible = false
layout_mode = 2
script = ExtResource("5_exx0l")
metadata/_tab_index = 3
[node name="DrawMesh" type="Label" parent="TabContainer/Meshes"]
layout_mode = 0
offset_left = 24.0
offset_top = 48.0
offset_right = 207.0
offset_bottom = 97.0
text = "draw_mesh()"
[node name="DrawMultiMesh" type="Label" parent="TabContainer/Meshes"]
layout_mode = 0
offset_left = 24.0
offset_top = 208.0
offset_right = 207.0
offset_bottom = 257.0
text = "draw_multimesh()"
[node name="Textures" type="Panel" parent="TabContainer"]
visible = false
texture_repeat = 2
layout_mode = 2
script = ExtResource("5_84cac")
metadata/_tab_index = 4
[node name="DrawTexture" type="Label" parent="TabContainer/Textures"]
layout_mode = 0
offset_left = 24.0
offset_top = 48.0
offset_right = 175.0
offset_bottom = 97.0
text = "draw_texture()
draw_texture_rect()"
[node name="DrawTextureRectRegion" type="Label" parent="TabContainer/Textures"]
layout_mode = 0
offset_left = 24.0
offset_top = 392.0
offset_right = 231.0
offset_bottom = 415.0
text = "draw_texture_rect_region()"
[node name="Text" type="Panel" parent="TabContainer"]
visible = false
layout_mode = 2
script = ExtResource("6_4w081")
metadata/_tab_index = 5
[node name="DrawChar" type="Label" parent="TabContainer/Text"]
layout_mode = 0
offset_left = 24.0
offset_top = 48.0
offset_right = 125.0
offset_bottom = 97.0
text = "draw_char()
draw_string()"
[node name="Animation" type="Panel" parent="TabContainer"]
visible = false
layout_mode = 2
script = ExtResource("8_yrx86")
metadata/_tab_index = 6
[node name="DrawArcTime" type="Label" parent="TabContainer/Animation"]
layout_mode = 0
offset_left = 24.0
offset_top = 48.0
offset_right = 125.0
offset_bottom = 97.0
theme_override_colors/font_color = Color(0.501961, 1, 0.501961, 1)
text = "draw_arc()
+ time variable"
[node name="DrawAnimationSlice" type="Label" parent="TabContainer/Animation"]
layout_mode = 0
offset_left = 24.0
offset_top = 216.0
offset_right = 201.0
offset_bottom = 265.0
text = "draw_animation_slice()"
[node name="AnimationSlice" type="Control" parent="TabContainer/Animation"]
unique_name_in_owner = true
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("9_obj11")
[node name="Options" type="HBoxContainer" parent="."]
layout_mode = 1
anchors_preset = 2
anchor_top = 1.0
anchor_bottom = 1.0
offset_left = 24.0
offset_top = -64.0
offset_right = 441.0
offset_bottom = -24.0
grow_vertical = 0
theme_override_constants/separation = 20
[node name="MSAA2DLabel" type="Label" parent="Options"]
layout_mode = 2
text = "MSAA 2D"
[node name="MSAA2DOptionButton" type="OptionButton" parent="Options"]
layout_mode = 2
selected = 0
item_count = 4
popup/item_0/text = "Disabled"
popup/item_0/id = 0
popup/item_1/text = "2×"
popup/item_1/id = 1
popup/item_2/text = "4×"
popup/item_2/id = 2
popup/item_3/text = "8×"
popup/item_3/id = 3
[node name="VSeparator" type="VSeparator" parent="Options"]
layout_mode = 2
[node name="DrawAntialiasing" type="CheckButton" parent="Options"]
layout_mode = 2
tooltip_text = "Performs antialiasing by adding a feathered outline
to lines that are drawn in 2D. This is generally faster to render
than 2D MSAA, but not all draw commands support it.
Commands that support draw antialiasing are
highlighted in green."
theme_override_colors/font_color = Color(0.501961, 1, 0.501961, 1)
theme_override_colors/font_focus_color = Color(0.501961, 1, 0.501961, 1)
theme_override_colors/font_pressed_color = Color(0.501961, 1, 0.501961, 1)
text = "Draw Antialiasing"
[connection signal="item_selected" from="Options/MSAA2DOptionButton" to="." method="_on_msaa_2d_item_selected"]
[connection signal="toggled" from="Options/DrawAntialiasing" to="." method="_on_draw_antialiasing_toggled"]

View File

@@ -0,0 +1 @@
<svg height="128" width="128" xmlns="http://www.w3.org/2000/svg"><path d="m15.999738 8a7.9997377 7.9997377 0 0 0 -7.999738 7.999738v67.99777c11.999607 3.999869 7.999738-7.999738 15.999475-7.999738v-51.998295h79.997375v17.599423a19.319367 19.319367 0 0 1 15.99948 3.999869v-29.599029a7.9997377 7.9997377 0 0 0 -7.99974-7.999738zm10.879643 81.43733c-2.263926 1.351955-4.127865 3.727878-5.159831 6.919773-3.327891 10.215667-19.3353659-7.519754-7.567752 16.071477 3.719878 7.44775 15.295499 9.61568 22.679257 5.78381a15.375496 15.375496 0 0 0 6.639782-20.439334c-4.623848-9.263696-11.59962-11.287629-16.591456-8.327726zm17.775417-5.599817 10.175666 19.959347 56.550146-28.815056a11.319629 11.319629 0 0 0 -10.07167-20.271336zm27.343104-43.838562v7.999737h-7.999738v7.999738h-15.999476v7.999738h-7.999737v7.999738h-7.999738v7.999737h1.999935l53.998229-27.783089v-4.215862h-7.999738v-7.999737z" fill="#808080" stroke-width=".999999"/></svg>

After

Width:  |  Height:  |  Size: 935 B

View File

@@ -0,0 +1,43 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://cfri1nx5avo7w"
path="res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://icon.svg"
dest_files=["res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
svg/scale=1.0
editor/scale_with_editor_scale=false
editor/convert_colors_with_editor_theme=false

View File

@@ -0,0 +1,89 @@
# This is a `@tool` script so that the custom 2D drawing can be seen in the editor.
@tool
extends Panel
var use_antialiasing: bool = false
func _draw() -> void:
var margin := Vector2(200, 50)
# Line width of `-1.0` is only usable with draw antialiasing disabled,
# as it uses hardware line drawing as opposed to polygon-based line drawing.
# Automatically use polygon-based line drawing when needed to avoid runtime warnings.
# We also use a line width of `0.5` instead of `1.0` to better match the appearance
# of non-antialiased line drawing, as draw antialiasing tends to make lines look thicker.
var line_width_thin := 0.5 if use_antialiasing else -1.0
# Make thick lines 1 pixel thinner when draw antialiasing is enabled,
# as draw antialiasing tends to make lines look thicker.
var antialiasing_width_offset := 1.0 if use_antialiasing else 0.0
var offset := Vector2()
var line_length := Vector2(140, 35)
draw_line(margin + offset, margin + offset + line_length, Color.GREEN, line_width_thin, use_antialiasing)
offset += Vector2(line_length.x + 15, 0)
draw_line(margin + offset, margin + offset + line_length, Color.GREEN, 2.0 - antialiasing_width_offset, use_antialiasing)
offset += Vector2(line_length.x + 15, 0)
draw_line(margin + offset, margin + offset + line_length, Color.GREEN, 6.0 - antialiasing_width_offset, use_antialiasing)
offset += Vector2(line_length.x + 15, 0)
draw_dashed_line(margin + offset, margin + offset + line_length, Color.CYAN, line_width_thin, 5.0, true, use_antialiasing)
offset += Vector2(line_length.x + 15, 0)
draw_dashed_line(margin + offset, margin + offset + line_length, Color.CYAN, 2.0 - antialiasing_width_offset, 10.0, true, use_antialiasing)
offset += Vector2(line_length.x + 15, 0)
draw_dashed_line(margin + offset, margin + offset + line_length, Color.CYAN, 6.0 - antialiasing_width_offset, 15.0, true, use_antialiasing)
offset = Vector2(40, 120)
draw_circle(margin + offset, 40, Color.ORANGE, false, line_width_thin, use_antialiasing)
offset += Vector2(100, 0)
draw_circle(margin + offset, 40, Color.ORANGE, false, 2.0 - antialiasing_width_offset, use_antialiasing)
offset += Vector2(100, 0)
draw_circle(margin + offset, 40, Color.ORANGE, false, 6.0 - antialiasing_width_offset, use_antialiasing)
# Draw a filled circle. The width parameter is ignored for filled circles (it's set to `-1.0` to avoid warnings).
# We also reduce the radius by half the antialiasing width offset.
# Otherwise, the circle becomes very slightly larger when draw antialiasing is enabled.
offset += Vector2(100, 0)
draw_circle(margin + offset, 40 - antialiasing_width_offset * 0.5, Color.ORANGE, true, -1.0, use_antialiasing)
# `draw_set_transform()` is a stateful command: it affects *all* `draw_` methods within this
# `_draw()` function after it. This can be used to translate, rotate, or scale `draw_` methods
# that don't offer dedicated parameters for this (such as `draw_primitive()` not having a position parameter).
# To reset back to the initial transform, call `draw_set_transform(Vector2())`.
#
# Draw a horizontally stretched circle.
offset += Vector2(200, 0)
draw_set_transform(margin + offset, 0.0, Vector2(3.0, 1.0))
draw_circle(Vector2(), 40, Color.ORANGE, false, line_width_thin, use_antialiasing)
draw_set_transform(Vector2())
# Draw a quarter circle (`TAU` represents a full turn in radians).
const POINT_COUNT_HIGH = 24
offset = Vector2(0, 200)
draw_arc(margin + offset, 60, 0, 0.25 * TAU, POINT_COUNT_HIGH, Color.YELLOW, line_width_thin, use_antialiasing)
offset += Vector2(100, 0)
draw_arc(margin + offset, 60, 0, 0.25 * TAU, POINT_COUNT_HIGH, Color.YELLOW, 2.0 - antialiasing_width_offset, use_antialiasing)
offset += Vector2(100, 0)
draw_arc(margin + offset, 60, 0, 0.25 * TAU, POINT_COUNT_HIGH, Color.YELLOW, 6.0 - antialiasing_width_offset, use_antialiasing)
# Draw a three quarters of a circle with a low point count, which gives it an angular look.
const POINT_COUNT_LOW = 7
offset += Vector2(125, 30)
draw_arc(margin + offset, 40, -0.25 * TAU, 0.5 * TAU, POINT_COUNT_LOW, Color.YELLOW, line_width_thin, use_antialiasing)
offset += Vector2(100, 0)
draw_arc(margin + offset, 40, -0.25 * TAU, 0.5 * TAU, POINT_COUNT_LOW, Color.YELLOW, 2.0 - antialiasing_width_offset, use_antialiasing)
offset += Vector2(100, 0)
draw_arc(margin + offset, 40, -0.25 * TAU, 0.5 * TAU, POINT_COUNT_LOW, Color.YELLOW, 6.0 - antialiasing_width_offset, use_antialiasing)
# Draw a horizontally stretched arc.
offset += Vector2(200, 0)
draw_set_transform(margin + offset, 0.0, Vector2(3.0, 1.0))
draw_arc(Vector2(), 40, -0.25 * TAU, 0.5 * TAU, POINT_COUNT_LOW, Color.YELLOW, line_width_thin, use_antialiasing)
draw_set_transform(Vector2())

View File

@@ -0,0 +1 @@
uid://bs2i4k2suatwx

View File

@@ -0,0 +1,63 @@
# This is a `@tool` script so that the custom 2D drawing can be seen in the editor.
@tool
extends Panel
# You must hold a reference to the Resources either as member variables or within an Array or Dictionary.
# Otherwise, they get freed automatically and the renderer won't be able to draw them.
var text_mesh := TextMesh.new()
var noise_texture := NoiseTexture2D.new()
var gradient_texture := GradientTexture2D.new()
var sphere_mesh := SphereMesh.new()
var multi_mesh := MultiMesh.new()
func _ready() -> void:
text_mesh.text = "TextMesh"
# In 2D, 1 unit equals 1 pixel, so the default size at which PrimitiveMeshes are displayed is tiny.
# Use much larger mesh size to compensate, or use `draw_set_transform()` before using `draw_mesh()`
# to scale the draw command.
text_mesh.pixel_size = 2.5
noise_texture.seamless = true
noise_texture.as_normal_map = true
noise_texture.noise = FastNoiseLite.new()
gradient_texture.gradient = Gradient.new()
sphere_mesh.height = 80.0
sphere_mesh.radius = 40.0
multi_mesh.use_colors = true
multi_mesh.instance_count = 5
multi_mesh.set_instance_transform_2d(0, Transform2D(0.0, Vector2(0, 0)))
multi_mesh.set_instance_color(0, Color(1, 0.7, 0.7))
multi_mesh.set_instance_transform_2d(1, Transform2D(0.0, Vector2(0, 100)))
multi_mesh.set_instance_color(1, Color(0.7, 1, 0.7))
multi_mesh.set_instance_transform_2d(2, Transform2D(0.0, Vector2(100, 100)))
multi_mesh.set_instance_color(2, Color(0.7, 0.7, 1))
multi_mesh.set_instance_transform_2d(3, Transform2D(0.0, Vector2(100, 0)))
multi_mesh.set_instance_color(3, Color(1, 1, 0.7))
multi_mesh.set_instance_transform_2d(4, Transform2D(0.0, Vector2(50, 50)))
multi_mesh.set_instance_color(4, Color(0.7, 1, 1))
multi_mesh.mesh = sphere_mesh
func _draw() -> void:
const margin := Vector2(300, 70)
var offset := Vector2()
# `draw_set_transform()` is a stateful command: it affects *all* `draw_` methods within this
# `_draw()` function after it. This can be used to translate, rotate, or scale `draw_` methods
# that don't offer dedicated parameters for this (such as `draw_primitive()` not having a position parameter).
# To reset back to the initial transform, call `draw_set_transform(Vector2())`.
#
# Flip drawing on the Y axis so the text appears upright.
draw_set_transform(margin + offset, 0.0, Vector2(1, -1))
draw_mesh(text_mesh, noise_texture)
offset += Vector2(150, 0)
draw_set_transform(margin + offset)
draw_mesh(sphere_mesh, noise_texture)
offset = Vector2(0, 120)
draw_set_transform(margin + offset)
draw_multimesh(multi_mesh, gradient_texture)

View File

@@ -0,0 +1 @@
uid://cmgvk2l7icywj

View File

@@ -0,0 +1,126 @@
# This is a `@tool` script so that the custom 2D drawing can be seen in the editor.
@tool
extends Panel
var use_antialiasing: bool = false
func _draw() -> void:
var margin := Vector2(240, 40)
# Line width of `-1.0` is only usable with draw antialiasing disabled,
# as it uses hardware line drawing as opposed to polygon-based line drawing.
# Automatically use polygon-based line drawing when needed to avoid runtime warnings.
# We also use a line width of `0.5` instead of `1.0` to better match the appearance
# of non-antialiased line drawing, as draw antialiasing tends to make lines look thicker.
var line_width_thin := 0.5 if use_antialiasing else -1.0
# Make thick lines 1 pixel thinner when draw antialiasing is enabled,
# as draw antialiasing tends to make lines look thicker.
var antialiasing_width_offset := 1.0 if use_antialiasing else 0.0
var points := PackedVector2Array([
Vector2(0, 0),
Vector2(0, 60),
Vector2(60, 90),
Vector2(60, 0),
Vector2(40, 25),
Vector2(10, 40),
])
var colors := PackedColorArray([
Color.WHITE,
Color.RED,
Color.GREEN,
Color.BLUE,
Color.MAGENTA,
Color.MAGENTA,
])
var offset := Vector2()
# `draw_set_transform()` is a stateful command: it affects *all* `draw_` methods within this
# `_draw()` function after it. This can be used to translate, rotate, or scale `draw_` methods
# that don't offer dedicated parameters for this (such as `draw_primitive()` not having a position parameter).
# To reset back to the initial transform, call `draw_set_transform(Vector2())`.
draw_set_transform(margin + offset)
draw_primitive(points.slice(0, 1), colors.slice(0, 1), PackedVector2Array())
offset += Vector2(90, 0)
draw_set_transform(margin + offset)
draw_primitive(points.slice(0, 2), colors.slice(0, 2), PackedVector2Array())
offset += Vector2(90, 0)
draw_set_transform(margin + offset)
draw_primitive(points.slice(0, 3), colors.slice(0, 3), PackedVector2Array())
offset += Vector2(90, 0)
draw_set_transform(margin + offset)
draw_primitive(points.slice(0, 4), colors.slice(0, 4), PackedVector2Array())
# Draw a polygon with multiple colors that are interpolated between each point.
# Colors are specified in the same order as the points' positions, but in a different array.
offset = Vector2(0, 120)
draw_set_transform(margin + offset)
draw_polygon(points, colors)
# Draw a polygon with a single color. Only a points array is needed in this case.
offset += Vector2(90, 0)
draw_set_transform(margin + offset)
draw_colored_polygon(points, Color.YELLOW)
# Draw a polygon-based line. Each segment is connected to the previous one, which means
# `draw_polyline()` always draws a contiguous line.
offset = Vector2(0, 240)
draw_set_transform(margin + offset)
draw_polyline(points, Color.SKY_BLUE, line_width_thin, use_antialiasing)
offset += Vector2(90, 0)
draw_set_transform(margin + offset)
draw_polyline(points, Color.SKY_BLUE, 2.0 - antialiasing_width_offset, use_antialiasing)
offset += Vector2(90, 0)
draw_set_transform(margin + offset)
draw_polyline(points, Color.SKY_BLUE, 6.0 - antialiasing_width_offset, use_antialiasing)
offset += Vector2(90, 0)
draw_set_transform(margin + offset)
draw_polyline_colors(points, colors, line_width_thin, use_antialiasing)
offset += Vector2(90, 0)
draw_set_transform(margin + offset)
draw_polyline_colors(points, colors, 2.0 - antialiasing_width_offset, use_antialiasing)
offset += Vector2(90, 0)
draw_set_transform(margin + offset)
draw_polyline_colors(points, colors, 6.0 - antialiasing_width_offset, use_antialiasing)
# Draw multiple lines in a single draw command. Unlike `draw_polyline()`,
# lines are not connected to the last segment.
# This is faster than calling `draw_line()` several times and should be preferred
# when drawing dozens of lines or more at once.
offset = Vector2(0, 360)
draw_set_transform(margin + offset)
draw_multiline(points, Color.SKY_BLUE, line_width_thin, use_antialiasing)
offset += Vector2(90, 0)
draw_set_transform(margin + offset)
draw_multiline(points, Color.SKY_BLUE, 2.0 - antialiasing_width_offset, use_antialiasing)
offset += Vector2(90, 0)
draw_set_transform(margin + offset)
draw_multiline(points, Color.SKY_BLUE, 6.0 - antialiasing_width_offset, use_antialiasing)
# `draw_multiline_colors()` makes it possible to draw lines of different colors in a single
# draw command, although gradients are not possible this way (unlike `draw_polygon()` and `draw_polyline()`).
# This means the number of supplied colors must be equal to the number of segments, which means
# we have to only pass a subset of the colors array in this example.
offset += Vector2(90, 0)
draw_set_transform(margin + offset)
draw_multiline_colors(points, colors.slice(0, 3), line_width_thin, use_antialiasing)
offset += Vector2(90, 0)
draw_set_transform(margin + offset)
draw_multiline_colors(points, colors.slice(0, 3), 2.0 - antialiasing_width_offset, use_antialiasing)
offset += Vector2(90, 0)
draw_set_transform(margin + offset)
draw_multiline_colors(points, colors.slice(0, 3), 6.0 - antialiasing_width_offset, use_antialiasing)

View File

@@ -0,0 +1 @@
uid://bavbrayrl4aqv

View File

@@ -0,0 +1,31 @@
; 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=5
[application]
config/name="Custom Drawing in 2D"
config/description="A demo showing how to draw 2D elements in Godot without using nodes."
run/main_scene="uid://btxwm0qudsn3t"
config/features=PackedStringArray("4.5", "Mobile")
run/low_processor_mode=true
config/icon="res://icon.svg"
[debug]
gdscript/warnings/untyped_declaration=1
[display]
window/stretch/mode="canvas_items"
window/stretch/aspect="expand"
[rendering]
renderer/rendering_method="mobile"

View File

@@ -0,0 +1,146 @@
# This is a `@tool` script so that the custom 2D drawing can be seen in the editor.
@tool
extends Panel
var use_antialiasing: bool = false
func _draw() -> void:
var margin := Vector2(200, 40)
# Line width of `-1.0` is only usable with draw antialiasing disabled,
# as it uses hardware line drawing as opposed to polygon-based line drawing.
# Automatically use polygon-based line drawing when needed to avoid runtime warnings.
# We also use a line width of `0.5` instead of `1.0` to better match the appearance
# of non-antialiased line drawing, as draw antialiasing tends to make lines look thicker.
var line_width_thin := 0.5 if use_antialiasing else -1.0
# Make thick lines 1 pixel thinner when draw antialiasing is enabled,
# as draw antialiasing tends to make lines look thicker.
var antialiasing_width_offset := 1.0 if use_antialiasing else 0.0
var offset := Vector2()
draw_rect(
Rect2(margin + offset, Vector2(100, 50)),
Color.PURPLE,
false,
line_width_thin,
use_antialiasing
)
offset += Vector2(120, 0)
draw_rect(
Rect2(margin + offset, Vector2(100, 50)),
Color.PURPLE,
false,
2.0 - antialiasing_width_offset,
use_antialiasing
)
offset += Vector2(120, 0)
draw_rect(
Rect2(margin + offset, Vector2(100, 50)),
Color.PURPLE,
false,
6.0 - antialiasing_width_offset,
use_antialiasing
)
# Draw a filled rectangle. The width parameter is ignored for filled rectangles (it's set to `-1.0` to avoid warnings).
# We also reduce the rectangle's size by half the antialiasing width offset.
# Otherwise, the rectangle becomes very slightly larger when draw antialiasing is enabled.
offset += Vector2(120, 0)
draw_rect(
Rect2(margin + offset, Vector2(100, 50)).grow(-antialiasing_width_offset * 0.5),
Color.PURPLE,
true,
-1.0,
use_antialiasing
)
# `draw_set_transform()` is a stateful command: it affects *all* `draw_` methods within this
# `_draw()` function after it. This can be used to translate, rotate, or scale `draw_` methods
# that don't offer dedicated parameters for this (such as `draw_rect()` not having a rotation parameter).
# To reset back to the initial transform, call `draw_set_transform(Vector2())`.
offset += Vector2(170, 0)
draw_set_transform(margin + offset, deg_to_rad(22.5))
draw_rect(
Rect2(Vector2(), Vector2(100, 50)),
Color.PURPLE,
false,
line_width_thin,
use_antialiasing
)
offset += Vector2(120, 0)
draw_set_transform(margin + offset, deg_to_rad(22.5))
draw_rect(
Rect2(Vector2(), Vector2(100, 50)),
Color.PURPLE,
false,
2.0 - antialiasing_width_offset,
use_antialiasing
)
offset += Vector2(120, 0)
draw_set_transform(margin + offset, deg_to_rad(22.5))
draw_rect(
Rect2(Vector2(), Vector2(100, 50)),
Color.PURPLE,
false,
6.0 - antialiasing_width_offset,
use_antialiasing
)
# `draw_set_transform_matrix()` is a more advanced counterpart of `draw_set_transform()`.
# It can be used to apply transforms that are not supported by `draw_set_transform()`, such as
# skewing.
offset = Vector2(20, 60)
var custom_transform := get_transform().translated(margin + offset)
# Perform horizontal skewing (the rectangle will appear "slanted").
custom_transform.y.x -= 0.5
draw_set_transform_matrix(custom_transform)
draw_rect(
Rect2(Vector2(), Vector2(100, 50)),
Color.PURPLE,
false,
6.0 - antialiasing_width_offset,
use_antialiasing
)
draw_set_transform(Vector2())
offset = Vector2(0, 250)
var style_box_flat := StyleBoxFlat.new()
style_box_flat.set_border_width_all(4)
style_box_flat.set_corner_radius_all(8)
style_box_flat.shadow_size = 1
style_box_flat.shadow_offset = Vector2(4, 4)
style_box_flat.shadow_color = Color.RED
style_box_flat.anti_aliasing = use_antialiasing
draw_style_box(style_box_flat, Rect2(margin + offset, Vector2(100, 50)))
offset += Vector2(130, 0)
var style_box_flat_2 := StyleBoxFlat.new()
style_box_flat_2.draw_center = false
style_box_flat_2.set_border_width_all(4)
style_box_flat_2.set_corner_radius_all(8)
style_box_flat_2.corner_detail = 1
style_box_flat_2.border_color = Color.GREEN
style_box_flat_2.anti_aliasing = use_antialiasing
draw_style_box(style_box_flat_2, Rect2(margin + offset, Vector2(100, 50)))
offset += Vector2(160, 0)
var style_box_flat_3 := StyleBoxFlat.new()
style_box_flat_3.draw_center = false
style_box_flat_3.set_border_width_all(4)
style_box_flat_3.set_corner_radius_all(8)
style_box_flat_3.border_color = Color.CYAN
style_box_flat_3.shadow_size = 40
style_box_flat_3.shadow_offset = Vector2()
style_box_flat_3.shadow_color = Color.CORNFLOWER_BLUE
style_box_flat_3.anti_aliasing = use_antialiasing
custom_transform = get_transform().translated(margin + offset)
# Perform vertical skewing (the rectangle will appear "slanted").
custom_transform.x.y -= 0.5
draw_set_transform_matrix(custom_transform)
draw_style_box(style_box_flat_3, Rect2(Vector2(), Vector2(100, 50)))
draw_set_transform(Vector2())

View File

@@ -0,0 +1 @@
uid://kr0artw8tmec

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

60
2d/custom_drawing/text.gd Normal file
View File

@@ -0,0 +1,60 @@
# This is a `@tool` script so that the custom 2D drawing can be seen in the editor.
@tool
extends Panel
var use_antialiasing: bool = false
func _draw() -> void:
var font := get_theme_default_font()
const FONT_SIZE = 24
const STRING = "Hello world!"
var margin := Vector2(240, 60)
var offset := Vector2()
var advance := Vector2()
for character in STRING:
# Draw each character with a random pastel color.
# Notice how the advance calculated on the loop's previous iteration is used as an offset here.
draw_char(font, margin + offset + advance, character, FONT_SIZE, Color.from_hsv(randf(), 0.4, 1.0))
# Get the glyph index of the character we've just drawn, so we can retrieve the glyph advance.
# This determines the spacing between glyphs so the next character is positioned correctly.
var glyph_idx := TextServerManager.get_primary_interface().font_get_glyph_index(
get_theme_default_font().get_rids()[0],
FONT_SIZE,
character.unicode_at(0),
0
)
advance.x += TextServerManager.get_primary_interface().font_get_glyph_advance(
get_theme_default_font().get_rids()[0],
FONT_SIZE,
glyph_idx
).x
offset += Vector2(0, 32)
# When drawing a font outline, it must be drawn *before* the main text.
# This way, the outline appears behind the main text.
draw_string_outline(
font,
margin + offset,
STRING,
HORIZONTAL_ALIGNMENT_LEFT,
-1,
FONT_SIZE,
12,
Color.ORANGE.darkened(0.6)
)
# NOTE: Use `draw_multiline_string()` to draw strings that contain line breaks (`\n`) or with
# automatic line wrapping based on the specified width.
# A width of `-1` is used here, which means "no limit". If width is limited, the end of the string
# will be cut off if it doesn't fit within the specified width.
draw_string(
font,
margin + offset,
STRING,
HORIZONTAL_ALIGNMENT_LEFT,
-1,
FONT_SIZE,
Color.YELLOW
)

View File

@@ -0,0 +1 @@
uid://by5ufa6o3liw

View File

@@ -0,0 +1,67 @@
# This is a `@tool` script so that the custom 2D drawing can be seen in the editor.
@tool
extends Panel
var use_antialiasing: bool = false
func _draw() -> void:
const ICON = preload("res://icon.svg")
var margin := Vector2(260, 40)
var offset := Vector2()
# Draw a texture.
draw_texture(ICON, margin + offset, Color.WHITE)
# `draw_set_transform()` is a stateful command: it affects *all* `draw_` methods within this
# `_draw()` function after it. This can be used to translate, rotate, or scale `draw_` methods
# that don't offer dedicated parameters for this (such as `draw_rect()` not having a rotation parameter).
# To reset back to the initial transform, call `draw_set_transform(Vector2())`.
#
# Draw a rotated texture at half the scale of its original pixel size.
offset += Vector2(200, 20)
draw_set_transform(margin + offset, deg_to_rad(45.0), Vector2(0.5, 0.5))
draw_texture(ICON, Vector2(), Color.WHITE)
draw_set_transform(Vector2())
# Draw a stretched texture. In this example, the icon is 128×128 so it will be drawn at 2× scale.
offset += Vector2(70, -20)
draw_texture_rect(
ICON,
Rect2(margin + offset, Vector2(256, 256)),
false,
Color.GREEN
)
# Draw a tiled texture. In this example, the icon is 128×128 so it will be drawn twice on each axis.
offset += Vector2(270, 0)
draw_texture_rect(
ICON,
Rect2(margin + offset, Vector2(256, 256)),
true,
Color.GREEN
)
offset = Vector2(0, 300)
draw_texture_rect_region(
ICON,
Rect2(margin + offset, Vector2(128, 128)),
Rect2(Vector2(32, 32), Vector2(64, 64)),
Color.VIOLET
)
# Draw a tiled texture from a region that is larger than the original texture size (128×128).
# Transposing is enabled, which will rotate the image by 90 degrees counter-clockwise.
# (For more advanced transforms, use `draw_set_transform()` before calling `draw_texture_rect_region()`.)
#
# For tiling to work with this approach, the CanvasItem in which this `_draw()` method is called
# must have its Repeat property set to Enabled in the inspector.
offset += Vector2(140, 0)
draw_texture_rect_region(
ICON,
Rect2(margin + offset, Vector2(128, 128)),
Rect2(Vector2(), Vector2(512, 512)),
Color.VIOLET,
true
)

View File

@@ -0,0 +1 @@
uid://dmgkvc33ohsn1

View File

@@ -1,49 +0,0 @@
[gd_scene load_steps=10 format=3 uid="uid://rkdnhqgf2hpj"]
[ext_resource type="Script" path="res://Mob.gd" id="1"]
[ext_resource type="Texture2D" uid="uid://yqglrrsx7j1f" path="res://art/enemyFlyingAlt_1.png" id="2"]
[ext_resource type="Texture2D" uid="uid://bpot8awhdn6ph" path="res://art/enemyFlyingAlt_2.png" id="3"]
[ext_resource type="Texture2D" uid="uid://bu4221t7qpa7d" path="res://art/enemyWalking_1.png" id="4"]
[ext_resource type="Texture2D" uid="uid://booij5t7h4efb" path="res://art/enemyWalking_2.png" id="5"]
[ext_resource type="Texture2D" uid="uid://5lvm88ij4jqn" path="res://art/enemySwimming_1.png" id="6"]
[ext_resource type="Texture2D" uid="uid://bng45cvsgufqc" path="res://art/enemySwimming_2.png" id="7"]
[sub_resource type="SpriteFrames" id="1"]
animations = [{
"frames": [ExtResource( "6" ), ExtResource( "7" )],
"loop": true,
"name": &"swim",
"speed": 4.0
}, {
"frames": [ExtResource( "2" ), ExtResource( "3" )],
"loop": true,
"name": &"fly",
"speed": 3.0
}, {
"frames": [ExtResource( "4" ), ExtResource( "5" )],
"loop": true,
"name": &"walk",
"speed": 4.0
}]
[sub_resource type="CapsuleShape2D" id="2"]
radius = 37.0
height = 100.0
[node name="Mob" type="RigidDynamicBody2D" groups=["mobs"]]
collision_mask = 0
gravity_scale = 0.0
script = ExtResource( "1" )
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
scale = Vector2(0.75, 0.75)
frames = SubResource( "1" )
animation = &"walk"
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
rotation = 1.5708
shape = SubResource( "2" )
[node name="VisibleOnScreenNotifier2D" type="VisibleOnScreenNotifier2D" parent="."]
[connection signal="screen_exited" from="VisibleOnScreenNotifier2D" to="." method="_on_VisibilityNotifier2D_screen_exited"]

View File

@@ -10,13 +10,13 @@ consider following the tutorial in the documentation.
Language: GDScript
Renderer: Vulkan Mobile
Renderer: Compatibility
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 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
Check out this demo on the asset library: https://godotengine.org/asset-library/asset/2712
## Screenshots
@@ -26,8 +26,8 @@ Check out this demo on the asset library: https://godotengine.org/asset-library/
## Copying
`art/House In a Forest Loop.ogg` Copyright &copy; 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
`art/House In a Forest Loop.ogg` Copyright &copy; 2012 [HorrorPen](https://opengameart.org/users/horrorpen), [CC-BY 3.0: Attribution](https://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
Images are from "Abstract Platformer". Created in 2016 by kenney.nl, [CC0 1.0 Universal](https://creativecommons.org/publicdomain/zero/1.0/). Source: https://www.kenney.nl/assets/abstract-platformer
Font is "Xolonium". Copyright &copy; 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`.

View File

@@ -2,7 +2,7 @@
importer="oggvorbisstr"
type="AudioStreamOggVorbis"
uid="uid://q2pf4fr8d0ks"
uid="uid://sgfduhhw4pno"
path="res://.godot/imported/House In a Forest Loop.ogg-1a6a72ae843ad792b7039931227e8d50.oggvorbisstr"
[deps]
@@ -13,7 +13,7 @@ dest_files=["res://.godot/imported/House In a Forest Loop.ogg-1a6a72ae843ad792b7
[params]
loop=true
loop_offset=0
bpm=0
loop_offset=0.0
bpm=0.0
beat_count=0
bar_beats=4

View File

@@ -2,7 +2,7 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://yqglrrsx7j1f"
uid="uid://dun74wipekpfq"
path="res://.godot/imported/enemyFlyingAlt_1.png-559f599b16c69b112c1b53f6332e9489.ctex"
metadata={
"vram_texture": false
@@ -18,6 +18,8 @@ dest_files=["res://.godot/imported/enemyFlyingAlt_1.png-559f599b16c69b112c1b53f6
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
@@ -25,6 +27,10 @@ mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false

View File

@@ -2,7 +2,7 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://bpot8awhdn6ph"
uid="uid://vusf51hepduk"
path="res://.godot/imported/enemyFlyingAlt_2.png-31dc7310eda6e1b721224f3cd932c076.ctex"
metadata={
"vram_texture": false
@@ -18,6 +18,8 @@ dest_files=["res://.godot/imported/enemyFlyingAlt_2.png-31dc7310eda6e1b721224f3c
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
@@ -25,6 +27,10 @@ mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false

View File

@@ -2,7 +2,7 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://5lvm88ij4jqn"
uid="uid://d182mv7y80xqy"
path="res://.godot/imported/enemySwimming_1.png-dd0e11759dc3d624c8a704f6e98a3d80.ctex"
metadata={
"vram_texture": false
@@ -18,6 +18,8 @@ dest_files=["res://.godot/imported/enemySwimming_1.png-dd0e11759dc3d624c8a704f6e
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
@@ -25,6 +27,10 @@ mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false

View File

@@ -2,7 +2,7 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://bng45cvsgufqc"
uid="uid://dmgglhdyowipd"
path="res://.godot/imported/enemySwimming_2.png-4c0cbc0732264c4ea3290340bd4a0a62.ctex"
metadata={
"vram_texture": false
@@ -18,6 +18,8 @@ dest_files=["res://.godot/imported/enemySwimming_2.png-4c0cbc0732264c4ea3290340b
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
@@ -25,6 +27,10 @@ mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false

View File

@@ -2,7 +2,7 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://bu4221t7qpa7d"
uid="uid://dgwhuvn7qb4iy"
path="res://.godot/imported/enemyWalking_1.png-5af6eedbe61b701677d490ffdc1e6471.ctex"
metadata={
"vram_texture": false
@@ -18,6 +18,8 @@ dest_files=["res://.godot/imported/enemyWalking_1.png-5af6eedbe61b701677d490ffdc
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
@@ -25,6 +27,10 @@ mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false

View File

@@ -2,7 +2,7 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://booij5t7h4efb"
uid="uid://dyw702efe6meu"
path="res://.godot/imported/enemyWalking_2.png-67c480ed60c35e95f5acb0436246b935.ctex"
metadata={
"vram_texture": false
@@ -18,6 +18,8 @@ dest_files=["res://.godot/imported/enemyWalking_2.png-67c480ed60c35e95f5acb04362
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
@@ -25,6 +27,10 @@ mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false

View File

@@ -2,7 +2,7 @@
importer="wav"
type="AudioStreamWAV"
uid="uid://dw26fpygeag8o"
uid="uid://td2mgko63p61"
path="res://.godot/imported/gameover.wav-98c95c744b35280048c2bd093cf8a356.sample"
[deps]
@@ -21,4 +21,4 @@ edit/normalize=true
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=0
compress/mode=2

View File

@@ -2,7 +2,7 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://b4yyoafu8bi0q"
uid="uid://bcow5c46vixno"
path="res://.godot/imported/playerGrey_up1.png-6bd114d0a6beac91f48e3a7314d44564.ctex"
metadata={
"vram_texture": false
@@ -18,6 +18,8 @@ dest_files=["res://.godot/imported/playerGrey_up1.png-6bd114d0a6beac91f48e3a7314
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
@@ -25,6 +27,10 @@ mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false

View File

@@ -2,7 +2,7 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://bko65a0nd66st"
uid="uid://dw3lwgwhpbfx8"
path="res://.godot/imported/playerGrey_up2.png-d6aba85f5f2675ebc7045efa7552ee79.ctex"
metadata={
"vram_texture": false
@@ -18,6 +18,8 @@ dest_files=["res://.godot/imported/playerGrey_up2.png-d6aba85f5f2675ebc7045efa75
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
@@ -25,6 +27,10 @@ mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false

View File

@@ -2,7 +2,7 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://ftkxr8r4qghp"
uid="uid://b2aofu01vxvea"
path="res://.godot/imported/playerGrey_walk1.png-c4773fe7a7bf85d7ab732eb4458c2742.ctex"
metadata={
"vram_texture": false
@@ -18,6 +18,8 @@ dest_files=["res://.godot/imported/playerGrey_walk1.png-c4773fe7a7bf85d7ab732eb4
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
@@ -25,6 +27,10 @@ mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false

View File

@@ -2,7 +2,7 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://couyhcegeihme"
uid="uid://ddjou2q6gxlfr"
path="res://.godot/imported/playerGrey_walk2.png-34d2d916366100182d08037c51884043.ctex"
metadata={
"vram_texture": false
@@ -18,6 +18,8 @@ dest_files=["res://.godot/imported/playerGrey_walk2.png-34d2d916366100182d08037c
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
@@ -25,6 +27,10 @@ mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false

View File

@@ -1,6 +0,0 @@
[gd_resource type="Font" load_steps=2 format=3 uid="uid://dyjc58f6sdms0"]
[ext_resource type="FontData" uid="uid://cit6gwe5px1q8" path="res://fonts/Xolonium-Regular.ttf" id="1_mnk3h"]
[resource]
data/0 = ExtResource( "1_mnk3h" )

View File

@@ -2,7 +2,7 @@
importer="font_data_dynamic"
type="FontFile"
uid="uid://cit6gwe5px1q8"
uid="uid://bgv586r20ps8e"
path="res://.godot/imported/Xolonium-Regular.ttf-bc2981e3069cff4c34dd7c8e2bb73fba.fontdata"
[deps]
@@ -15,13 +15,16 @@ dest_files=["res://.godot/imported/Xolonium-Regular.ttf-bc2981e3069cff4c34dd7c8e
Rendering=null
antialiasing=1
generate_mipmaps=false
disable_embedded_bitmaps=true
multichannel_signed_distance_field=false
msdf_pixel_range=8
msdf_size=48
allow_system_fallback=true
force_autohinter=false
modulate_color_glyphs=false
hinting=1
subpixel_positioning=1
subpixel_positioning=4
keep_rounding_remainders=true
oversampling=0.0
Fallbacks=null
fallbacks=[]

View File

@@ -0,0 +1 @@
uid://c1g57034r2c0

View File

@@ -1,6 +1,7 @@
[gd_scene load_steps=4 format=3 uid="uid://ccqoreueuxdb7"]
[gd_scene load_steps=5 format=3 uid="uid://b0efehuavobda"]
[ext_resource type="Script" path="res://HUD.gd" id="1"]
[ext_resource type="Script" uid="uid://c1g57034r2c0" path="res://hud.gd" id="1"]
[ext_resource type="FontFile" uid="uid://bgv586r20ps8e" path="res://fonts/Xolonium-Regular.ttf" id="2_2jm3i"]
[sub_resource type="InputEventAction" id="InputEventAction_fopy7"]
action = &"start_game"
@@ -16,6 +17,7 @@ anchors_preset = 10
anchor_right = 1.0
offset_bottom = 78.0
grow_horizontal = 2
theme_override_fonts/font = ExtResource("2_2jm3i")
theme_override_font_sizes/font_size = 60
text = "0"
horizontal_alignment = 1
@@ -29,6 +31,7 @@ offset_top = -79.5
offset_bottom = 79.5
grow_horizontal = 2
grow_vertical = 2
theme_override_fonts/font = ExtResource("2_2jm3i")
theme_override_font_sizes/font_size = 60
text = "Dodge the
Creeps"
@@ -46,6 +49,7 @@ offset_right = 90.0
offset_bottom = -100.0
grow_horizontal = 2
grow_vertical = 0
theme_override_fonts/font = ExtResource("2_2jm3i")
theme_override_font_sizes/font_size = 60
shortcut = SubResource("4")
text = "Start"

View File

@@ -2,7 +2,7 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://brwp8bimc75uu"
uid="uid://dfklrdtaun0xt"
path="res://.godot/imported/icon.webp-e94f9a68b0f625a567a797079e4d325f.ctex"
metadata={
"vram_texture": false
@@ -18,6 +18,8 @@ dest_files=["res://.godot/imported/icon.webp-e94f9a68b0f625a567a797079e4d325f.ct
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
@@ -25,6 +27,10 @@ mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false

View File

@@ -29,12 +29,12 @@ func _on_MobTimer_timeout():
var mob_spawn_location = get_node(^"MobPath/MobSpawnLocation")
mob_spawn_location.progress = randi()
# Set the mob's direction perpendicular to the path direction.
var direction = mob_spawn_location.rotation + PI / 2
# Set the mob's position to a random location.
mob.position = mob_spawn_location.position
# Set the mob's direction perpendicular to the path direction.
var direction = mob_spawn_location.rotation + PI / 2
# Add some randomness to the direction.
direction += randf_range(-PI / 4, PI / 4)
mob.rotation = direction
@@ -46,6 +46,7 @@ func _on_MobTimer_timeout():
# Spawn the mob by adding it to the Main scene.
add_child(mob)
func _on_ScoreTimer_timeout():
score += 1
$HUD.update_score(score)

View File

@@ -0,0 +1 @@
uid://c4wt6ace7hycd

View File

@@ -1,11 +1,11 @@
[gd_scene load_steps=8 format=3 uid="uid://cyfwty2q3rdse"]
[gd_scene load_steps=8 format=3 uid="uid://bggkaprn62fwm"]
[ext_resource type="Script" path="res://Main.gd" id="1"]
[ext_resource type="PackedScene" uid="uid://rkdnhqgf2hpj" path="res://Mob.tscn" id="2"]
[ext_resource type="PackedScene" uid="uid://4vwrqjegqwpj" path="res://Player.tscn" id="3"]
[ext_resource type="PackedScene" uid="uid://ccqoreueuxdb7" path="res://HUD.tscn" id="4"]
[ext_resource type="AudioStream" uid="uid://q2pf4fr8d0ks" path="res://art/House In a Forest Loop.ogg" id="5"]
[ext_resource type="AudioStream" uid="uid://dw26fpygeag8o" path="res://art/gameover.wav" id="6"]
[ext_resource type="Script" uid="uid://c4wt6ace7hycd" path="res://main.gd" id="1_0r6n5"]
[ext_resource type="PackedScene" uid="uid://cao351pllxqpa" path="res://mob.tscn" id="2_50pww"]
[ext_resource type="PackedScene" uid="uid://bwhlkliwp13p4" path="res://player.tscn" id="3_veqnc"]
[ext_resource type="PackedScene" uid="uid://b0efehuavobda" path="res://hud.tscn" id="4_0qnje"]
[ext_resource type="AudioStream" uid="uid://sgfduhhw4pno" path="res://art/House In a Forest Loop.ogg" id="5_55d8h"]
[ext_resource type="AudioStream" uid="uid://td2mgko63p61" path="res://art/gameover.wav" id="6_hp1r0"]
[sub_resource type="Curve2D" id="1"]
_data = {
@@ -14,8 +14,8 @@ _data = {
point_count = 5
[node name="Main" type="Node"]
script = ExtResource("1")
mob_scene = ExtResource("2")
script = ExtResource("1_0r6n5")
mob_scene = ExtResource("2_50pww")
[node name="ColorRect" type="ColorRect" parent="."]
anchors_preset = 15
@@ -25,7 +25,7 @@ grow_horizontal = 2
grow_vertical = 2
color = Color(0.219608, 0.372549, 0.380392, 1)
[node name="Player" parent="." instance=ExtResource("3")]
[node name="Player" parent="." instance=ExtResource("3_veqnc")]
[node name="MobTimer" type="Timer" parent="."]
wait_time = 0.5
@@ -44,13 +44,13 @@ curve = SubResource("1")
[node name="MobSpawnLocation" type="PathFollow2D" parent="MobPath"]
[node name="HUD" parent="." instance=ExtResource("4")]
[node name="HUD" parent="." instance=ExtResource("4_0qnje")]
[node name="Music" type="AudioStreamPlayer" parent="."]
stream = ExtResource("5")
stream = ExtResource("5_55d8h")
[node name="DeathSound" type="AudioStreamPlayer" parent="."]
stream = ExtResource("6")
stream = ExtResource("6_hp1r0")
[connection signal="hit" from="Player" to="." method="game_over"]
[connection signal="timeout" from="MobTimer" to="." method="_on_MobTimer_timeout"]

View File

@@ -1,9 +1,9 @@
extends RigidBody2D
func _ready():
$AnimatedSprite2D.play()
var mob_types = Array($AnimatedSprite2D.sprite_frames.get_animation_names())
$AnimatedSprite2D.animation = mob_types.pick_random()
$AnimatedSprite2D.play()
func _on_VisibilityNotifier2D_screen_exited():

View File

@@ -0,0 +1 @@
uid://cypxpb8arjrqt

View File

@@ -0,0 +1,67 @@
[gd_scene load_steps=10 format=3 uid="uid://cao351pllxqpa"]
[ext_resource type="Script" uid="uid://cypxpb8arjrqt" path="res://mob.gd" id="1"]
[ext_resource type="Texture2D" uid="uid://dun74wipekpfq" path="res://art/enemyFlyingAlt_1.png" id="2"]
[ext_resource type="Texture2D" uid="uid://vusf51hepduk" path="res://art/enemyFlyingAlt_2.png" id="3"]
[ext_resource type="Texture2D" uid="uid://dgwhuvn7qb4iy" path="res://art/enemyWalking_1.png" id="4"]
[ext_resource type="Texture2D" uid="uid://dyw702efe6meu" path="res://art/enemyWalking_2.png" id="5"]
[ext_resource type="Texture2D" uid="uid://d182mv7y80xqy" path="res://art/enemySwimming_1.png" id="6"]
[ext_resource type="Texture2D" uid="uid://dmgglhdyowipd" path="res://art/enemySwimming_2.png" id="7"]
[sub_resource type="SpriteFrames" id="1"]
animations = [{
"frames": [{
"duration": 1.0,
"texture": ExtResource("2")
}, {
"duration": 1.0,
"texture": ExtResource("3")
}],
"loop": true,
"name": &"fly",
"speed": 3.0
}, {
"frames": [{
"duration": 1.0,
"texture": ExtResource("6")
}, {
"duration": 1.0,
"texture": ExtResource("7")
}],
"loop": true,
"name": &"swim",
"speed": 4.0
}, {
"frames": [{
"duration": 1.0,
"texture": ExtResource("4")
}, {
"duration": 1.0,
"texture": ExtResource("5")
}],
"loop": true,
"name": &"walk",
"speed": 4.0
}]
[sub_resource type="CapsuleShape2D" id="2"]
radius = 37.0
height = 100.0
[node name="Mob" type="RigidBody2D" groups=["mobs"]]
collision_mask = 0
gravity_scale = 0.0
script = ExtResource("1")
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
scale = Vector2(0.75, 0.75)
sprite_frames = SubResource("1")
animation = &"walk"
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
rotation = 1.5708
shape = SubResource("2")
[node name="VisibleOnScreenNotifier2D" type="VisibleOnScreenNotifier2D" parent="."]
[connection signal="screen_exited" from="VisibleOnScreenNotifier2D" to="." method="_on_VisibilityNotifier2D_screen_exited"]

View File

@@ -47,7 +47,7 @@ func start(pos):
$CollisionShape2D.disabled = false
func _on_Player_body_entered(_body):
func _on_body_entered(_body):
hide() # Player disappears after being hit.
hit.emit()
# Must be deferred as we can't change physics properties on a physics callback.

View File

@@ -0,0 +1 @@
uid://6s0lxctks3qn

View File

@@ -1,10 +1,10 @@
[gd_scene load_steps=13 format=3 uid="uid://4vwrqjegqwpj"]
[gd_scene load_steps=13 format=3 uid="uid://bwhlkliwp13p4"]
[ext_resource type="Script" path="res://Player.gd" id="1"]
[ext_resource type="Texture2D" uid="uid://ftkxr8r4qghp" path="res://art/playerGrey_walk1.png" id="2"]
[ext_resource type="Texture2D" uid="uid://couyhcegeihme" path="res://art/playerGrey_walk2.png" id="3"]
[ext_resource type="Texture2D" uid="uid://b4yyoafu8bi0q" path="res://art/playerGrey_up1.png" id="4"]
[ext_resource type="Texture2D" uid="uid://bko65a0nd66st" path="res://art/playerGrey_up2.png" id="5"]
[ext_resource type="Script" uid="uid://6s0lxctks3qn" path="res://player.gd" id="1"]
[ext_resource type="Texture2D" uid="uid://b2aofu01vxvea" path="res://art/playerGrey_walk1.png" id="2"]
[ext_resource type="Texture2D" uid="uid://ddjou2q6gxlfr" path="res://art/playerGrey_walk2.png" id="3"]
[ext_resource type="Texture2D" uid="uid://bcow5c46vixno" path="res://art/playerGrey_up1.png" id="4"]
[ext_resource type="Texture2D" uid="uid://dw3lwgwhpbfx8" path="res://art/playerGrey_up2.png" id="5"]
[sub_resource type="SpriteFrames" id="1"]
animations = [{
@@ -68,8 +68,8 @@ shape = SubResource("2")
[node name="Trail" type="GPUParticles2D" parent="."]
z_index = -1
amount = 10
process_material = SubResource("7")
texture = ExtResource("2")
speed_scale = 2.0
process_material = SubResource("7")
[connection signal="body_entered" from="." to="." method="_on_Player_body_entered"]
[connection signal="body_entered" from="." to="." method="_on_body_entered"]

View File

@@ -18,14 +18,10 @@ 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."
config/tags=PackedStringArray("2d", "demo", "official")
run/main_scene="res://Main.tscn"
config/features=PackedStringArray("4.2")
run/main_scene="res://main.tscn"
config/features=PackedStringArray("4.5")
config/icon="res://icon.webp"
[debug]
gdscript/warnings/redundant_await=false
[display]
window/size/viewport_width=480
@@ -37,44 +33,45 @@ window/stretch/mode="canvas_items"
[input]
move_left={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":65,"key_label":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194319,"key_label":0,"unicode":0,"echo":false,"script":null)
"deadzone": 0.2,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":65,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194319,"key_label":0,"unicode":0,"location":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,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":68,"key_label":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194321,"key_label":0,"unicode":0,"echo":false,"script":null)
"deadzone": 0.2,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":68,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194321,"key_label":0,"unicode":0,"location":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,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":87,"key_label":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194320,"key_label":0,"unicode":0,"echo":false,"script":null)
"deadzone": 0.2,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":87,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194320,"key_label":0,"unicode":0,"location":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,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":83,"key_label":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194322,"key_label":0,"unicode":0,"echo":false,"script":null)
"deadzone": 0.2,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":83,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194322,"key_label":0,"unicode":0,"location":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,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194309,"key_label":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":32,"key_label":0,"unicode":0,"echo":false,"script":null)
"deadzone": 0.2,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194309,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":32,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
]
}
[rendering]
renderer/rendering_method="mobile"
renderer/rendering_method="gl_compatibility"
renderer/rendering_method.mobile="gl_compatibility"

View File

@@ -6,7 +6,14 @@ to disable collisions per layer.
Language: GDScript
Renderer: OpenGL
Renderer: Compatibility
Check out this demo on the asset library: https://godotengine.org/asset-library/asset/2713
## Note
The new TileMapLayer introduced in Godot 4.3 allows disabling collisions for a layer dynamically using a checkbox in the inspector.
For earlier Godot versions use the procedure described here.
## Screenshots

View File

@@ -2,7 +2,7 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://bpov140lx7at3"
uid="uid://bu5nu8i7xk5ot"
path="res://.godot/imported/icon.png-487276ed1e3a0c39cad0279d744ee560.ctex"
metadata={
"vram_texture": false
@@ -18,6 +18,8 @@ dest_files=["res://.godot/imported/icon.png-487276ed1e3a0c39cad0279d744ee560.cte
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
@@ -25,6 +27,10 @@ mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false

View File

@@ -2,7 +2,7 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://cs8h2qyuakmko"
uid="uid://ddtguaos7uvsy"
path="res://.godot/imported/obstacle.png-06287f6b2d26dd03335fd87ab78c2cc2.ctex"
metadata={
"vram_texture": false
@@ -18,6 +18,8 @@ dest_files=["res://.godot/imported/obstacle.png-06287f6b2d26dd03335fd87ab78c2cc2
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
@@ -25,6 +27,10 @@ mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false

View File

@@ -1,17 +1,10 @@
extends TileMap
extends TileMapLayer
var secret_layer: int # You can have multiple layers if you make this an array.
var player_in_secret: bool
# You can have multiple layers if you make this an array.
var player_in_secret: bool = false
var layer_alpha := 1.0
func _init() -> void:
for i in get_layers_count(): # Find the secret layer by name.
if get_layer_name(i) == "Secret":
secret_layer = i
func _ready() -> void:
set_process(false)
@@ -19,30 +12,31 @@ func _ready() -> void:
func _process(delta: float) -> void:
if player_in_secret:
if layer_alpha > 0.3:
layer_alpha = move_toward(layer_alpha, 0.3, delta) # Animate the layer transparency.
set_layer_modulate(secret_layer, Color(1, 1, 1, layer_alpha))
# Animate the layer transparency.
layer_alpha = move_toward(layer_alpha, 0.3, delta)
self_modulate = Color(1, 1, 1, layer_alpha)
else:
set_process(false)
else:
if layer_alpha < 1.0:
layer_alpha = move_toward(layer_alpha, 1.0, delta)
set_layer_modulate(secret_layer, Color(1, 1, 1, layer_alpha))
self_modulate = Color(1, 1, 1, layer_alpha)
else:
set_process(false)
func _use_tile_data_runtime_update(layer: int, _coords: Vector2i) -> bool:
if layer == secret_layer:
return true
return false
func _use_tile_data_runtime_update(_coords: Vector2i) -> bool:
return true
func _tile_data_runtime_update(_layer: int, _coords: Vector2i, tile_data: TileData) -> void:
tile_data.set_collision_polygons_count(0, 0) # Remove collision for secret layer.
func _tile_data_runtime_update(_coords: Vector2i, tile_data: TileData) -> void:
# Remove collision for secret layer.
tile_data.set_collision_polygons_count(0, 0)
func _on_secret_detector_body_entered(body: Node2D) -> void:
if not body is CharacterBody2D: # Detect player only.
if body is not CharacterBody2D:
# Detect the player only.
return
player_in_secret = true
@@ -50,7 +44,7 @@ func _on_secret_detector_body_entered(body: Node2D) -> void:
func _on_secret_detector_body_exited(body: Node2D) -> void:
if not body is CharacterBody2D:
if body is not CharacterBody2D:
return
player_in_secret = false

View File

@@ -0,0 +1 @@
uid://bu8761rfem0qo

View File

@@ -5,11 +5,11 @@ const WALK_MAX_SPEED = 200
const STOP_FORCE = 1300
const JUMP_SPEED = 200
@onready var gravity = ProjectSettings.get_setting("physics/2d/default_gravity")
@onready var gravity: float = ProjectSettings.get_setting("physics/2d/default_gravity")
func _physics_process(delta):
func _physics_process(delta: float) -> void:
# Horizontal movement code. First, get the player's input.
var walk = WALK_FORCE * (Input.get_axis(&"move_left", &"move_right"))
var walk := WALK_FORCE * (Input.get_axis(&"move_left", &"move_right"))
# Slow down the player if they're not trying to move.
if abs(walk) < WALK_FORCE * 0.2:
# The velocity, slowed down a bit, and then reassigned.

View File

@@ -0,0 +1 @@
uid://brtb2376s322w

View File

@@ -2,7 +2,7 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://dfb8rr2fakwgp"
uid="uid://gewi7do50xix"
path="res://.godot/imported/player.png-1ad27fc2a62fa126eae918723933dd6f.ctex"
metadata={
"vram_texture": false
@@ -18,6 +18,8 @@ dest_files=["res://.godot/imported/player.png-1ad27fc2a62fa126eae918723933dd6f.c
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
@@ -25,6 +27,10 @@ mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false

View File

@@ -1,17 +1,17 @@
[gd_scene load_steps=4 format=2]
[gd_scene load_steps=4 format=3 uid="uid://dpgskpm8nrjyt"]
[ext_resource path="res://player/player.gd" type="Script" id=1]
[ext_resource path="res://player/player.png" type="Texture2D" id=2]
[ext_resource type="Script" uid="uid://brtb2376s322w" path="res://player/player.gd" id="1"]
[ext_resource type="Texture2D" uid="uid://gewi7do50xix" path="res://player/player.png" id="2"]
[sub_resource type="RectangleShape2D" id=1]
extents = Vector2(7, 7)
[sub_resource type="RectangleShape2D" id="1"]
size = Vector2(14, 14)
[node name="Player" type="CharacterBody2D"]
script = ExtResource( 1 )
script = ExtResource("1")
[node name="Sprite2D" type="Sprite2D" parent="."]
texture = ExtResource( 2 )
texture = ExtResource("2")
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2(-0.315559, 0.157784)
shape = SubResource( 1 )
shape = SubResource("1")

View File

@@ -14,10 +14,15 @@ config/name="Dynamic TileMap Layers"
config/description="Example of how to make a kinematic character controller in 2D using
CharacterBody2D. The character moves around, is affected by moving
platforms, can jump through one-way collision platforms, etc."
config/tags=PackedStringArray("2d", "demo", "official", "tilemap")
run/main_scene="res://world.tscn"
config/features=PackedStringArray("4.2")
config/features=PackedStringArray("4.5")
config/icon="res://icon.png"
[debug]
gdscript/warnings/untyped_declaration=1
[display]
window/size/viewport_width=530
@@ -28,29 +33,29 @@ window/stretch/aspect="expand"
[input]
jump={
"deadzone": 0.5,
"deadzone": 0.2,
"events": [Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":0,"pressure":0.0,"pressed":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)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":32,"physical_keycode":0,"key_label":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":87,"key_label":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194320,"key_label":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":32,"physical_keycode":0,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":87,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194320,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
]
}
move_left={
"deadzone": 0.5,
"deadzone": 0.2,
"events": [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)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":65,"key_label":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194319,"key_label":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":65,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194319,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
]
}
move_right={
"deadzone": 0.5,
"deadzone": 0.2,
"events": [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)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":68,"key_label":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194321,"key_label":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":68,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194321,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
]
}
@@ -58,9 +63,10 @@ move_right={
common/physics_ticks_per_second=120
2d/default_gravity=500
common/physics_interpolation=true
[rendering]
renderer/rendering_method="gl_compatibility"
renderer/rendering_method.mobile="gl_compatibility"
environment/defaults/default_clear_color=Color(0.156863, 0.133333, 0.25098, 1)
anti_aliasing/quality/msaa_2d=2

View File

@@ -1,20 +1,15 @@
[gd_scene load_steps=8 format=3 uid="uid://de7qapkqfycxl"]
[gd_scene load_steps=8 format=4 uid="uid://dwfnfhdnt8c6g"]
[ext_resource type="Texture2D" uid="uid://cs8h2qyuakmko" path="res://level/obstacle.png" id="2"]
[ext_resource type="Script" path="res://level/tile_map.gd" id="2_q8fhk"]
[ext_resource type="PackedScene" path="res://player/player.tscn" id="3"]
[ext_resource type="Texture2D" uid="uid://ddtguaos7uvsy" path="res://level/obstacle.png" id="2"]
[ext_resource type="Script" uid="uid://bu8761rfem0qo" path="res://level/tile_map.gd" id="2_q8fhk"]
[ext_resource type="PackedScene" uid="uid://dpgskpm8nrjyt" path="res://player/player.tscn" id="3"]
[sub_resource type="PhysicsMaterial" id="PhysicsMaterial_on5ov"]
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_vnjib"]
texture = ExtResource("2")
0:0/0 = 0
0:0/0/physics_layer_0/linear_velocity = Vector2(0, 0)
0:0/0/physics_layer_0/angular_velocity = 0.0
0:0/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
1:0/0 = 0
1:0/0/physics_layer_0/linear_velocity = Vector2(0, 0)
1:0/0/physics_layer_0/angular_velocity = 0.0
[sub_resource type="TileSet" id="TileSet_xqlka"]
physics_layer_0/collision_layer = 1
@@ -26,23 +21,20 @@ size = Vector2(112, 48)
[node name="World" type="Node2D"]
[node name="TileMap" type="TileMap" parent="."]
z_index = 1
[node name="Ground" type="TileMapLayer" parent="."]
use_parent_material = true
tile_map_data = PackedByteArray("AAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAIAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAYAAAAAAAAAAAAAAAcAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAkAAAAAAAAAAAAAAAoAAAAAAAAAAAAAAAsAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAA0AAAAAAAAAAAAAAA4AAAAAAAAAAAAAAA8AAAAAAAAAAAAAABAAAAAAAAAAAAAAABEAAAAAAAAAAAAAABIAAAAAAAAAAAAAABMAAAAAAAAAAAAAABQAAAAAAAAAAAAAABUAAAAAAAAAAAAAABYAAAAAAAAAAAAAABcAAAAAAAAAAAAAABgAAAAAAAAAAAAAABkAAAAAAAAAAAAAABoAAAAAAAAAAAAAABsAAAAAAAAAAAAAABwAAAAAAAAAAAAAAB0AAAAAAAAAAAAAAB4AAAAAAAAAAAABAAAAAAAAAAAAAAABAAEAAAAAAAAAAAABAAIAAAAAAAAAAAABAAMAAAAAAAAAAAABAAQAAAAAAAAAAAABAAUAAAAAAAAAAAABAAYAAAAAAAAAAAABAAcAAAAAAAAAAAABAAgAAAAAAAAAAAABAAkAAAAAAAAAAAABAAoAAAAAAAAAAAABAAsAAAAAAAAAAAABAAwAAAAAAAAAAAABAA0AAAAAAAAAAAABAA4AAAAAAAAAAAABAA8AAAAAAAAAAAABABAAAAAAAAAAAAABABEAAAAAAAAAAAABABIAAAAAAAAAAAABABMAAAAAAAAAAAABABQAAAAAAAAAAAABABUAAAAAAAAAAAABABYAAAAAAAAAAAABABcAAAAAAAAAAAABABgAAAAAAAAAAAABABkAAAAAAAAAAAABABoAAAAAAAAAAAABABsAAAAAAAAAAAABABwAAAAAAAAAAAABAB0AAAAAAAAAAAABAB4AAAAAAAAAAAACAAAAAAAAAAAAAAACAAEAAAAAAAAAAAACAB0AAAAAAAAAAAACAB4AAAAAAAAAAAADAAAAAAAAAAAAAAADAAEAAAAAAAAAAAADAB0AAAAAAAAAAAADAB4AAAAAAAAAAAAEAAAAAAAAAAAAAAAEAAEAAAAAAAAAAAAEAB0AAAAAAAAAAAAEAB4AAAAAAAAAAAAFAAAAAAAAAAAAAAAFAAEAAAAAAAAAAAAFAB0AAAAAAAAAAAAFAB4AAAAAAAAAAAAGAAAAAAAAAAAAAAAGAAEAAAAAAAAAAAAGAB0AAAAAAAAAAAAGAB4AAAAAAAAAAAAHAAAAAAAAAAAAAAAHAAEAAAAAAAAAAAAHAB0AAAAAAAAAAAAHAB4AAAAAAAAAAAAIAAAAAAAAAAAAAAAIAAEAAAAAAAAAAAAIAB0AAAAAAAAAAAAIAB4AAAAAAAAAAAAJAAAAAAAAAAAAAAAJAAEAAAAAAAAAAAAJAB0AAAAAAAAAAAAJAB4AAAAAAAAAAAAKAAAAAAAAAAAAAAAKAAEAAAAAAAAAAAAKAB0AAAAAAAAAAAAKAB4AAAAAAAAAAAALAAAAAAAAAAAAAAALAAEAAAAAAAAAAAALAB0AAAAAAAAAAAALAB4AAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAEAAAAAAAAAAAAMAB0AAAAAAAAAAAAMAB4AAAAAAAAAAAANAAAAAAAAAAAAAAANAAEAAAAAAAAAAAANAB0AAAAAAAAAAAANAB4AAAAAAAAAAAAOAAAAAAAAAAAAAAAOAAEAAAAAAAAAAAAOAB0AAAAAAAAAAAAOAB4AAAAAAAAAAAAPAAAAAAAAAAAAAAAPAAEAAAAAAAAAAAAPAB0AAAAAAAAAAAAPAB4AAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAEAAAAAAAAAAAAQAB0AAAAAAAAAAAAQAB4AAAAAAAAAAAARAAAAAAAAAAAAAAARAAEAAAAAAAAAAAARAB0AAAAAAAAAAAARAB4AAAAAAAAAAAASAAAAAAAAAAAAAAASAAEAAAAAAAAAAAASAB0AAAAAAAAAAAASAB4AAAAAAAAAAAATAAAAAAAAAAAAAAATAAEAAAAAAAAAAAATAB0AAAAAAAAAAAATAB4AAAAAAAAAAAAUAAAAAAAAAAAAAAAUAAEAAAAAAAAAAAAUAB0AAAAAAAAAAAAUAB4AAAAAAAAAAAAVAAAAAAAAAAAAAAAVAAEAAAAAAAAAAAAVAB0AAAAAAAAAAAAVAB4AAAAAAAAAAAAWAAAAAAAAAAAAAAAWAAEAAAAAAAAAAAAWAB0AAAAAAAAAAAAWAB4AAAAAAAAAAAAXAAAAAAAAAAAAAAAXAAEAAAAAAAAAAAAXAB0AAAAAAAAAAAAXAB4AAAAAAAAAAAAYAAAAAAAAAAAAAAAYAAEAAAAAAAAAAAAYAB0AAAAAAAAAAAAYAB4AAAAAAAAAAAAZAAAAAAAAAAAAAAAZAAEAAAAAAAAAAAAZAB0AAAAAAAAAAAAZAB4AAAAAAAAAAAAaAAAAAAAAAAAAAAAaAAEAAAAAAAAAAAAaAB0AAAAAAAAAAAAaAB4AAAAAAAAAAAAbAAAAAAAAAAAAAAAbAAEAAAAAAAAAAAAbAB0AAAAAAAAAAAAbAB4AAAAAAAAAAAAcAAAAAAAAAAAAAAAcAAEAAAAAAAAAAAAcAB0AAAAAAAAAAAAcAB4AAAAAAAAAAAAdAAAAAAAAAAAAAAAdAAEAAAAAAAAAAAAdAB0AAAAAAAAAAAAdAB4AAAAAAAAAAAAeAAAAAAAAAAAAAAAeAAEAAAAAAAAAAAAeAB0AAAAAAAAAAAAeAB4AAAAAAAAAAAAfAAAAAAAAAAAAAAAfAAEAAAAAAAAAAAAfAAIAAAAAAAAAAAAfAAMAAAAAAAAAAAAfAAQAAAAAAAAAAAAfAAUAAAAAAAAAAAAfAAYAAAAAAAAAAAAfAAcAAAAAAAAAAAAfAAgAAAAAAAAAAAAfAAkAAAAAAAAAAAAfAAoAAAAAAAAAAAAfAAsAAAAAAAAAAAAfAAwAAAAAAAAAAAAfAA0AAAAAAAAAAAAfAA4AAAAAAAAAAAAfAA8AAAAAAAAAAAAfABAAAAAAAAAAAAAfABEAAAAAAAAAAAAfABIAAAAAAAAAAAAfABMAAAAAAAAAAAAfABQAAAAAAAAAAAAfABUAAAAAAAAAAAAfABYAAAAAAAAAAAAfABcAAAAAAAAAAAAfABgAAAAAAAAAAAAfABkAAAAAAAAAAAAfABoAAAAAAAAAAAAfABsAAAAAAAAAAAAfABwAAAAAAAAAAAAfAB0AAAAAAAAAAAAfAB4AAAAAAAAAAAAgAAAAAAAAAAAAAAAgAAEAAAAAAAAAAAAgAAIAAAAAAAAAAAAgAAMAAAAAAAAAAAAgAAQAAAAAAAAAAAAgAAUAAAAAAAAAAAAgAAYAAAAAAAAAAAAgAAcAAAAAAAAAAAAgAAgAAAAAAAAAAAAgAAkAAAAAAAAAAAAgAAoAAAAAAAAAAAAgAAsAAAAAAAAAAAAgAAwAAAAAAAAAAAAgAA0AAAAAAAAAAAAgAA4AAAAAAAAAAAAgAA8AAAAAAAAAAAAgABAAAAAAAAAAAAAgABEAAAAAAAAAAAAgABIAAAAAAAAAAAAgABMAAAAAAAAAAAAgABQAAAAAAAAAAAAgABUAAAAAAAAAAAAgABYAAAAAAAAAAAAgABcAAAAAAAAAAAAgABgAAAAAAAAAAAAgABkAAAAAAAAAAAAgABoAAAAAAAAAAAAgABsAAAAAAAAAAAAgABwAAAAAAAAAAAAgAB0AAAAAAAAAAAAgAB4AAAAAAAAAAAAOABgAAAAAAAAAAAAPABgAAAAAAAAAAAAQABgAAAAAAAAAAAARABgAAAAAAAAAAAASABgAAAAAAAAAAAATABgAAAAAAAAAAAAUABgAAAAAAAAAAAAUABcAAAAAAAAAAAAUABYAAAAAAAAAAAATABYAAAAAAAAAAAASABYAAAAAAAAAAAARABYAAAAAAAAAAAAQABYAAAAAAAAAAAAPABYAAAAAAAAAAAAOABYAAAAAAAAAAAAOABcAAAAAAAAAAAAPABcAAAAAAAAAAAAQABcAAAAAAAAAAAARABcAAAAAAAAAAAASABcAAAAAAAAAAAATABcAAAAAAAAAAAAOABkAAAAAAAAAAAAPABkAAAAAAAAAAAAQABkAAAAAAAAAAAARABkAAAAAAAAAAAASABkAAAAAAAAAAAATABkAAAAAAAAAAAAUABkAAAAAAAAAAAA=")
tile_set = SubResource("TileSet_xqlka")
[node name="Secret" type="TileMapLayer" parent="."]
use_parent_material = true
tile_map_data = PackedByteArray("AAAOABoAAAAAAAAAAAAOABsAAAAAAAAAAAAOABwAAAAAAAAAAAAPABoAAAAAAAAAAAAPABsAAAAAAAAAAAAPABwAAAAAAAAAAAAQABoAAAAAAAAAAAAQABsAAAAAAAAAAAAQABwAAAAAAAAAAAARABoAAAAAAAAAAAARABsAAAAAAAAAAAARABwAAAAAAAAAAAASABoAAAAAAAAAAAASABsAAAAAAAAAAAASABwAAAAAAAAAAAATABoAAAAAAAAAAAATABsAAAAAAAAAAAATABwAAAAAAAAAAAAUABoAAAAAAAAAAAAUABsAAAAAAAAAAAAUABwAAAAAAAAAAAA=")
tile_set = SubResource("TileSet_xqlka")
format = 2
layer_0/name = "Ground"
layer_0/tile_data = PackedInt32Array(0, 0, 0, 65536, 0, 0, 131072, 0, 0, 196608, 0, 0, 262144, 0, 0, 327680, 0, 0, 393216, 0, 0, 458752, 0, 0, 524288, 0, 0, 589824, 0, 0, 655360, 0, 0, 720896, 0, 0, 786432, 0, 0, 851968, 0, 0, 917504, 0, 0, 983040, 0, 0, 1048576, 0, 0, 1114112, 0, 0, 1179648, 0, 0, 1245184, 0, 0, 1310720, 0, 0, 1376256, 0, 0, 1441792, 0, 0, 1507328, 0, 0, 1572864, 0, 0, 1638400, 0, 0, 1703936, 0, 0, 1769472, 0, 0, 1835008, 0, 0, 1900544, 0, 0, 1966080, 0, 0, 1, 0, 0, 65537, 0, 0, 131073, 0, 0, 196609, 0, 0, 262145, 0, 0, 327681, 0, 0, 393217, 0, 0, 458753, 0, 0, 524289, 0, 0, 589825, 0, 0, 655361, 0, 0, 720897, 0, 0, 786433, 0, 0, 851969, 0, 0, 917505, 0, 0, 983041, 0, 0, 1048577, 0, 0, 1114113, 0, 0, 1179649, 0, 0, 1245185, 0, 0, 1310721, 0, 0, 1376257, 0, 0, 1441793, 0, 0, 1507329, 0, 0, 1572865, 0, 0, 1638401, 0, 0, 1703937, 0, 0, 1769473, 0, 0, 1835009, 0, 0, 1900545, 0, 0, 1966081, 0, 0, 2, 0, 0, 65538, 0, 0, 1900546, 0, 0, 1966082, 0, 0, 3, 0, 0, 65539, 0, 0, 1900547, 0, 0, 1966083, 0, 0, 4, 0, 0, 65540, 0, 0, 1900548, 0, 0, 1966084, 0, 0, 5, 0, 0, 65541, 0, 0, 1900549, 0, 0, 1966085, 0, 0, 6, 0, 0, 65542, 0, 0, 1900550, 0, 0, 1966086, 0, 0, 7, 0, 0, 65543, 0, 0, 1900551, 0, 0, 1966087, 0, 0, 8, 0, 0, 65544, 0, 0, 1900552, 0, 0, 1966088, 0, 0, 9, 0, 0, 65545, 0, 0, 1900553, 0, 0, 1966089, 0, 0, 10, 0, 0, 65546, 0, 0, 1900554, 0, 0, 1966090, 0, 0, 11, 0, 0, 65547, 0, 0, 1900555, 0, 0, 1966091, 0, 0, 12, 0, 0, 65548, 0, 0, 1900556, 0, 0, 1966092, 0, 0, 13, 0, 0, 65549, 0, 0, 1900557, 0, 0, 1966093, 0, 0, 14, 0, 0, 65550, 0, 0, 1900558, 0, 0, 1966094, 0, 0, 15, 0, 0, 65551, 0, 0, 1900559, 0, 0, 1966095, 0, 0, 16, 0, 0, 65552, 0, 0, 1900560, 0, 0, 1966096, 0, 0, 17, 0, 0, 65553, 0, 0, 1900561, 0, 0, 1966097, 0, 0, 18, 0, 0, 65554, 0, 0, 1900562, 0, 0, 1966098, 0, 0, 19, 0, 0, 65555, 0, 0, 1900563, 0, 0, 1966099, 0, 0, 20, 0, 0, 65556, 0, 0, 1900564, 0, 0, 1966100, 0, 0, 21, 0, 0, 65557, 0, 0, 1900565, 0, 0, 1966101, 0, 0, 22, 0, 0, 65558, 0, 0, 1900566, 0, 0, 1966102, 0, 0, 23, 0, 0, 65559, 0, 0, 1900567, 0, 0, 1966103, 0, 0, 24, 0, 0, 65560, 0, 0, 1900568, 0, 0, 1966104, 0, 0, 25, 0, 0, 65561, 0, 0, 1900569, 0, 0, 1966105, 0, 0, 26, 0, 0, 65562, 0, 0, 1900570, 0, 0, 1966106, 0, 0, 27, 0, 0, 65563, 0, 0, 1900571, 0, 0, 1966107, 0, 0, 28, 0, 0, 65564, 0, 0, 1900572, 0, 0, 1966108, 0, 0, 29, 0, 0, 65565, 0, 0, 1900573, 0, 0, 1966109, 0, 0, 30, 0, 0, 65566, 0, 0, 1900574, 0, 0, 1966110, 0, 0, 31, 0, 0, 65567, 0, 0, 131103, 0, 0, 196639, 0, 0, 262175, 0, 0, 327711, 0, 0, 393247, 0, 0, 458783, 0, 0, 524319, 0, 0, 589855, 0, 0, 655391, 0, 0, 720927, 0, 0, 786463, 0, 0, 851999, 0, 0, 917535, 0, 0, 983071, 0, 0, 1048607, 0, 0, 1114143, 0, 0, 1179679, 0, 0, 1245215, 0, 0, 1310751, 0, 0, 1376287, 0, 0, 1441823, 0, 0, 1507359, 0, 0, 1572895, 0, 0, 1638431, 0, 0, 1703967, 0, 0, 1769503, 0, 0, 1835039, 0, 0, 1900575, 0, 0, 1966111, 0, 0, 32, 0, 0, 65568, 0, 0, 131104, 0, 0, 196640, 0, 0, 262176, 0, 0, 327712, 0, 0, 393248, 0, 0, 458784, 0, 0, 524320, 0, 0, 589856, 0, 0, 655392, 0, 0, 720928, 0, 0, 786464, 0, 0, 852000, 0, 0, 917536, 0, 0, 983072, 0, 0, 1048608, 0, 0, 1114144, 0, 0, 1179680, 0, 0, 1245216, 0, 0, 1310752, 0, 0, 1376288, 0, 0, 1441824, 0, 0, 1507360, 0, 0, 1572896, 0, 0, 1638432, 0, 0, 1703968, 0, 0, 1769504, 0, 0, 1835040, 0, 0, 1900576, 0, 0, 1966112, 0, 0, 1572878, 0, 0, 1572879, 0, 0, 1572880, 0, 0, 1572881, 0, 0, 1572882, 0, 0, 1572883, 0, 0, 1572884, 0, 0, 1507348, 0, 0, 1441812, 0, 0, 1441811, 0, 0, 1441810, 0, 0, 1441809, 0, 0, 1441808, 0, 0, 1441807, 0, 0, 1441806, 0, 0, 1507342, 0, 0, 1507343, 0, 0, 1507344, 0, 0, 1507345, 0, 0, 1507346, 0, 0, 1507347, 0, 0, 1638414, 0, 0, 1638415, 0, 0, 1638416, 0, 0, 1638417, 0, 0, 1638418, 0, 0, 1638419, 0, 0, 1638420, 0, 0)
layer_1/name = "Secret"
layer_1/enabled = true
layer_1/modulate = Color(1, 1, 1, 1)
layer_1/y_sort_enabled = false
layer_1/y_sort_origin = 0
layer_1/z_index = 0
layer_1/tile_data = PackedInt32Array(1703950, 0, 0, 1769486, 0, 0, 1835022, 0, 0, 1703951, 0, 0, 1769487, 0, 0, 1835023, 0, 0, 1703952, 0, 0, 1769488, 0, 0, 1835024, 0, 0, 1703953, 0, 0, 1769489, 0, 0, 1835025, 0, 0, 1703954, 0, 0, 1769490, 0, 0, 1835026, 0, 0, 1703955, 0, 0, 1769491, 0, 0, 1835027, 0, 0, 1703956, 0, 0, 1769492, 0, 0, 1835028, 0, 0)
script = ExtResource("2_q8fhk")
[node name="Camera2D" type="Camera2D" parent="."]
offset = Vector2(265, 247)
process_callback = 0
[node name="Player" parent="." instance=ExtResource("3")]
position = Vector2(120, 456)
@@ -53,5 +45,5 @@ position = Vector2(280, 440)
[node name="CollisionShape2D" type="CollisionShape2D" parent="SecretDetector"]
shape = SubResource("RectangleShape2D_a2gec")
[connection signal="body_entered" from="SecretDetector" to="TileMap" method="_on_secret_detector_body_entered"]
[connection signal="body_exited" from="SecretDetector" to="TileMap" method="_on_secret_detector_body_exited"]
[connection signal="body_entered" from="SecretDetector" to="Secret" method="_on_secret_detector_body_entered"]
[connection signal="body_exited" from="SecretDetector" to="Secret" method="_on_secret_detector_body_exited"]

View File

@@ -1,8 +1,9 @@
[gd_scene load_steps=8 format=3 uid="uid://dmn8nkpogiwsf"]
[gd_scene load_steps=9 format=3 uid="uid://c5wi3c5syuikd"]
[ext_resource type="PackedScene" uid="uid://bpdyvy2681m3i" path="res://player/Player.tscn" id="1"]
[ext_resource type="PackedScene" uid="uid://cvi13chv8g4hj" path="res://debug/StatesStackDiplayer.tscn" id="3"]
[ext_resource type="PackedScene" uid="uid://bq6rrfy53rfvo" path="res://debug/ControlsPanel.tscn" id="4"]
[ext_resource type="PackedScene" uid="uid://dsqn0vre7npvu" path="res://player/Player.tscn" id="1"]
[ext_resource type="FontFile" uid="uid://nv3lhuvgflbt" path="res://fonts/SourceCodePro-Bold.ttf" id="2_r1c5f"]
[ext_resource type="PackedScene" uid="uid://b4j5pvcv4ksxw" path="res://debug/StatesStackDiplayer.tscn" id="3"]
[ext_resource type="PackedScene" uid="uid://ywml2fct1qf5" path="res://debug/ControlsPanel.tscn" id="4"]
[sub_resource type="Animation" id="1"]
@@ -25,9 +26,9 @@ tracks/0/keys = {
[sub_resource type="AnimationLibrary" id="AnimationLibrary_qbwwp"]
_data = {
"idle": SubResource("1"),
"stagger": SubResource("2"),
"walk": SubResource("3")
&"idle": SubResource("1"),
&"stagger": SubResource("2"),
&"walk": SubResource("3")
}
[node name="Demo" type="Node"]
@@ -40,9 +41,13 @@ start_state = NodePath("Idle")
[node name="AnimationPlayer" parent="Player" index="1"]
libraries = {
"": SubResource("AnimationLibrary_qbwwp")
&"": SubResource("AnimationLibrary_qbwwp")
}
[node name="StateNameDisplayer" parent="Player" index="5"]
physics_interpolation_mode = 1
theme_override_fonts/font = ExtResource("2_r1c5f")
[node name="Explanations" type="RichTextLabel" parent="."]
anchors_preset = 15
anchor_right = 1.0

View File

@@ -8,7 +8,7 @@ Language: GDScript
Renderer: Compatibility
Check out this demo on the asset library: https://godotengine.org/asset-library/asset/516
Check out this demo on the asset library: https://godotengine.org/asset-library/asset/2714
## Why use a state machine

View File

@@ -1,4 +1,4 @@
[gd_scene format=3 uid="uid://bq6rrfy53rfvo"]
[gd_scene format=3 uid="uid://ywml2fct1qf5"]
[node name="ControlsPanel" type="Panel"]
anchors_preset = 1

View File

@@ -1,4 +1,4 @@
[gd_scene format=3 uid="uid://bywptem1jb35a"]
[gd_scene format=3 uid="uid://b2jd1klfmq7jp"]
[node name="Explanations" type="RichTextLabel"]
anchors_preset = 15

View File

@@ -1,6 +1,7 @@
[gd_scene load_steps=2 format=3 uid="uid://cvi13chv8g4hj"]
[gd_scene load_steps=3 format=3 uid="uid://b4j5pvcv4ksxw"]
[ext_resource type="Script" path="res://debug/states_stack_displayer.gd" id="1"]
[ext_resource type="Script" uid="uid://h4p2eq3snhjs" path="res://debug/states_stack_displayer.gd" id="1"]
[ext_resource type="FontFile" uid="uid://nv3lhuvgflbt" path="res://fonts/SourceCodePro-Bold.ttf" id="2_58if7"]
[node name="StatesStackDiplayer" type="Panel"]
offset_right = 210.0
@@ -17,6 +18,7 @@ grow_vertical = 2
[node name="Title" type="Label" parent="VBoxContainer"]
layout_mode = 2
theme_override_fonts/font = ExtResource("2_58if7")
text = "StateStack"
uppercase = true
@@ -26,6 +28,7 @@ layout_mode = 2
[node name="Numbers" type="Label" parent="VBoxContainer/HBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
theme_override_fonts/font = ExtResource("2_58if7")
text = "1.
2."
horizontal_alignment = 2
@@ -33,5 +36,6 @@ horizontal_alignment = 2
[node name="States" type="Label" parent="VBoxContainer/HBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
theme_override_fonts/font = ExtResource("2_58if7")
text = "Jump
Test"

View File

@@ -1,14 +1,16 @@
extends Panel
@onready var fsm_node = get_node(^"../../Player/StateMachine")
@onready var fsm_node: 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 += String(state.get_name()) + "\n"
func _process(_delta: float) -> void:
var states_names: String = ""
var numbers: String = ""
var index := 0
for state: Node in fsm_node.states_stack:
states_names += String(state.name) + "\n"
numbers += str(index) + "\n"
index += 1
%States.text = states_names
%Numbers.text = numbers

View File

@@ -0,0 +1 @@
uid://h4p2eq3snhjs

View File

@@ -2,7 +2,7 @@
importer="font_data_dynamic"
type="FontFile"
uid="uid://b5bspum6ffekd"
uid="uid://nv3lhuvgflbt"
path="res://.godot/imported/SourceCodePro-Bold.ttf-bf03bd9c90603419d32725fc00754bf7.fontdata"
[deps]
@@ -15,13 +15,16 @@ dest_files=["res://.godot/imported/SourceCodePro-Bold.ttf-bf03bd9c90603419d32725
Rendering=null
antialiasing=1
generate_mipmaps=false
disable_embedded_bitmaps=true
multichannel_signed_distance_field=false
msdf_pixel_range=8
msdf_size=48
allow_system_fallback=true
force_autohinter=false
modulate_color_glyphs=false
hinting=1
subpixel_positioning=1
subpixel_positioning=4
keep_rounding_remainders=true
oversampling=0.0
Fallbacks=null
fallbacks=[]

View File

@@ -1,12 +0,0 @@
[gd_resource type="Font" load_steps=2 format=2]
[ext_resource path="res://fonts/SourceCodePro-Bold.ttf" type="FontData" id=1]
[resource]
size = 20
use_mipmaps = false
use_filter = true
font_data = ExtResource( 1 )
_sections_unfolded = [ "Font", "Settings" ]

View File

@@ -1,12 +0,0 @@
[gd_resource type="Font" load_steps=2 format=2]
[ext_resource path="res://fonts/SourceCodePro-Black.ttf" type="FontData" id=1]
[resource]
size = 24
use_mipmaps = false
use_filter = true
font_data = ExtResource( 1 )
_sections_unfolded = [ "Font", "Settings" ]

View File

@@ -2,7 +2,7 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://brwp8bimc75uu"
uid="uid://gh22fu6herde"
path="res://.godot/imported/icon.webp-e94f9a68b0f625a567a797079e4d325f.ctex"
metadata={
"vram_texture": false
@@ -18,6 +18,8 @@ dest_files=["res://.godot/imported/icon.webp-e94f9a68b0f625a567a797079e4d325f.ct
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
@@ -25,6 +27,10 @@ mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false

View File

@@ -1,19 +1,19 @@
[gd_scene load_steps=19 format=3 uid="uid://bpdyvy2681m3i"]
[gd_scene load_steps=19 format=3 uid="uid://dsqn0vre7npvu"]
[ext_resource type="Script" path="res://player/player_controller.gd" id="1"]
[ext_resource type="Script" path="res://player/player_state_machine.gd" id="2"]
[ext_resource type="Script" path="res://player/states/motion/on_ground/idle.gd" id="3"]
[ext_resource type="Script" path="res://player/states/motion/on_ground/move.gd" id="4"]
[ext_resource type="Script" path="res://player/states/motion/in_air/jump.gd" id="5"]
[ext_resource type="Script" path="res://player/states/combat/stagger.gd" id="6"]
[ext_resource type="Script" path="res://player/states/combat/attack.gd" id="7"]
[ext_resource type="Script" path="res://player/states/die.gd" id="8"]
[ext_resource type="Texture2D" uid="uid://eds33w28pilu" path="res://player/shadow.png" id="9"]
[ext_resource type="Texture2D" uid="uid://ds53oxkqrcumd" path="res://player/body.png" id="10"]
[ext_resource type="Script" path="res://player/bullet/bullet_spawner.gd" id="11"]
[ext_resource type="Script" path="res://player/weapon/weapon_pivot.gd" id="12"]
[ext_resource type="PackedScene" uid="uid://cdacdp11r3jua" path="res://player/weapon/Sword.tscn" id="13"]
[ext_resource type="Script" path="res://player/states/debug/state_name_displayer.gd" id="15"]
[ext_resource type="Script" uid="uid://bctcyb2y6vuvd" path="res://player/player_controller.gd" id="1"]
[ext_resource type="Script" uid="uid://c5dcvd5nvu0e0" path="res://player/player_state_machine.gd" id="2"]
[ext_resource type="Script" uid="uid://b62dqs7qjx007" path="res://player/states/motion/on_ground/idle.gd" id="3"]
[ext_resource type="Script" uid="uid://c8ngtisnb8frh" path="res://player/states/motion/on_ground/move.gd" id="4"]
[ext_resource type="Script" uid="uid://8ytqj8c1k3qs" path="res://player/states/motion/in_air/jump.gd" id="5"]
[ext_resource type="Script" uid="uid://bul61icehhvnh" path="res://player/states/combat/stagger.gd" id="6"]
[ext_resource type="Script" uid="uid://carcuc5mfmg4d" path="res://player/states/combat/attack.gd" id="7"]
[ext_resource type="Script" uid="uid://byy33gmrsievj" path="res://player/states/die.gd" id="8"]
[ext_resource type="Texture2D" uid="uid://dlpmesnd2veay" path="res://player/shadow.png" id="9"]
[ext_resource type="Texture2D" uid="uid://crgo36sk7sfdg" path="res://player/body.png" id="10"]
[ext_resource type="Script" uid="uid://c3h6s4u67cogm" path="res://player/bullet/bullet_spawner.gd" id="11"]
[ext_resource type="Script" uid="uid://beommici1nnah" path="res://player/weapon/weapon_pivot.gd" id="12"]
[ext_resource type="PackedScene" uid="uid://bgy8u8c4ge6oo" path="res://player/weapon/Sword.tscn" id="13"]
[ext_resource type="Script" uid="uid://qc5os1n5tx4u" path="res://player/states/debug/state_name_displayer.gd" id="15"]
[sub_resource type="Animation" id="1"]
@@ -36,9 +36,9 @@ tracks/0/keys = {
[sub_resource type="AnimationLibrary" id="AnimationLibrary_vi1hn"]
_data = {
"idle": SubResource("1"),
"stagger": SubResource("2"),
"walk": SubResource("3")
&"idle": SubResource("1"),
&"stagger": SubResource("2"),
&"walk": SubResource("3")
}
[node name="Player" type="CharacterBody2D"]
@@ -67,7 +67,7 @@ script = ExtResource("8")
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
libraries = {
"": SubResource("AnimationLibrary_vi1hn")
&"": SubResource("AnimationLibrary_vi1hn")
}
[node name="Shadow" type="Sprite2D" parent="."]

Some files were not shown because too many files have changed in this diff Show More