Commit Graph

434 Commits

Author SHA1 Message Date
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
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
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
Hugo Locurcio
f78efc69ee Add a custom drawing in 2D demo (#1185) 2025-05-30 17:29:06 +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
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
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
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
Mohamed Koubaa
be77353917 Move position setting code to be before direction in Dodge the Creeps (#1151) 2025-01-10 19:52:54 +01: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
Danil Alexeev
c492e5fd73 Update some GDScript files for Godot 4.3 (#1129) 2024-11-04 12:00:59 +01: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
Tyler Breisacher
fa6061c623 Add static types in 2D Navigation AStar demo (#1008) 2024-08-31 03:48:17 +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
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
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
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
Hugo Locurcio
fbb7cb442c Fix ball speedup logic in Pong demo (#1073) 2024-06-13 12:31:10 +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
谢天
95cfb076d1 Add missing tags to several demos (#1048) 2024-04-18 22:24:47 +02: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
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
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
Hugo Locurcio
4d01a2678f Port demos with remade art assets to Godot 4 (#922)
This re-ports the following demos to Godot 4 following their latest `3.x` versions:

- 2D Navigation with AStarGrid2D
- 2D JRPG Demo
- 2D Isometric Game
- 2D Platformer

Some tweaks have also been made in the process, such as split screen players
having different colors in the 2D Platformer demo.

Co-authored-by: Nonparoxysmic <69494951+Nonparoxysmic@users.noreply.github.com>
2024-02-10 01:40:04 +01:00
Luis Henrique Rocha
8fc246a051 Fix vertical movement sprite in Dodge the Creeps (#1006)
Using rotation in the player node instead of flipping vertically, by doing so the trail is also rotated.
2024-02-07 23:16:03 +01:00
Hugo Locurcio
2a962929f3 Update demo files for Godot 4.2.1 (#1013)
All demos were opened with Godot 4.2.1, with the mesh format
upgraded for 3D demos.

The 3D antialiasing demo now uses Extra Cull Margin on the last
object to prevent it from disappearing too early when the camera
rotates (due to its use of shader-based animation).
2024-02-01 17:30:08 +01:00
Nazarwadim
40ce32c5da Fix player trail appearance in Dodge The Creeps (#986) 2023-10-30 18:47:37 +01:00
David Briscoe
757cc4261c Update 2D Skeleton demo for Godot 4.1 (#976) 2023-10-25 04:42:32 +02:00
Alex
7e9d31bb04 Fix one-way collision script error in 2D Physics Tests (#962) 2023-10-18 03:24:59 +02:00
Tomek
84b7f9ea36 Add dynamic TileMap layer demo (#954) 2023-10-18 03:22:09 +02:00
David Briscoe
3706e3e998 Map attack to gamepad X, revise text in Finite State Machine demo (#937) 2023-10-18 02:53:17 +02:00
Alex
647002a75c Port Navigation Polygon 2D demo to Godot 4.1 (#955) 2023-10-18 01:58:34 +02:00
Alex
9484fbbace Fix errors in Physics-Based Platformer 2D demo (#958) 2023-10-18 01:40:43 +02:00
Hugo Locurcio
e9f0f75c5b Update "Grid-based Navigation with AStarGrid2D" demo for 4.1 (#914)
Update "Grid-based Navigation with AStarGrid2D" demo for 4.1
2023-08-07 14:00:14 +02:00