Compare commits

..

261 Commits
3.5 ... 4.1

Author SHA1 Message Date
Aaron Franke
6ecf265637 [4.1] Simplify list of branches in the README (#1255) 2025-10-02 17:06:28 -07:00
Hugo Locurcio
157b432c80 Update README for new branches 2024-03-06 19:34:26 +01:00
Alex
7af99c55ef Update WebSocket Minimal demo for Godot 4.1 (#990) 2023-10-30 18:44:30 +01:00
Alex
232eb35acf Update Mobile Sensors demo for Godot 4.1 (#992) 2023-10-30 18:44:11 +01:00
David Briscoe
757cc4261c Update 2D Skeleton demo for Godot 4.1 (#976) 2023-10-25 04:42:32 +02:00
Alex
851862f8db Update Multitouch Cubes demo for Godot 4.1 (#989) 2023-10-25 01:51:22 +02:00
Alex
5689210c46 Fix player occasionally not being hit by bomb in Multiplayer Bomber (#987)
If the bomb and the player are at the same position, then `intersect_ray` returns no result.
`query.hit_from_inside = true` fixes the problem. The other changes were made automatically by Godot.
2023-10-23 00:09:54 +02:00
Aaron Franke
4d31672264 Merge pull request #982 from satoshidisciple/fix_bug/webrtc_signaling
Example of "webrtc_signaling" not working on the web
2023-10-20 19:34:29 -05:00
Alex
7e9d31bb04 Fix one-way collision script error in 2D Physics Tests (#962) 2023-10-18 03:24:59 +02:00
David Briscoe
1b61bc4bb0 Use NavigationAgent3D in 3D Navigation demo (#975)
Co-authored-by: Hugo Locurcio <hugo.locurcio@hugo.pro>
2023-10-18 03:23:57 +02:00
Tomek
84b7f9ea36 Add dynamic TileMap layer demo (#954) 2023-10-18 03:22:09 +02:00
S Manikanta Varshit
d880218056 Fix typo in Mobile sensors script comment (#947) 2023-10-18 03:19:05 +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
e2abd0e7fb Update Matrix Transform demo to Godot 4.1 (#978)
Co-authored-by: Hugo Locurcio <hugo.locurcio@hugo.pro>
2023-10-18 02:38:00 +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
Alex
1c169add0d Add FPS counter, V-Sync and Limit FPS to 3D Anti-Aliasing demo (#968) 2023-10-18 01:36:39 +02:00
Alex
7e43dbf64b Make animations smoother in Audio Spectrum demo (#972) 2023-10-18 01:31:12 +02:00
Alex
ce4600350e Add Limit FPS option to the 3D Graphics Settings demo (#970) 2023-10-18 01:30:06 +02:00
Satoshi Disciple
db8ac0422d make websocket pool every time 2023-10-16 22:53:00 -03:00
Hugo Locurcio
fc7ff91882 Add glass material to Procedural materials demo (#980) 2023-10-11 22:35:23 +02:00
Alex
0dfb54ff7f Fix HSlider and test_collision_pairs in 3D Physics Tests (#971)
Co-authored-by: Hugo Locurcio <hugo.locurcio@hugo.pro>
2023-10-01 03:55:10 +02:00
Hugo Locurcio
65b34f8192 Update Voxel demo for Godot 4.1.1 (#965) 2023-09-24 23:41:35 +02:00
behrooz bozorg chami
ad2cdfebd4 Update Multitouch View demo for Godot 4.1 (#960) 2023-09-22 21:42:37 +02:00
Hugo Locurcio
1113bafac4 Merge pull request #945 from AThousandShips/fix_global
[Squash The Creeps] Use `Basis.looking_at` to control facing
2023-09-09 17:14:11 +02:00
A Thousand Ships
0938a48563 [Squash The Creeps] Use Basis.looking_at to control facing
Co-authored-by: Aaron Franke <arnfranke@yahoo.com>
2023-09-07 19:36:17 +02:00
Aaron Franke
68aefef5b9 Merge pull request #944 from godotengine/dependabot/github_actions/actions/checkout-4
Bump actions/checkout from 3 to 4
2023-09-04 16:05:28 -05:00
dependabot[bot]
e85494a57a Bump actions/checkout from 3 to 4
Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4.
- [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/v3...v4)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-09-04 19:33:06 +00: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
Rémi Verschelde
9c8dc6383e Merge pull request #928 from Calinou/bbcode-fix-typo
Fix typo in Rich Text Label with BBCode
2023-08-01 16:38:59 +02:00
Hugo Locurcio
f7e3ceb31e Add camera controls to the Physical Light and Camera units demo (#931) 2023-07-18 09:03:43 +02:00
Aaron Franke
c3f09a45dc Merge pull request #933 from Calinou/contributing-fix-typo
Fix typo in contribution guidelines
2023-07-09 12:56:25 -05:00
Hugo Locurcio
fbc7341439 Fix typo in contribution guidelines 2023-07-09 18:45:50 +02:00
Hugo Locurcio
beaefdc0c0 Fix typo in Rich Text Label with BBCode
- Allow toggling pause by pressing the Pause key,
  in addition to the existing button.
2023-07-05 15:23:31 +02:00
Seth Louis
ea37c101e0 Fix Z Index on platforms in 2D platformer demo (#927) 2023-07-05 15:15:38 +02:00
Aaron Franke
a5d736f624 Merge pull request #926 from Calinou/add-project-tags
Add tags to all demo projects
2023-06-28 15:58:40 -05:00
MotH
0a84347d11 Sorted tags 2023-06-28 21:27:10 +02:00
Aaron Franke
b032b75c07 Merge pull request #919 from Calinou/add-procedural-materials-demo
Add a 3D procedural materials demo
2023-06-27 22:18:57 -05:00
Aaron Franke
c27056da58 Merge pull request #884 from Calinou/add-squash-the-creeps-demo
Add Squash the Creeps (3D) demo
2023-06-27 22:18:19 -05:00
Aaron Franke
302e8727e1 Merge pull request #888 from Calinou/add-physical-light-camera-units-demo
Add a 3D physical light and camera units demo
2023-06-27 22:14:16 -05:00
Hugo Locurcio
18c76b6dae Add tags to all demo projects
This makes sorting them in the project manager easier, as you can
click tags in the project manager to filter to a specific tag.
2023-06-26 18:03:50 +02:00
Doug Noël
5867e5e931 Update Drag and Drop GUI demo to Godot 4.0 (#881)
Co-authored-by: Hugo Locurcio <hugo.locurcio@hugo.pro>
2023-06-26 11:47:40 +02:00
Aaron Franke
f4d146d0ec Merge pull request #894 from Calinou/add-large-world-coordinates-demo
Add a large world coordinates demo
2023-06-05 10:25:24 -05:00
Alex
548c4d5b26 Fix run error on multiplayer_pong project (#923) 2023-06-05 17:14:45 +02:00
Hugo Locurcio
6860a1e814 Add a 3D procedural materials demo 2023-05-26 17:42:00 +02:00
Max Hilbrunner
3a38ab4635 Merge pull request #902 from LinuxUserGD/patch-2 2023-05-17 14:11:27 +02:00
Fabio Alessandrelli
0e83ebc6af [WebSocket] Fix chat demo to updated TLS function. (#918) 2023-05-05 17:10:46 +02:00
Hugo Locurcio
b47178faac Use a different color for moving platforms in platformer demos (#907)
This highlights the fact that these platforms are intended to be moving,
as they can be paused for a few seconds when you reach them.
2023-05-05 15:47:17 +02:00
Hugo Locurcio
7cd99ae192 Fix particles in Platformer 3D demo, add coin glow (#908)
- Add a visible coin glow around coins to make them more noticeable
  at a distance.
- Enable Billboard Keep Scale material property on particle draw
  materials that required it.
- Use transparent additive shading as intended for the bullet trail.
- Tweak blob shadow texture and decal to be slightly more subtle.
2023-05-05 15:47:10 +02:00
Hugo Locurcio
81a16597b9 Remove unused texture from Material Testers demo (#869)
This also resaves resource files to use the new VRAM compression options
in 4.0.
2023-05-05 15:46:41 +02:00
Hugo Locurcio
79edc17b70 Add AMD FidelityFX Super Resolution 1.0 toggle to the 3D antialiasing demo (#871)
- Expose FSR Sharpness when FSR is enabled.
- Allow more granular controls for rendering scale factor.
- Add a FPS limit option when TAA is enabled, as TAA convergence quality depends
  on the rendered framerate.
- Display viewport resolution (taking 3D resolution scale into account)
  in the top-right corner.
- Decrease directional shadow bias to reduce peter-panning.
- Fix some particles not being scaled over a lifetime curve.
2023-05-05 15:46:27 +02:00
Hugo Locurcio
1eb4eccd55 Use Compatibility rendering method in Multiple Resolutions demo (#903)
This also fixes the missing window size override.
2023-05-05 15:46:12 +02:00
Hugo Locurcio
2aff1c69a3 Update 3D Graphics Settings demo for 4.0 (#883)
- Fix scripts for Godot 4.0.stable.
- Tweak Low preset (enable FXAA, disable MSAA to improve performance).
- Colorize FPS counter depending on framerate
  (red = bad, yellow = OK, green = good, cyan = great).
- Use first-class Signal syntax to reduce reliance on strings.
2023-05-05 15:46:00 +02:00
Hugo Locurcio
65c8d77cf4 Add demo submission guidelines (#912)
The pull request template was changed to match godotengine/godot's.
2023-05-05 15:45:22 +02:00
Danil Alexeev
502d410777 Update "Grid-based Navigation with AStarGrid2D" demo 2023-04-26 15:57:41 +03:00
Aaron Franke
0d02b2f90d Merge pull request #910 from Araraura/patch-1
Add missing return types in platformer's pause_menu.gd
2023-04-16 13:21:40 -05:00
Araraura
167e1d391b Add missing return types in platformer's pause_menu.gd 2023-04-16 15:23:58 +00:00
Hugo Locurcio
f6ac674864 Add icons for several projects (#886) 2023-04-13 16:51:05 +02:00
Linux User
83af3223df Change copyright year to "present" in LICENSE.md
Just like godotengine/godot#70885 did for the main Godot repository.
2023-04-04 16:08:03 +00:00
Hugo Locurcio
518eb6df52 Add a large world coordinates demo
This allows testing double-precision builds and see if they work as expected,
while providing an interactive demonstration.
2023-03-30 19:19:53 +02:00
Hugo Locurcio
199e4bed4c Add a variable rate shading demo (#852) 2023-03-30 19:13:50 +02:00
Hugo Locurcio
63d1cd9a60 Use 128×128 WebP icons for all demos (#885) 2023-03-29 18:59:57 +02:00
Tomek
4bbf04129a Add an optional extra RESET step in Tween demo (#892) 2023-03-29 18:35:26 +02:00
Hugo Locurcio
d4496aada8 Add a 3D physical light and camera units demo 2023-03-17 00:32:56 +01:00
Hugo Locurcio
71d29dcf3b Add Squash the Creeps (3D) demo
This is a 3D version of Dodge the Creeps, originally made by GDQuest
and updated to 4.0 by myself.

Some changes are included for more polish:

- Invisible walls were added so that you can't exit the playable area anymore.
- Pillars have a different color to be more visible.
- Physical keys are now used, so that you can use WASD movement
  on any keyboard layout.
- The right mouse button can now be used to jump.
- Visual settings were tweaked to match other 3D demos.
- Project icon was upscaled to 128×128 using Waifu2x, so that it
  looks better on hiDPI displays.
- `.blend` files were resaved with compression enabled.

Co-authored-by: Nathan Lovato <nathan@gdquest.com>
2023-03-13 23:50:10 +01:00
Aaron Franke
956875c306 Merge pull request #882 from Starkium/Update2.5dGDScript
Change Icon header ordering for 2.5d GD Script Demo
2023-03-12 21:36:31 -05:00
Aaron Benjamin
e375d5aa49 Change Icon header ordering
Just following the rules! Moved up the icon statements above the other includes. This got rid of errors preventing plugin from loading.

There's still a race condition when the plugin starts up. It's looking for an editor interface child that hasn't been loaded yet. May want to use _ready to define some behavior before _enter_tree is used.
2023-03-12 19:03:58 -04:00
Aaron Franke
8a4a0262e9 Merge pull request #880 from InfiniteProductions/audio/text_to_speech-demo-fixed-to-work-with-Godot-4-stable
audio/text_to_speech demo fixed to work with Godot 4 stable
2023-03-08 13:44:55 -06:00
InfiniteProductions
2b16927567 warnings fixed
-id shadowed by function parameter
-delta and new_text never used
2023-03-08 19:56:51 +01:00
InfiniteProductions
92c39e7f1c GUI/InputRemapMenu demo fixed to work with Godot 4 stable (#875)
File class object replaced by the new FileAccess class in order to fix the demo for Godot 4 release
2023-03-08 11:06:57 -06:00
Aaron Franke
185d0f4b05 Merge pull request #878 from InfiniteProductions/audio/device_changer-demo-fixed-to-work-with-Godot-4-stable
fix getter/setter usage of AudioServer object
2023-03-06 23:13:33 -06:00
Aaron Franke
82c9367044 Merge pull request #876 from InfiniteProductions/GUI/rich_text_bbcode_godot-4-stable_fix
disconnect unused signal connected to a removed method
2023-03-06 23:11:16 -06:00
Aaron Franke
4045f997c2 Merge pull request #877 from InfiniteProductions/loading/serialization-demo-fixed-to-work-with-Godot-4
loading/serialization demo fixed to work with Godot 4 stable
2023-03-06 23:05:50 -06:00
InfiniteProductions
934b02bd84 fix getter/setter usage of AudioServer object
update names to match new ones
2023-03-06 21:37:59 +01:00
InfiniteProductions
4e27134403 fix a warning on Stringify call
The function 'stringify()' is a static function but was called from an instance. Instead, it should be directly called from the type: 'JSON.stringify()'.<GDScript Error>STATIC_CALLED_ON_INSTANCE
<GDScript Source>save_load_json.gd:37
2023-03-06 10:46:53 +01:00
Aaron Franke
76ec36d805 Merge pull request #874 from dalexeev/gds-var-colon-style
Fix GDScript code style regarding colon (demos)
2023-03-05 23:49:35 -06:00
Danil Alexeev
285139fc4e Fix GDScript code style regarding colon (demos) 2023-03-06 08:44:13 +03:00
InfiniteProductions
a62a4c8534 disconnect unused signal connected to a removed method
Handler "_on_pause_pressed" has been removed but not the signal from the button.
2023-03-05 22:41:28 +01:00
Jonathan Nicholl
3696e43696 Fix 3D platformer (#872)
Also converted the PNG files to lossless WebP and removed an unused .import file while I was at it.
The rest of the changes were done automatically by the editor when I opened the files.
2023-03-03 22:56:03 +01:00
Rémi Verschelde
778baf07cc Merge pull request #867 from dalexeev/fix-rendering-back-end-setting
Fix renamed `vulkan/rendering/back_end=1` setting (Vulkan Mobile)
2023-03-01 15:13:42 +01:00
Rémi Verschelde
106e03c3b8 Merge pull request #866 from dalexeev/update-dodge-the-creeps
Update "Dodge the Creeps" demo
2023-03-01 15:13:19 +01:00
Rémi Verschelde
c34e3f33c6 Merge pull request #865 from jtnicholl/physics_platformer
Update 2D physics platformer for 4.0
2023-03-01 15:12:48 +01:00
Danil Alexeev
b4ab5b4e14 Fix renamed vulkan/rendering/back_end=1 setting (Vulkan Mobile) 2023-03-01 10:22:42 +03:00
Danil Alexeev
b4252c05bf Update "Dodge the Creeps" demo 2023-03-01 09:46:50 +03:00
Jonathan Nicholl
cbb297750f Update 2D physics platformer for 4.0 2023-02-28 13:50:54 -05:00
Rémi Verschelde
6cbfa30e8b CI: Disable HTML5 export workflow for now, not ported to 4.0 2023-02-28 18:43:23 +01:00
Rémi Verschelde
58c33d04db Update README for new branches, matches Godot upstream
(cherry picked from commit c0180d20d1)
2023-02-28 18:37:43 +01:00
Rémi Verschelde
e306a408dc Merge pull request #861 from dalexeev/astar-grid-2d
Rework "Grid-based Navigation with Astar" demo
2023-02-28 17:35:29 +01:00
Danil Alexeev
8ef5764b0d Rework "Grid-based Navigation with Astar" demo 2023-02-28 18:50:55 +03:00
Rémi Verschelde
b81ab55554 Merge pull request #859 from Calinou/improve-audio-spectrum-demo
Improve Audio Spectrum demo
2023-02-28 16:46:43 +01:00
Rémi Verschelde
6947ff4529 Merge pull request #858 from KMouratidis/patch-1
Fix "is mount_event" check in gui_in_3d to work with both 4 beta and 4 rc
2023-02-28 16:41:09 +01:00
Rémi Verschelde
20d2e6ed2f Merge pull request #851 from jtnicholl/2d_platformer
Update, clean up, and reorganize the 2D platformer
2023-02-28 16:40:12 +01:00
Rémi Verschelde
a3a6e72099 Merge pull request #863 from dalexeev/fix-screen-texture
Fix `SCREEN_TEXTURE` in "Screen Space Shaders" demo
2023-02-28 16:34:34 +01:00
Danil Alexeev
faee000550 Fix SCREEN_TEXTURE in "Screen Space Shaders" demo 2023-02-28 15:48:51 +03:00
Danil Alexeev
1cf4fff74a Remove unnecessary randomize() (#862)
Seed is now automatically randomized on startup in Godot 4.
2023-02-27 18:02:44 +01:00
Hugo Locurcio
6df3667072 Improve Audio Spectrum demo
- Draw fake reflections for spectrum bars.
- Increase the bars' height to better make use of the window space.
- Use Compatibility rendering method for greater performance
  and compatibility.
- Update screenshot and icon.
- Remove a stray `.import` file.
2023-02-26 18:25:37 +01:00
Kostas Mouratidis
d059806f20 Fix "is mount_event" check in gui_in_3d to work with both 4 beta and 4 rc 2023-02-26 13:10:46 +01:00
James Tucker
e03d6abbc8 Update finite state machine demo for 4.0.rc4 (#850)
Co-authored-by: Hugo Locurcio <hugo.locurcio@hugo.pro>
2023-02-24 18:32:34 +01:00
dev-gilbride
648befbf58 Check for obstacle before teleporting player in Grid-based Pathfinding with Astar (#771)
Co-authored-by: Hugo Locurcio <hugo.locurcio@hugo.pro>
2023-02-24 18:23:38 +01:00
bruvzg
78dffe0d04 Add a text-to-speech demo (#744)
Co-authored-by: Hugo Locurcio <hugo.locurcio@hugo.pro>
2023-02-24 18:11:55 +01:00
Hugo Locurcio
fa3c247bd5 Update Bidi and Font Features demo for 4.0.rc4 (#763) 2023-02-24 17:53:38 +01:00
James Tucker
73d96b7306 misc/window_management: Fix screen size and label order (#848) 2023-02-24 17:47:21 +01:00
Jonathan Nicholl
ffd600917d Update, clean up, and reorganize the 2D platformer 2023-02-23 21:10:01 -05:00
James Tucker
da6fffbc81 Update Operating System Testing demo for 4.0.rc2 (#847) 2023-02-18 18:22:04 +01:00
Simon Proctor
5e8f722c91 Change warning ignores to use a string identifier (#842)
Co-authored-by: Aaron Franke <arnfranke@yahoo.com>
Co-authored-by: Hugo Locurcio <hugo.locurcio@hugo.pro>
2023-02-16 20:14:51 +01:00
Hugo Locurcio
7e9078be51 Update Global Illumination demo for 4.0.rc1 (#839) 2023-02-08 22:45:22 +01:00
Justo Delgado
26d2f226a8 Fixed isometric demo rendering for Godot 4.0-rc1 (#840) 2023-02-08 18:25:55 +01:00
Rémi Verschelde
b89af52a73 Merge pull request #758 from Calinou/improve-global-illumination-demo
Improve 3D global illumination demo (4.0)
2023-02-08 15:45:24 +01:00
Rémi Verschelde
ac939fc8f8 Merge pull request #838 from Williangalvani/rpc
Add quotes to rpc flags
2023-02-08 15:18:35 +01:00
Willian Galvani
a00465dee8 Add quotes to rpc flags
see https://github.com/godotengine/godot/issues/72218
2023-02-08 15:16:39 +01:00
Rémi Verschelde
ecd12d2163 Merge pull request #835 from Calinou/improve-control-gallery
Improve and update Control Gallery for Godot 4.0
2023-02-08 15:13:03 +01:00
Hugo Locurcio
a0ad65d7df Improve and update Control Gallery for Godot 4.0
- Add a Tree example.
- Add more tabs to make tab scroll buttons visible.
- Use default project font, which is now a DynamicFont in Godot 4.0.
- Make splitters thinner but have a larger draggable area,
  thanks to the new Minimum Grab Thickness theme item.
- Tweak background color to be more visually pleasant.
- Use Compatibility backend to maximize performance and compatibility.
- Disable V-Sync to reduce input lag (while keeping low-processor mode).
2023-01-31 14:56:39 +01:00
Hugo Locurcio
8fcf95c120 Improve joypads demo (#830) 2023-01-31 14:46:09 +01:00
Aaron Franke
a78c51da26 Merge pull request #833 from moth-boi/fix-bomb-animation
Fix bomb animation
2023-01-24 18:20:39 -06:00
MotH
b91b30a854 Fix bomb explosion animation 2023-01-25 01:11:22 +01:00
Aaron Franke
fb9d637fb7 Merge pull request #832 from moth-boi/4.0-dev
Fix bomb collisions through walls on 4.0-dev
2023-01-24 17:53:22 -06:00
Aaron Franke
a467f5078b Merge pull request #834 from moth-boi/fix-ysort
Fix bomb spawning above player
2023-01-24 17:51:19 -06:00
MotH
6c521556a0 Fix bomb spawning above player 2023-01-25 00:07:22 +01:00
MotH
b22177e926 Fix bomb collisions through walls 2023-01-24 23:35:31 +01:00
Rémi Verschelde
19dd819072 Fix joypads demo button/axis mappings for 4.0 (#828) 2023-01-23 13:20:54 +01:00
Hugo Locurcio
c22732e4cc Improve 3D global illumination demo
- Readd LightmapGI example.
- Allow toggling between the Once and Always update modes for the
  ReflectionProbe.
- Add a Decal node to act as a blob shadow for dynamic objects.
- Halve SSAO intensity for a better apperance in the demo's flat,
  bright surfaces.
- Halve ambient light sky contribution when using the disabled
  or lightmap-based GI modes. This prevents the level's shaded areas
  from looking too bright and blue (with lightmaps, this change only
  affects dynamic objects.)
- Enable FXAA and debanding for a better appearance.
2023-01-18 07:35:31 +01:00
Zoee Silcock
24bd3745e3 Fix and update the Operating System Testing demo (#818)
Global menu support is now functional on macOS.
2023-01-18 01:17:54 +01:00
Rémi Verschelde
afc51649fe Merge pull request #805 from Calinou/add-csg-demo
Add a constructive solid geometry (CSG) demo
2023-01-17 22:49:07 +01:00
Rémi Verschelde
d9202081aa Merge pull request #761 from Calinou/add-3d-labels-and-texts-demo
Add a 3D labels and texts demo
2023-01-17 22:47:54 +01:00
Rémi Verschelde
40b8c76856 Merge pull request #826 from Calinou/add-3d-lights-and-shadows-demo
Add a 3D lights and shadows demo
2023-01-17 22:46:54 +01:00
Hugo Locurcio
cfeb6d6b75 Add a 3D particles demo (#757) 2023-01-17 21:42:38 +01:00
Hugo Locurcio
a667e74db5 Add a 3D decals demo (#756)
Co-authored-by: dzil123 <5725958+dzil123@users.noreply.github.com>
2023-01-17 21:41:53 +01:00
Hugo Locurcio
682b933dac Improve dynamic split screen demo (#815) 2023-01-17 21:41:02 +01:00
Hugo Locurcio
ee5862a782 Improve the Rich Text Label with BBCode demo (#816) 2023-01-17 21:39:40 +01:00
Hugo Locurcio
bf898dc717 Update and improve GUI Theming Override demo (#817) 2023-01-17 21:39:28 +01:00
Hugo Locurcio
55934859e3 Add camera selection to Truck Town (#820) 2023-01-17 21:39:18 +01:00
Hugo Locurcio
8a6a3a8eef Improve Regular Expressions (RegEx) demo (#821)
Co-authored-by: Cykyrios <cykyrios@gmail.com>
2023-01-17 21:38:33 +01:00
Hugo Locurcio
6bdf4cd06e Update and improve Material Testers for Godot 4.0 (#823)
Co-authored-by: Bastiaan Olij <mux213@gmail.com>
2023-01-17 21:38:15 +01:00
Hugo Locurcio
2c2c89e040 Improve 2D in 3D demo (#814) 2023-01-17 21:37:16 +01:00
Fabio Alessandrelli
490f178f62 Merge pull request #825 from Faless/fix/4.x_bomber_spawn_function
[Net] Fix Multiplayer Bomber custom spawner.
2023-01-16 21:27:34 +01:00
Hugo Locurcio
f2c66d1904 Add a 3D lights and shadows demo 2023-01-16 08:40:24 +01:00
Fabio Alessandrelli
c1461de661 [Net] Fix Multiplayer Bomber custom spawner.
Needed starting beta11 (Godot GH-71129).
2023-01-13 16:19:18 +01:00
Hugo Locurcio
905717d462 Add a 3D labels and texts demo 2023-01-12 18:17:23 +01:00
Hugo Locurcio
470464518b Fix canvas size having a 1-frame delay in Multiple resolutions (#819) 2023-01-12 03:35:48 +01:00
Zoee Silcock
b04aa38abb Fix method names in GD Paint that have changed in 4.0 (#813) 2023-01-07 23:20:12 +01:00
Zoee Silcock
3b06e40e72 Fix property name of viewport width/height settings in Multiple resolutions (#811)
Co-authored-by: Hugo Locurcio <hugo.locurcio@hugo.pro>
2023-01-06 23:08:54 +01:00
Hugo Locurcio
1d5184e235 Update most demos for Godot 4.0.beta10 (#782) 2023-01-05 16:50:17 +01:00
Hugo Locurcio
85ca2fb2a1 Add a compute shader demo (#810)
Co-authored-by: dzil123 <5725958+dzil123@users.noreply.github.com>
Co-authored-by: Hugo Locurcio <hugo.locurcio@hugo.pro>
Co-authored-by: MoltenCoffee <13321277+MoltenCoffee@users.noreply.github.com>
2023-01-03 00:16:59 +01:00
Hugo Locurcio
d3cc6be62c Add an occlusion culling and mesh LOD demo (#801) 2022-12-19 16:58:12 +01:00
Tomek
4eb852ac78 New Tween demo (#803) 2022-12-17 23:44:08 +01:00
Hugo Locurcio
139cb6b05e Add a constuctive solid geometry (CSG) demo 2022-12-16 23:02:17 +01:00
Jonathan Nicholl
35f9517ea8 Update 3D Platformer for 4.0 (#770) 2022-12-13 16:51:20 +01:00
Jonathan Nicholl
095beddcb9 Update loading demos for 4.0 (#776) 2022-12-13 16:51:04 +01:00
Rafael Correa
1b2ce74a39 Change to correct RPC syntax in Multiplayer bomber demo (#802) 2022-12-04 19:36:52 +01:00
Fabio Alessandrelli
fa0fce0eb6 Merge pull request #792 from expressobits/4.0-dev
Update multiplayer pong to godot 4 beta 5
2022-12-03 21:45:39 +01:00
Rafael Correa
1a9aea09ef Update multiplayer pong to godot 4 beta 5 2022-12-03 15:05:21 -03:00
Fabio Alessandrelli
0cfbbec3f9 Merge pull request #794 from Faless/ws/4.0_fix_list
[4.0] [WebSocket] Fix peers handling in multiplayer example.
2022-11-26 16:53:10 +01:00
Fabio Alessandrelli
f47f25180c [WebSocket] Fix peers handling in multiplayer example.
Disconnected peers were not properly removed from the local peers list.
2022-11-24 17:17:50 +01:00
Fabio Alessandrelli
c71e401b08 Merge pull request #789 from Faless/rtc/4.0-beta4
[WebRTC] Update demos to beta4.
2022-11-22 17:43:41 +01:00
Fabio Alessandrelli
364e8cbfb8 Update WebRTC signaling demo to Godot beta4.
The signaling server protocol has been rewritten to use JSON format to
be more readable.

Lobbies now support both mesh and client/server modes (selected during
creation).

The client/server mode uses the SceneMultiplayer relay mode as
implemented in beta4.

The demo now uses an RPC for pinging, and connects to the MultiplayerAPI
instead of using the raw MultiplayerPeer.
2022-11-21 17:59:40 +01:00
Fabio Alessandrelli
93509019a9 Update WebRTC minimal to 4.0-beta4. 2022-11-19 18:49:36 +01:00
Fabio Alessandrelli
6ca863ffb0 Merge pull request #784 from dsnopek/fix-bomber-demo
Update the multiplayer_bomber demo to work with Godot 4.0-beta3
2022-11-14 22:41:53 +01:00
David Snopek
a425dccaa5 Update the multiplayer_bomber demo to work with Godot 4.0-beta3 2022-10-17 15:21:50 -05:00
Rémi Verschelde
2eb14690fc Merge pull request #781 from Faless/update/ws 2022-10-14 13:41:01 +02:00
Fabio Alessandrelli
da12c09942 [Net] Update WebSocket multiplayer demo.
Updated to Godot 4.

Added combo (default) scene showing dedicated multiplayer branches
(i.e. running both server and clients in the same SceneTree).
2022-09-29 21:13:55 +02:00
Fabio Alessandrelli
dd2ba9a5ba [Net] Update & refactor WebSocket Chat demo.
Uses new unified StreamPeer, dropped the multiplayer part (in favor of
the dedicated WebSocket demo), add reference WebSocketClient and
WebSocketServer signal-based implementations that can be used as drop-in
nodes in any project. Might be worth maintaning it as a separate addon.
2022-09-29 19:16:41 +02:00
Aaron Franke
ea65d7f896 Merge pull request #778 from jtnicholl/remove-vs
Remove VisualScript demos from the 4.0 branch
2022-09-19 21:30:38 -05:00
Jonathan Nicholl
3d16659046 Remove VisualScript demos 2022-09-18 12:29:08 -04:00
Aaron Franke
8d726b52a9 Merge pull request #768 from aaronfranke/truck_town
[4.0] Reorganize Truck Town
2022-08-30 14:39:30 -05:00
Aaron Franke
6cf53c39bf Reorganize Truck Town 2022-08-30 12:52:58 -05:00
Aaron Franke
cd586acd33 Merge pull request #767 from jtnicholl/truck_town
[4.0] Clean up and fix Truck Town
2022-08-30 12:52:49 -05:00
Jonathan Nicholl
3d4947bcb5 Clean up and fix Truck Town 2022-08-30 13:21:30 -04:00
Aaron Franke
044afe7976 Merge pull request #743 from Calinou/add-3d-antialiasing-demo
Add a 3D antialiasing demo
2022-07-10 21:14:34 -05:00
Hugo Locurcio
9dbd05a8a8 Add a 3D antialiasing demo 2022-07-10 20:34:30 -05:00
Aaron Franke
5efee6741f Merge pull request #748 from jtnicholl/3d_navigation
Update 3D navigation demo for 4.0
2022-07-10 20:09:09 -05:00
Jonathan Nicholl
3d7c24ef1b Update 3D navigation demo 2022-07-10 21:03:55 -04:00
Aaron Franke
de27fa1d5a Merge pull request #747 from jtnicholl/loading_threads
Update loading in a thread demo for 4.0
2022-07-10 17:49:02 -05:00
Jonathan Nicholl
02c6a268c3 Update loading in a thread demo 2022-06-23 11:50:59 -04:00
Aaron Franke
ae57eb2080 Merge pull request #742 from aaronfranke/2d-to-control
Convert some 2D nodes to Control nodes in GDPaint and Pseudolocalization demos
2022-05-09 16:33:16 -05:00
Aaron Franke
4af38765af Merge pull request #740 from voylin/FixWindowManagement4.0
Fix window management demo for 4.0
2022-05-09 16:32:27 -05:00
Voylin
f3f0ac4827 Fix for Window Management script + UI for 4.0-dev
UI Fix + fixing script to display correct information

Adding padding to the UI
2022-05-10 06:30:15 +09:00
Aaron Franke
5f1776bdf4 Convert some 2D nodes to Control nodes in GDPaint and Pseudolocal demos 2022-05-08 17:16:45 -05:00
Aaron Franke
c9193d1035 Merge pull request #741 from voylin/FixGDPaintDemo
Fixing GD Paint Issues in 4.0-dev
2022-05-07 20:19:27 -05:00
Voylin
948db2893b Fixing GD Paint Issues
The clipping happened because the panel was see-through.
The saving is also fixed by changing some of the project settings.

Update 2d/gd_paint/paint_root.tscn

Co-authored-by: Aaron Franke <arnfranke@yahoo.com>
changeback to get_node
2022-05-08 09:09:36 +09:00
Aaron Franke
92e24ceb99 Merge pull request #733 from Calinou/multiple-resolutions-update-to-4.0
Update Multiple Resolutions demo for Godot 4.0
2022-05-07 18:48:06 -05:00
Hugo Locurcio
e591ceece9 Update Multiple Resolutions demo for Godot 4.0 2022-05-08 01:35:25 +02:00
Aaron Franke
7ef60c2874 Merge pull request #738 from voylin/GuiInputMappingPersistentKeyMapping4.0
[4.0-dev] GUI Input Mapping Demo Persistent Key Mapping- Fixes #629
2022-05-07 16:50:15 -05:00
Voylin
471243f38e Adding persistence InputMapping
Update gui/input_mapping/KeyPersistence.gd

Co-authored-by: Aaron Franke <arnfranke@yahoo.com>
2022-05-08 06:33:49 +09:00
Aaron Franke
bde67b4c5e Merge pull request #737 from voylin/WindowManagement4.0Update
Window Management Update 4.0
2022-05-07 15:56:15 -05:00
Aaron Franke
666d1cbf99 Merge pull request #736 from voylin/FixPseudolocalizationDemo4.0
Fixed some issues in Pseudo localization Demo 4.0-dev
2022-05-07 15:51:39 -05:00
Aaron Franke
2831e16798 Merge pull request #732 from voylin/DodgeTheCreeps4.0Update
Making Demo Dodge the Creeps ready for 4.0-dev
2022-05-07 15:48:07 -05:00
Aaron Franke
521fc2d755 Merge pull request #735 from voylin/2DScreenSpaceShaders4.0Update
Screen Space Shader Update to 4.0
2022-05-07 15:45:25 -05:00
Voylin
d103e7aec2 Making Demo Dodge the Creeps ready for 4.0-dev
Going through the demo's mentioned at: #697
to fix and prepare them for 4.0.
It was mentioned that there were minor bugs (errors printing in console), found non of that, only some logs about awaits not being needed (they were needed). Everything works again now and stretch_mode set to canvas_items.
change vulkan
2022-05-08 05:45:19 +09:00
Aaron Franke
7349ccc6a0 Merge pull request #734 from voylin/GDPaint4.0Update
GD Paint Demo Update to 4.0
2022-05-07 15:41:39 -05:00
Voylin
cd32f64f80 Window Management Update 4.0
Updated to 4.0 everything should work.
2022-05-05 06:39:00 +09:00
Voylin
983c1361dd Fixed some issues in Pseudo localization Demo 4.0-dev
There were some UI issues + pressed became button_pressed.
2022-05-04 19:30:06 +09:00
Voylin
3657f91c0c Screen Space Shader Update to 4.0
Everything okay.
Part of #697
2022-05-04 18:55:07 +09:00
Voylin
7edfc9b29e GD Paint update to 4.0
Part of #697
Demo is working now in 4.0.
There is only one slight issue, but that has to do with the engine viewport system I think. When saving the picture, the framing isn't always correct, really depends how you scaled the window. This could also be a me issue as I use i3 on linux (Tiling window manager).

But otherwise, it's working perfectly.
2022-05-03 08:09:39 +09:00
Aaron Franke
e77b85fba3 Merge pull request #730 from godotengine/master
Merge recent changes from master into the 4.0-dev branch
2022-05-02 09:19:08 -05:00
Aaron Franke
5c40412e34 Merge pull request #719 from Calinou/improve-3d-graphics-settings-demo
Improve the 3D graphics settings demo
2022-04-25 15:08:12 -04:00
Hugo Locurcio
48d2ec90fc Improve the 3D graphics settings demo
- New graphics settings:
  - Field of view.
  - Volumetric fog.
- Use Godot's built-in 3D viewport facilities instead of using a SubViewport.
  - This also allows for choosing AMD FidelityFX Super Resolution
    for resolution scaling, but it's not working yet due to a Godot bug.
  - Nearest-neighbor scaling is no longer available. It can be
    reimplemented in Godot core and then exposed in the future.
- Separate MSAA from FXAA settings, as both can be used at the same time.
- Add more quality settings for various effect settings.
- Rename sections and setting names to be more "player-oriented"
  (even if this results in the actual Godot terminology not being
  presented).
- Add performance hints to setting values.
- Add FPS counter and viewport resolution display
  (taking the resolution scale into account).
- Add more objects to the test scene and tweak environment settings.
  - ACES tonemapping is now used.
  - Debanding is now enabled, as this scene requires it to avoid visible
    banding.
  - Make the emissive box less bright to prevent MSAA and FXAA from
    being ineffective on it (due to Godot not supporting correct
    HDR antialiasing).
  - Remove unnecessary DirectionalLight3D, VoxelGI and ReflectionProbe.
2022-04-25 20:06:31 +02:00
Aaron Franke
06af3f0c2c Merge pull request #728 from Calinou/global-illumination-tweak-camera-script
Revert accidental change in camera script in Global illumination demo
2022-04-25 12:44:31 -04:00
Hugo Locurcio
2c244014df Revert accidental change in camera script in Global illumination demo
This also tweaks the font shadow appearance for better visibility.
2022-04-25 18:40:49 +02:00
Aaron Franke
5766a55115 Merge pull request #727 from RedstoneMCPC/kinematic-character-2d
Updated Kinematic Character 2D Demo to Godot 4
2022-04-25 01:35:50 -04:00
RedstoneMCPC / MCPCStudios
ce2bd76d80 Updated Kinematic Character 2D Demo to Godot 4 2022-04-25 15:27:26 +10:00
Aaron Franke
b0c27f044e Merge pull request #726 from RedstoneMCPC/dodge-the-creeps-4.0
Update Dodge the Creeps to 4.0
2022-04-25 00:42:32 -04:00
RedstoneMCPC / MCPCStudios
0d3be3e10f Update Dodge the Creeps to 4.0 2022-04-25 14:39:16 +10:00
Aaron Franke
560ea5a6ce Merge pull request #718 from Calinou/add-global-illumination-demo-2-4.0
Add a global illumination demo (4.0-dev)
2022-04-25 00:04:18 -04:00
Aaron Franke
60457b4d99 Merge pull request #724 from voylin/IconUpdate
New Icons for some of the 4.0-dev demos
2022-04-20 11:10:06 -05:00
Voylin
86be54ae49 New Icons for 4.0-dev demos:
Fixes some of the icons mentioned in #722.
Not sure if they are good enough or not, I'm not an artist in any way.

Changed Icons:
- 2D physics;
- 3D physics;
- Audio device changer;
- Audio mic record;
- GUI Control gallery;
- GUI Pseudo-localization.
Update
2022-04-20 10:31:44 +09:00
Hugo Locurcio
31b962adba Add a global illumination demo
Port of the 3.x global illumination demo, with SDFGI support added
and screen-space lighting effect options added (SSAO, SSIL, or both).

Lightmap options were removed as I couldn't get both indirect-only
and fully baked lightmaps to work for now. They can be readded in the
future.
2022-04-06 17:44:56 +02:00
Aaron Franke
aeba3a05aa Merge pull request #713 from voylin/Add_3D_Settings_Demo
Add a 3D settings demo (Graphical settings) for 4.0-dev
2022-04-05 21:57:04 -05:00
Voylin
9737f8eaa7 Add a 3D settings demo (Graphical settings) for 4.0-dev
Could possible fix #600.
This demo has some of the basic graphical settings that game devs would want. I tried to keep it minimal because it's just a demo. I hope this is sufficient and that there are enough comments explaining everything. Everything works without any bugs or errors.
Small fix

Small script format fix
Small fix


Small fix


Changed readme


Update 3d/3d_settings_menu/project.godot

Co-authored-by: Aaron Franke <arnfranke@yahoo.com>
Fixing many mistakes

Changed folder name
Deleted git files
changed the default size with the project settings variant
Removed some debug info


Added extra features

Changed the layout into sections,
Added some extra settings and features.
Waiting for Calinou to see what he would like to change/add.
Small fixes

Getting the start viewport in ready
2022-04-06 10:49:24 +09:00
Aaron Franke
a0a5b0e7b0 Merge pull request #717 from Faless/mp/4.x_bomber
Port Multiplayer bomber to replication system.
2022-04-05 18:58:48 -05:00
Fabio Alessandrelli
8902903099 Port Multiplayer bomber to replication system. 2022-04-04 11:13:12 +02:00
Aaron Franke
353dc4d2d6 Merge pull request #716 from voylin/Added_run-time_translation_example_to_Translation_Demo
Added run-time translation example for Translation Demo 4.0-dev
2022-04-04 00:12:32 -05:00
Voylin
a8d797cd46 Added run-time translation example
Fixes #647
I added an example of how you can handle translations on runtime.
Small fix
2022-04-03 19:08:44 +09:00
Aaron Franke
3d158cc902 Merge pull request #715 from aaronfranke/pause-4
Pause demo: Showcase new pause features in Godot 4.0
2022-04-03 04:58:00 -05:00
Aaron Franke
9f8a625c8e Pause demo: Showcase new pause features in Godot 4.0 2022-04-03 04:41:45 -05:00
Aaron Franke
3eda0c7fe1 Merge pull request #714 from aaronfranke/gui-in-3d-pause
GUI in 3D: Always process GUI even when the scene tree is paused
2022-04-03 04:16:53 -05:00
Aaron Franke
81fef6072b GUI in 3D: Always process GUI even when the scene tree is paused 2022-04-03 04:14:28 -05:00
Aaron Franke
8fea00cfac Merge pull request #712 from voylin/Update_Bullet_Shower_4.0-dev
Update for Bullet Shower to 4.0-dev
2022-04-03 04:04:06 -05:00
Voylin
960ade79ca Update for Bullet Shower to 4.0-dev
Fixed some issues of things which changed in Godot 4 and I also tried replicating this issue #599 but I guess that is not longer an issue in Godot 4.0? Tested and fixed everything on Godot 4.0alpha5.

Small fix
2022-04-03 18:01:51 +09:00
Aaron Franke
6ac2aeea60 Merge pull request #708 from voylin/Fix_GUI_Input_Mapping_Demo_4.0-dev
Fixed Script Errors for GUI Input Mapping Demo - 4.0-dev
2022-04-03 03:46:34 -05:00
Aaron Franke
e5ceb2d8a5 Merge pull request #706 from voylin/Fix_Scene_Instancing_Demo_4.0-dev
Tested and fixed Scene Instancing Demo for 4.0-dev
2022-04-03 03:41:45 -05:00
Aaron Franke
713dfd064d Merge pull request #711 from voylin/PR_Request_Mic_Record_Demo
Adding settings for mix_rate, stereo and format for Mic Record Demo 4.0-dev
2022-04-03 03:40:45 -05:00
Aaron Franke
188cfda940 Merge pull request #704 from voylin/Fix_Translation_Demo_4.0-dev
Fixed Translation Demo not working in 4.0-dev
2022-04-03 03:39:07 -05:00
Aaron Franke
3eb81eb6a2 Merge pull request #702 from voylin/Fix_Autoload_Demo_4.0-dev
Prepared Autoload(Singletons) demo for Godot 4
2022-04-03 03:36:24 -05:00
Aaron Franke
be59edcb97 Merge pull request #701 from voylin/Fix_Pause_Demo_4.0-dev
Fixing Pause Demo - Object not rotating + 4.0 changes
2022-04-03 03:35:46 -05:00
Aaron Franke
bf4425babb Merge pull request #707 from voylin/Fix_Pong_With_GDScript_4.0-dev
Tested and Fixed Pong with GDScript Demo for 4.0-dev
2022-04-03 03:34:54 -05:00
Voylin
85e7aeec99 Fixed GUI Input Mapping Demo Script Errors for 4.0-dev
Edited the project settings to match the new Godot 4 standard and fixed
the script errors which were making it impossible to run this demo.

Now everything works properly for the 4.0-dev version.

Changed to Vulkan Mobile + Changed argument name

Followed the suggestions of aaronfranke
Changed viewport size
2022-04-03 14:21:54 +09:00
Voylin
8793b7117f Fixing Pause Demo - Object not rotating + 4.0 changes
Fixes #700

Update misc/pause/spinpause.tscn

Co-authored-by: Aaron Franke <arnfranke@yahoo.com>
Update misc/pause/spinpause.tscn

Co-authored-by: Aaron Franke <arnfranke@yahoo.com>
Small fixes
2022-04-03 14:16:28 +09:00
Voylin
7d7c08ad54 Fixing Autoload(Singletons) Demo for Godot 4
Not really any fixing were required, some data changed between versions
when opening and testing everything. Did some changes to the project
settings (2d to canvas_items). Everything works fine without problems.

Change to Vulkan Mobile
2022-04-03 14:11:55 +09:00
Voylin
d4c040b527 Fixed Translation Demo not working in 4.0-dev
Fixes #703

Small fixes

Changing the audio for Spanish.
Vulkan to Vulkan Mobile.
2022-04-03 14:09:25 +09:00
Voylin
5c532525cc Tested and fixed Scene Instancing Demo for 4.0-dev
Everything works! Project settings are updated to Godot 4 new standards.

Small fixes

Vulkan to Vulkan Mobile,
Screen width to 800
2022-04-03 14:05:28 +09:00
Voylin
1b1244d113 Adding settings for mix_rate, stereo and format for Mic Record Demo
small edit

Adding settings for mix_rate, stereo and format for Mic Record Demo

Adding settings for mix_rate, stereo and format for Mic Record Demo

small edit

Adding settings for mix_rate, stereo and format for Mic Record Demo

small edit

Adding settings for mix_rate, stereo and format for Mic Record Demo

small edit

Adding settings for mix_rate, stereo and format for Mic Record Demo

small edit

Adding settings for mix_rate, stereo and format for Mic Record Demo

small edit

Adding settings for mix_rate, stereo and format for Mic Record Demo

Fixing project settings
Small fixes

Vulkan to Vulkan Mobile,
Changed window size.
2022-04-03 14:00:26 +09:00
Voylin
27af28d02c Tested and fixed Pong With GDScript for 4.0-dev
Made the usual changes to the project settings and tested to see if
everything works.

Everything works fine!

Small fixes

Changed to Vulkan Mobile.
Changed viewport size.
2022-04-03 13:56:21 +09:00
Aaron Franke
0fbb2b99b0 Merge pull request #705 from voylin/Fix_Control_Gallery_Demo_4.0-dev
Fixes layout, nodes and theming for Control Gallery Demo - 4.0 dev
2022-04-02 23:36:55 -05:00
Voylin
861638b9d0 Fixes Control Gallery Demo for 4.0-dev
A lot of nodes have changed which made this demo not work properly
anymore, nor display everything properly anymore. Everything is looking
like it did before and all buttons are working again.

There is however this slight bug in the engine right now which makes it
not possible to press menu buttons or option buttons if the window is
not the same as the content_scale_size of the main window. (By example
when you resize the window)
This is because the hitboxes for those buttons don't get notified of the
change in screen size which makes them stay in the same place where they
would be when resizing the window.

For the rest everything is working perfectly now, everything also has
the new Godot 4 default theme style.

Fixes Control Gallery Demo for 4.0-dev small edit

Forgot to center one of the labels + updated screenshot

Changing Vulkan to Vulkan Mobile
2022-04-03 13:29:20 +09:00
voylin
e6c19ff4a9 Fix scaling not working after resizing the window (#699) 2022-03-29 19:28:58 -05:00
Aaron Franke
2ff9d17f46 Merge pull request #696 from aaronfranke/gd4-3d
Update several 3D demos to Godot 4
2022-03-28 01:49:39 -05:00
Aaron Franke
5566c748c2 Update several 3D demos to Godot 4 2022-03-28 01:41:27 -05:00
Aaron Franke
730b2f30a0 Merge pull request #695 from aaronfranke/gd4-rigidbody-sname
Rename RigidBody -> RigidDynamicBody and use StringName literals
2022-03-28 01:31:38 -05:00
Aaron Franke
cb52878006 Use StringName literals with Input methods 2022-03-27 19:19:09 -05:00
Aaron Franke
ab0816a44e Rename RigidBody -> RigidDynamicBody 2022-03-27 19:06:05 -05:00
Aaron Franke
f2918178d7 Merge pull request #694 from aaronfranke/gd4-voxel
Update Voxel demo to Godot 4
2022-03-27 18:25:43 -05:00
Aaron Franke
b9ad7a4ac3 Merge pull request #693 from aaronfranke/gd4-audio
Update Audio demos to Godot 4
2022-03-27 18:25:22 -05:00
Aaron Franke
981359289c Merge pull request #692 from aaronfranke/gd4-viewport
Update Viewport demos to Godot 4
2022-03-27 18:24:43 -05:00
Aaron Franke
37e7ec0985 Update Voxel demo to Godot 4 2022-03-27 00:19:33 -05:00
Aaron Franke
0e2c5ad182 Update Audio demos to Godot 4 2022-03-26 20:48:33 -05:00
Aaron Franke
3e3a9e7b6e Update Viewport demos to Godot 4 2022-03-26 19:29:53 -05:00
Aaron Franke
27e4e36e03 Merge pull request #691 from aaronfranke/convert
Convert demos to Godot 4 using regular expressions in a script
2022-03-26 16:39:10 -05:00
Aaron Franke
bbe50fc9da Convert demos to Godot 4 using regular expressions in a script 2022-03-26 16:09:10 -05:00
Aaron Franke
410d783126 Merge pull request #690 from godotengine/master
Merge the `master` branch into the `4.0-dev` branch
2022-03-26 15:19:30 -05:00
Aaron Franke
f47d0909cc Merge pull request #658 from Calinou/add-volumetric-fog-demo
Add a volumetric fog demo
2022-03-26 15:12:05 -05:00
Aaron Franke
907b8a2f42 Make volumetric fog demo work with Godot master 2022-03-26 2022-03-26 15:05:58 -05:00
Aaron Franke
1923153f46 Merge pull request #670 from jonbonazza/update-websocket-minimal
feat: update websocket-minimal to gdscript2.0
2022-03-26 05:06:29 -05:00
Aaron Franke
5875f2a320 Merge pull request #637 from angad-k/pseudolocalization
Add pseudolocalization demo
2022-03-26 05:04:14 -05:00
Aaron Franke
895749024a Merge pull request #538 from bruvzg/ctl_demos
[Complex Text Layouts] Add BiDi and UI mirroring demos.
2022-03-26 05:03:08 -05:00
Jon Bonazza
d047c2de5b feat: update websocket-minimal to gdscript2.0
Update the networking/websocket-minimal project to use gdscript 2.0.
2021-12-07 10:28:40 -08:00
Camille Mohr-Daurat
f30f16b8ce Merge pull request #638 from nekomatata/physics-tests-4.0-conversion
Convert physics test projects to 4.0
2021-12-07 09:21:00 -07:00
PouleyKetchoupp
52f5b2e5d2 Convert physics test projects to 4.0 2021-12-07 09:19:28 -07:00
Hugo Locurcio
31cc886d07 Add a volumetric fog demo
This is an example of Godot's volumetric fog capabilities
with the Vulkan renderer.

Showcased features are:

- Positive/negative density volumes that affect albedo (incoming light)
  and emission.
- Box/ellipsoid shapes, height falloff, and density modulation using a
  3D texture.
- Temporal reprojection for greater stability and avoiding flickering.
  - The difference is demonstrated with a moving fog volume.
- Global density adjustment. With FogVolume nodes that have a
  positive density, it's possible to apply volumetric fog only in
  specific areas.
2021-10-31 22:02:48 +01:00
bruvzg
9a2889b35b [Complex Text Layouts] Add BiDi and font features demo. 2021-10-28 10:18:15 +03:00
bruvzg
44daa8ac89 [Complex Text Layouts] Add UI mirroring demo. 2021-10-28 10:18:15 +03:00
Angad Kambli
e44e3521b6 add pseudolocalization demo 2021-08-09 12:18:35 +05:30
2472 changed files with 74921 additions and 53703 deletions

View File

@@ -1,23 +1,7 @@
<!--
Only submit a pull request if all of the following conditions are met:
Please target the `master` branch in priority.
PRs can target `3.x` if the same change was done in `master`, or is not relevant there.
* It must work with the latest Godot version of the branch you're submitting to.
* It must follow all of the Godot style guides, including the GDScript
style guide and the C# style guide.
* The demo should not be overcomplicated. Simplicity is usually preferred.
* If you are submitting a new demo, please ensure that it includes a
README file similar to the other demos.
* If you are submitting a copy of a demo translated to C# etc:
* Please ensure that there is a good reason to have this demo translated.
We don't want to have multiple copies of every single project.
* Please ensure that the code mirrors the original closely.
* In the project.godot file and in the README, include "with C#" etc in
the title, and also include a link to the original in the README.
Relevant fixes are cherry-picked for stable branches as needed by maintainers.
You can mention in the description if the change is compatible with `3.x`.
-->

1
.gitignore vendored
View File

@@ -20,3 +20,4 @@ mono_crash.*.json
.directory
.DS_Store
*~
*.blend1

View File

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

View File

@@ -1,8 +1,9 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/bullet.png-ff1424653e10246c11e3724e402c519e.stex"
type="CompressedTexture2D"
uid="uid://bcoiuym4nw1ua"
path="res://.godot/imported/bullet.png-ff1424653e10246c11e3724e402c519e.ctex"
metadata={
"vram_texture": false
}
@@ -10,26 +11,24 @@ metadata={
[deps]
source_file="res://bullet.png"
dest_files=[ "res://.import/bullet.png-ff1424653e10246c11e3724e402c519e.stex" ]
dest_files=["res://.godot/imported/bullet.png-ff1424653e10246c11e3724e402c519e.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/hdr_compression=1
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

View File

@@ -10,7 +10,7 @@ const SPEED_MAX = 80
const bullet_image = preload("res://bullet.png")
var bullets = []
var bullets := []
var shape
@@ -24,41 +24,37 @@ class Bullet:
func _ready():
randomize()
shape = Physics2DServer.circle_shape_create()
shape = PhysicsServer2D.circle_shape_create()
# Set the collision shape's radius for each bullet in pixels.
Physics2DServer.shape_set_data(shape, 8)
PhysicsServer2D.shape_set_data(shape, 8)
for _i in BULLET_COUNT:
var bullet = Bullet.new()
# Give each bullet its own speed.
bullet.speed = rand_range(SPEED_MIN, SPEED_MAX)
bullet.body = Physics2DServer.body_create()
# Give each bullet its own random speed.
bullet.speed = randf_range(SPEED_MIN, SPEED_MAX)
bullet.body = PhysicsServer2D.body_create()
Physics2DServer.body_set_space(bullet.body, get_world_2d().get_space())
Physics2DServer.body_add_shape(bullet.body, shape)
PhysicsServer2D.body_set_space(bullet.body, get_world_2d().get_space())
PhysicsServer2D.body_add_shape(bullet.body, shape)
# Don't make bullets check collision with other bullets to improve performance.
# Their collision mask is still configured to the default value, which allows
# bullets to detect collisions with the player.
Physics2DServer.body_set_collision_layer(bullet.body, 0)
PhysicsServer2D.body_set_collision_mask(bullet.body, 0)
# Place bullets randomly on the viewport and move bullets outside the
# play area so that they fade in nicely.
bullet.position = Vector2(
rand_range(0, get_viewport_rect().size.x) + get_viewport_rect().size.x,
rand_range(0, get_viewport_rect().size.y)
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
Physics2DServer.body_set_state(bullet.body, Physics2DServer.BODY_STATE_TRANSFORM, transform2d)
PhysicsServer2D.body_set_state(bullet.body, PhysicsServer2D.BODY_STATE_TRANSFORM, transform2d)
bullets.push_back(bullet)
func _process(_delta):
# Order the CanvasItem to update every frame.
update()
queue_redraw()
func _physics_process(delta):
@@ -68,12 +64,11 @@ func _physics_process(delta):
bullet.position.x -= bullet.speed * delta
if bullet.position.x < -16:
# The bullet has left the screen; move it back to the right.
# Move the bullet back to the right when it left the screen.
bullet.position.x = offset
transform2d.origin = bullet.position
Physics2DServer.body_set_state(bullet.body, Physics2DServer.BODY_STATE_TRANSFORM, transform2d)
PhysicsServer2D.body_set_state(bullet.body, PhysicsServer2D.BODY_STATE_TRANSFORM, transform2d)
# Instead of drawing each bullet individually in a script attached to each bullet,
@@ -87,7 +82,7 @@ func _draw():
# Perform cleanup operations (required to exit without error messages in the console).
func _exit_tree():
for bullet in bullets:
Physics2DServer.free_rid(bullet.body)
PhysicsServer2D.free_rid(bullet.body)
Physics2DServer.free_rid(shape)
PhysicsServer2D.free_rid(shape)
bullets.clear()

View File

@@ -1,8 +1,9 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/face_happy.png-38d387d31ec13459f749c93ce3d75d80.stex"
type="CompressedTexture2D"
uid="uid://d3u7k0742d5ug"
path="res://.godot/imported/face_happy.png-38d387d31ec13459f749c93ce3d75d80.ctex"
metadata={
"vram_texture": false
}
@@ -10,26 +11,24 @@ metadata={
[deps]
source_file="res://face_happy.png"
dest_files=[ "res://.import/face_happy.png-38d387d31ec13459f749c93ce3d75d80.stex" ]
dest_files=["res://.godot/imported/face_happy.png-38d387d31ec13459f749c93ce3d75d80.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/hdr_compression=1
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

View File

@@ -1,8 +1,9 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/face_sad.png-0ac7165eab24f595aba17a746a66c550.stex"
type="CompressedTexture2D"
uid="uid://8j32onnr4qo3"
path="res://.godot/imported/face_sad.png-0ac7165eab24f595aba17a746a66c550.ctex"
metadata={
"vram_texture": false
}
@@ -10,26 +11,24 @@ metadata={
[deps]
source_file="res://face_sad.png"
dest_files=[ "res://.import/face_sad.png-0ac7165eab24f595aba17a746a66c550.stex" ]
dest_files=["res://.godot/imported/face_sad.png-0ac7165eab24f595aba17a746a66c550.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/hdr_compression=1
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

View File

@@ -1,35 +0,0 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://icon.png"
dest_files=[ "res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

BIN
2d/bullet_shower/icon.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

View File

@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://brwp8bimc75uu"
path="res://.godot/imported/icon.webp-e94f9a68b0f625a567a797079e4d325f.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://icon.webp"
dest_files=["res://.godot/imported/icon.webp-e94f9a68b0f625a567a797079e4d325f.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
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/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

View File

@@ -7,7 +7,7 @@ extends Node2D
# The number of bullets currently touched by the player.
var touching = 0
onready var sprite = $AnimatedSprite
@onready var sprite = $AnimatedSprite2D
func _ready():
@@ -17,11 +17,13 @@ func _ready():
func _input(event):
# Getting the movement of the mouse so the sprite can follow its position.
if event is InputEventMouseMotion:
position = event.position - Vector2(0, 16)
func _on_body_shape_entered(_body_id, _body, _body_shape, _local_shape):
# Player got touched by a bullet so sprite changes to sad face.
touching += 1
if touching >= 1:
sprite.frame = 1
@@ -29,5 +31,7 @@ func _on_body_shape_entered(_body_id, _body, _body_shape, _local_shape):
func _on_body_shape_exited(_body_id, _body, _body_shape, _local_shape):
touching -= 1
# When non of the bullets are touching the player,
# sprite changes to happy face.
if touching == 0:
sprite.frame = 0

View File

@@ -6,35 +6,30 @@
; [section] ; section goes between []
; param=value ; assign values to parameters
config_version=4
_global_script_classes=[ ]
_global_script_class_icons={
}
config_version=5
[application]
config/name="Bullet Shower"
config/description="Demonstrates how to manage large amounts of objects efficiently using low-level Servers."
run/main_scene="res://shower.tscn"
config/icon="res://icon.png"
config/features=PackedStringArray("4.0")
config/icon="res://icon.webp"
config/tags=PackedStringArray("2d", "demo", "official", "performance")
[display]
window/dpi/allow_hidpi=true
window/stretch/mode="2d"
window/stretch/mode="canvas_items"
window/stretch/aspect="expand"
[layer_names]
2d_physics/layer_1="Player"
[physics]
common/enable_pause_aware_picking=true
2d/cell_size=64
[rendering]
quality/driver/driver_name="GLES2"
quality/intended_usage/framebuffer_allocation=0
quality/intended_usage/framebuffer_allocation.mobile=0
vram_compression/import_etc=true
vram_compression/import_etc2=false
environment/default_clear_color=Color( 0.133333, 0.133333, 0.2, 1 )
renderer/rendering_method="mobile"

View File

@@ -1,34 +1,40 @@
[gd_scene load_steps=7 format=2]
[gd_scene load_steps=7 format=3 uid="uid://c78by7hc4fmwx"]
[ext_resource path="res://bullets.gd" type="Script" id=2]
[ext_resource path="res://face_happy.png" type="Texture" id=3]
[ext_resource path="res://face_sad.png" type="Texture" id=4]
[ext_resource path="res://player.gd" type="Script" id=5]
[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"]
[sub_resource type="SpriteFrames" id=1]
animations = [ {
"frames": [ ExtResource( 3 ), ExtResource( 4 ) ],
[sub_resource type="SpriteFrames" id="1"]
animations = [{
"frames": [{
"duration": 1.0,
"texture": ExtResource("3")
}, {
"duration": 1.0,
"texture": ExtResource("4")
}],
"loop": true,
"name": "default",
"name": &"default",
"speed": 5.0
} ]
}]
[sub_resource type="CircleShape2D" id=2]
[sub_resource type="CircleShape2D" id="2"]
radius = 27.0
[node name="Shower" type="Node2D"]
[node name="Bullets" type="Node2D" parent="."]
script = ExtResource( 2 )
script = ExtResource("2")
[node name="Player" type="Area2D" parent="."]
script = ExtResource( 5 )
script = ExtResource("5")
[node name="AnimatedSprite" type="AnimatedSprite" parent="Player"]
frames = SubResource( 1 )
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="Player"]
sprite_frames = SubResource("1")
[node name="CollisionShape2D" type="CollisionShape2D" parent="Player"]
shape = SubResource( 2 )
shape = SubResource("2")
[connection signal="body_shape_entered" from="Player" to="Player" method="_on_body_shape_entered"]
[connection signal="body_shape_exited" from="Player" to="Player" method="_on_body_shape_exited"]

View File

@@ -2,7 +2,6 @@ extends CanvasLayer
signal start_game
func show_message(text):
$MessageLabel.text = text
$MessageLabel.show()
@@ -11,10 +10,10 @@ func show_message(text):
func show_game_over():
show_message("Game Over")
yield($MessageTimer, "timeout")
await $MessageTimer.timeout
$MessageLabel.text = "Dodge the\nCreeps"
$MessageLabel.show()
yield(get_tree().create_timer(1), "timeout")
await get_tree().create_timer(1).timeout
$StartButton.show()
@@ -24,7 +23,7 @@ func update_score(score):
func _on_StartButton_pressed():
$StartButton.hide()
emit_signal("start_game")
start_game.emit()
func _on_MessageTimer_timeout():

View File

@@ -1,58 +1,54 @@
[gd_scene load_steps=7 format=2]
[gd_scene load_steps=4 format=3 uid="uid://ccqoreueuxdb7"]
[ext_resource path="res://HUD.gd" type="Script" id=1]
[ext_resource path="res://fonts/Xolonium-Regular.ttf" type="DynamicFontData" id=2]
[ext_resource type="Script" path="res://HUD.gd" id="1"]
[sub_resource type="DynamicFont" id=1]
size = 64
font_data = ExtResource( 2 )
[sub_resource type="InputEventAction" id="InputEventAction_fopy7"]
action = &"start_game"
[sub_resource type="DynamicFont" id=2]
size = 64
font_data = ExtResource( 2 )
[sub_resource type="InputEventAction" id=3]
action = "start_game"
[sub_resource type="ShortCut" id=4]
shortcut = SubResource( 3 )
[sub_resource type="Shortcut" id="4"]
events = [SubResource("InputEventAction_fopy7")]
[node name="HUD" type="CanvasLayer"]
script = ExtResource( 1 )
script = ExtResource("1")
[node name="ScoreLabel" type="Label" parent="."]
anchors_preset = 10
anchor_right = 1.0
margin_bottom = 78.0
custom_fonts/font = SubResource( 1 )
offset_bottom = 78.0
grow_horizontal = 2
theme_override_font_sizes/font_size = 60
text = "0"
align = 1
horizontal_alignment = 1
[node name="MessageLabel" type="Label" parent="."]
anchors_preset = 14
anchor_top = 0.5
anchor_right = 1.0
anchor_bottom = 0.5
margin_top = -79.5
margin_bottom = 79.5
custom_fonts/font = SubResource( 1 )
offset_top = -79.5
offset_bottom = 79.5
grow_horizontal = 2
grow_vertical = 2
theme_override_font_sizes/font_size = 60
text = "Dodge the
Creeps"
align = 1
horizontal_alignment = 1
[node name="StartButton" type="Button" parent="."]
anchors_preset = 7
anchor_left = 0.5
anchor_top = 1.0
anchor_right = 0.5
anchor_bottom = 1.0
margin_left = -90.0
margin_top = -200.0
margin_right = 90.0
margin_bottom = -100.0
custom_fonts/font = SubResource( 2 )
shortcut = SubResource( 4 )
offset_left = -90.0
offset_top = -200.0
offset_right = 90.0
offset_bottom = -100.0
grow_horizontal = 2
grow_vertical = 0
theme_override_font_sizes/font_size = 60
shortcut = SubResource("4")
text = "Start"
__meta__ = {
"_edit_use_anchors_": false
}
[node name="MessageTimer" type="Timer" parent="."]
one_shot = true

View File

@@ -1,13 +1,8 @@
extends Node
export(PackedScene) var mob_scene
@export var mob_scene: PackedScene
var score
func _ready():
randomize()
func game_over():
$ScoreTimer.stop()
$MobTimer.stop()
@@ -17,7 +12,7 @@ func game_over():
func new_game():
get_tree().call_group("mobs", "queue_free")
get_tree().call_group(&"mobs", &"queue_free")
score = 0
$Player.start($StartPosition.position)
$StartTimer.start()
@@ -28,11 +23,11 @@ func new_game():
func _on_MobTimer_timeout():
# Create a new instance of the Mob scene.
var mob = mob_scene.instance()
var mob = mob_scene.instantiate()
# Choose a random location on Path2D.
var mob_spawn_location = get_node("MobPath/MobSpawnLocation")
mob_spawn_location.offset = randi()
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
@@ -41,17 +36,16 @@ func _on_MobTimer_timeout():
mob.position = mob_spawn_location.position
# Add some randomness to the direction.
direction += rand_range(-PI / 4, PI / 4)
direction += randf_range(-PI / 4, PI / 4)
mob.rotation = direction
# Choose the velocity for the mob.
var velocity = Vector2(rand_range(150.0, 250.0), 0.0)
var velocity = Vector2(randf_range(150.0, 250.0), 0.0)
mob.linear_velocity = velocity.rotated(direction)
# Spawn the mob by adding it to the Main scene.
add_child(mob)
func _on_ScoreTimer_timeout():
score += 1
$HUD.update_score(score)

View File

@@ -1,27 +1,31 @@
[gd_scene load_steps=8 format=2]
[gd_scene load_steps=8 format=3 uid="uid://cyfwty2q3rdse"]
[ext_resource path="res://Main.gd" type="Script" id=1]
[ext_resource path="res://Mob.tscn" type="PackedScene" id=2]
[ext_resource path="res://Player.tscn" type="PackedScene" id=3]
[ext_resource path="res://HUD.tscn" type="PackedScene" id=4]
[ext_resource path="res://art/House In a Forest Loop.ogg" type="AudioStream" id=5]
[ext_resource path="res://art/gameover.wav" type="AudioStream" id=6]
[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"]
[sub_resource type="Curve2D" id=1]
[sub_resource type="Curve2D" id="1"]
_data = {
"points": PoolVector2Array( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 480, 0, 0, 0, 0, 0, 480, 720, 0, 0, 0, 0, 0, 720, 0, 0, 0, 0, 0, 0 )
"points": PackedVector2Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 480, 0, 0, 0, 0, 0, 480, 720, 0, 0, 0, 0, 0, 720, 0, 0, 0, 0, 0, 0)
}
point_count = 5
[node name="Main" type="Node"]
script = ExtResource( 1 )
mob_scene = ExtResource( 2 )
script = ExtResource("1")
mob_scene = ExtResource("2")
[node name="ColorRect" type="ColorRect" parent="."]
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
color = Color( 0.219608, 0.372549, 0.380392, 1 )
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")]
[node name="MobTimer" type="Timer" parent="."]
wait_time = 0.5
@@ -32,21 +36,21 @@ wait_time = 0.5
wait_time = 2.0
one_shot = true
[node name="StartPosition" type="Position2D" parent="."]
position = Vector2( 240, 450 )
[node name="StartPosition" type="Marker2D" parent="."]
position = Vector2(240, 450)
[node name="MobPath" type="Path2D" parent="."]
curve = SubResource( 1 )
curve = SubResource("1")
[node name="MobSpawnLocation" type="PathFollow2D" parent="MobPath"]
[node name="HUD" parent="." instance=ExtResource( 4 )]
[node name="HUD" parent="." instance=ExtResource("4")]
[node name="Music" type="AudioStreamPlayer" parent="."]
stream = ExtResource( 5 )
stream = ExtResource("5")
[node name="DeathSound" type="AudioStreamPlayer" parent="."]
stream = ExtResource( 6 )
stream = ExtResource("6")
[connection signal="hit" from="Player" to="." method="game_over"]
[connection signal="timeout" from="MobTimer" to="." method="_on_MobTimer_timeout"]

View File

@@ -1,10 +1,9 @@
extends RigidBody2D
func _ready():
$AnimatedSprite.playing = true
var mob_types = $AnimatedSprite.frames.get_animation_names()
$AnimatedSprite.animation = mob_types[randi() % mob_types.size()]
$AnimatedSprite2D.play()
var mob_types = Array($AnimatedSprite2D.sprite_frames.get_animation_names())
$AnimatedSprite2D.animation = mob_types.pick_random()
func _on_VisibilityNotifier2D_screen_exited():

View File

@@ -1,52 +1,49 @@
[gd_scene load_steps=10 format=2]
[gd_scene load_steps=10 format=3 uid="uid://rkdnhqgf2hpj"]
[ext_resource path="res://Mob.gd" type="Script" id=1]
[ext_resource path="res://art/enemyFlyingAlt_1.png" type="Texture" id=2]
[ext_resource path="res://art/enemyFlyingAlt_2.png" type="Texture" id=3]
[ext_resource path="res://art/enemyWalking_1.png" type="Texture" id=4]
[ext_resource path="res://art/enemyWalking_2.png" type="Texture" id=5]
[ext_resource path="res://art/enemySwimming_1.png" type="Texture" id=6]
[ext_resource path="res://art/enemySwimming_2.png" type="Texture" id=7]
[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( 2 ), ExtResource( 3 ) ],
[sub_resource type="SpriteFrames" id="1"]
animations = [{
"frames": [ExtResource( "6" ), ExtResource( "7" )],
"loop": true,
"name": "fly",
"name": &"swim",
"speed": 4.0
}, {
"frames": [ExtResource( "2" ), ExtResource( "3" )],
"loop": true,
"name": &"fly",
"speed": 3.0
}, {
"frames": [ ExtResource( 6 ), ExtResource( 7 ) ],
"frames": [ExtResource( "4" ), ExtResource( "5" )],
"loop": true,
"name": "swim",
"name": &"walk",
"speed": 4.0
}, {
"frames": [ ExtResource( 4 ), ExtResource( 5 ) ],
"loop": true,
"name": "walk",
"speed": 4.0
} ]
}]
[sub_resource type="CapsuleShape2D" id=2]
radius = 35.2706
height = 23.3281
[sub_resource type="CapsuleShape2D" id="2"]
radius = 37.0
height = 100.0
[node name="Mob" type="RigidBody2D" groups=["mobs"]]
[node name="Mob" type="RigidDynamicBody2D" groups=["mobs"]]
collision_mask = 0
gravity_scale = 0.0
script = ExtResource( 1 )
__meta__ = {
"_edit_group_": true
}
script = ExtResource( "1" )
[node name="AnimatedSprite" type="AnimatedSprite" parent="."]
scale = Vector2( 0.75, 0.75 )
frames = SubResource( 1 )
animation = "walk"
[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 )
shape = SubResource( "2" )
[node name="VisibilityNotifier2D" type="VisibilityNotifier2D" parent="."]
[node name="VisibleOnScreenNotifier2D" type="VisibleOnScreenNotifier2D" parent="."]
[connection signal="screen_exited" from="VisibilityNotifier2D" to="." method="_on_VisibilityNotifier2D_screen_exited"]
[connection signal="screen_exited" from="VisibleOnScreenNotifier2D" to="." method="_on_VisibilityNotifier2D_screen_exited"]

View File

@@ -2,10 +2,9 @@ extends Area2D
signal hit
export var speed = 400 # How fast the player will move (pixels/sec).
@export var speed = 400 # How fast the player will move (pixels/sec).
var screen_size # Size of the game window.
func _ready():
screen_size = get_viewport_rect().size
hide()
@@ -13,32 +12,31 @@ func _ready():
func _process(delta):
var velocity = Vector2.ZERO # The player's movement vector.
if Input.is_action_pressed("move_right"):
if Input.is_action_pressed(&"move_right"):
velocity.x += 1
if Input.is_action_pressed("move_left"):
if Input.is_action_pressed(&"move_left"):
velocity.x -= 1
if Input.is_action_pressed("move_down"):
if Input.is_action_pressed(&"move_down"):
velocity.y += 1
if Input.is_action_pressed("move_up"):
if Input.is_action_pressed(&"move_up"):
velocity.y -= 1
if velocity.length() > 0:
velocity = velocity.normalized() * speed
$AnimatedSprite.play()
$AnimatedSprite2D.play()
else:
$AnimatedSprite.stop()
$AnimatedSprite2D.stop()
position += velocity * delta
position.x = clamp(position.x, 0, screen_size.x)
position.y = clamp(position.y, 0, screen_size.y)
position = position.clamp(Vector2.ZERO, screen_size)
if velocity.x != 0:
$AnimatedSprite.animation = "right"
$AnimatedSprite.flip_v = false
$AnimatedSprite.flip_h = velocity.x < 0
$AnimatedSprite2D.animation = &"right"
$AnimatedSprite2D.flip_v = false
$AnimatedSprite2D.flip_h = velocity.x < 0
elif velocity.y != 0:
$AnimatedSprite.animation = "up"
$AnimatedSprite.flip_v = velocity.y > 0
$AnimatedSprite2D.animation = &"up"
$AnimatedSprite2D.flip_v = velocity.y > 0
func start(pos):
@@ -49,6 +47,6 @@ func start(pos):
func _on_Player_body_entered(_body):
hide() # Player disappears after being hit.
emit_signal("hit")
hit.emit()
# Must be deferred as we can't change physics properties on a physics callback.
$CollisionShape2D.set_deferred("disabled", true)
$CollisionShape2D.set_deferred(&"disabled", true)

View File

@@ -1,71 +1,63 @@
[gd_scene load_steps=13 format=2]
[gd_scene load_steps=13 format=3 uid="uid://4vwrqjegqwpj"]
[ext_resource path="res://Player.gd" type="Script" id=1]
[ext_resource path="res://art/playerGrey_walk1.png" type="Texture" id=2]
[ext_resource path="res://art/playerGrey_walk2.png" type="Texture" id=3]
[ext_resource path="res://art/playerGrey_up1.png" type="Texture" id=4]
[ext_resource path="res://art/playerGrey_up2.png" type="Texture" id=5]
[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"]
[sub_resource type="SpriteFrames" id=1]
animations = [ {
"frames": [ ExtResource( 2 ), ExtResource( 3 ) ],
[sub_resource type="SpriteFrames" id="1"]
animations = [{
"frames": [ExtResource( "2" ), ExtResource( "3" )],
"loop": true,
"name": "right",
"name": &"right",
"speed": 5.0
}, {
"frames": [ ExtResource( 4 ), ExtResource( 5 ) ],
"frames": [ExtResource( "4" ), ExtResource( "5" )],
"loop": true,
"name": "up",
"name": &"up",
"speed": 5.0
} ]
}]
[sub_resource type="CapsuleShape2D" id=2]
radius = 26.1701
height = 14.822
[sub_resource type="CapsuleShape2D" id="2"]
radius = 27.0
height = 68.0
[sub_resource type="Gradient" id=3]
colors = PoolColorArray( 1, 1, 1, 0.501961, 1, 1, 1, 0 )
[sub_resource type="Gradient" id="3"]
colors = PackedColorArray(1, 1, 1, 0.501961, 1, 1, 1, 0)
[sub_resource type="GradientTexture" id=4]
gradient = SubResource( 3 )
[sub_resource type="GradientTexture1D" id="4"]
gradient = SubResource( "3" )
[sub_resource type="Curve" id=5]
_data = [ Vector2( 0.00501098, 0.5 ), 0.0, 0.0, 0, 0, Vector2( 0.994989, 0.324 ), 0.0, 0.0, 0, 0 ]
[sub_resource type="Curve" id="5"]
_data = [Vector2(0.00501098, 0.5), 0.0, 0.0, 0, 0, Vector2(0.994989, 0.324), 0.0, 0.0, 0, 0]
[sub_resource type="CurveTexture" id=6]
curve = SubResource( 5 )
[sub_resource type="CurveTexture" id="6"]
curve = SubResource( "5" )
[sub_resource type="ParticlesMaterial" id=7]
flag_disable_z = true
gravity = Vector3( 0, 0, 0 )
initial_velocity = 1.0
orbit_velocity = 0.0
orbit_velocity_random = 0.0
scale = 0.75
scale_curve = SubResource( 6 )
color_ramp = SubResource( 4 )
[sub_resource type="ParticlesMaterial" id="7"]
gravity = Vector3(0, 0, 0)
scale_curve = SubResource( "6" )
color_ramp = SubResource( "4" )
[node name="Player" type="Area2D"]
z_index = 10
script = ExtResource( 1 )
__meta__ = {
"_edit_group_": true
}
script = ExtResource( "1" )
[node name="AnimatedSprite" type="AnimatedSprite" parent="."]
scale = Vector2( 0.5, 0.5 )
frames = SubResource( 1 )
animation = "right"
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
scale = Vector2(0.5, 0.5)
frames = SubResource( "1" )
animation = &"right"
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
shape = SubResource( 2 )
shape = SubResource( "2" )
[node name="Trail" type="Particles2D" parent="."]
[node name="Trail" type="GPUParticles2D" parent="."]
z_index = -1
amount = 10
speed_scale = 2.0
local_coords = false
process_material = SubResource( 7 )
texture = ExtResource( 2 )
process_material = SubResource( "7" )
texture = ExtResource( "2" )
[connection signal="body_entered" from="." to="." method="_on_Player_body_entered"]

View File

@@ -10,7 +10,7 @@ consider following the tutorial in the documentation.
Language: GDScript
Renderer: GLES 3 (particles are not available in GLES 2)
Renderer: Vulkan Mobile
Note: There is a C# version available [here](https://github.com/godotengine/godot-demo-projects/tree/master/mono/dodge_the_creeps).

View File

@@ -1,15 +1,19 @@
[remap]
importer="ogg_vorbis"
type="AudioStreamOGGVorbis"
path="res://.import/House In a Forest Loop.ogg-1a6a72ae843ad792b7039931227e8d50.oggstr"
importer="oggvorbisstr"
type="AudioStreamOggVorbis"
uid="uid://q2pf4fr8d0ks"
path="res://.godot/imported/House In a Forest Loop.ogg-1a6a72ae843ad792b7039931227e8d50.oggvorbisstr"
[deps]
source_file="res://art/House In a Forest Loop.ogg"
dest_files=[ "res://.import/House In a Forest Loop.ogg-1a6a72ae843ad792b7039931227e8d50.oggstr" ]
dest_files=["res://.godot/imported/House In a Forest Loop.ogg-1a6a72ae843ad792b7039931227e8d50.oggvorbisstr"]
[params]
loop=true
loop_offset=0
bpm=0
beat_count=0
bar_beats=4

View File

@@ -1,8 +1,9 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/enemyFlyingAlt_1.png-559f599b16c69b112c1b53f6332e9489.stex"
type="CompressedTexture2D"
uid="uid://yqglrrsx7j1f"
path="res://.godot/imported/enemyFlyingAlt_1.png-559f599b16c69b112c1b53f6332e9489.ctex"
metadata={
"vram_texture": false
}
@@ -10,26 +11,24 @@ metadata={
[deps]
source_file="res://art/enemyFlyingAlt_1.png"
dest_files=[ "res://.import/enemyFlyingAlt_1.png-559f599b16c69b112c1b53f6332e9489.stex" ]
dest_files=["res://.godot/imported/enemyFlyingAlt_1.png-559f599b16c69b112c1b53f6332e9489.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/hdr_compression=1
compress/normal_map=0
flags/repeat=0
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

View File

@@ -1,8 +1,9 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/enemyFlyingAlt_2.png-31dc7310eda6e1b721224f3cd932c076.stex"
type="CompressedTexture2D"
uid="uid://bpot8awhdn6ph"
path="res://.godot/imported/enemyFlyingAlt_2.png-31dc7310eda6e1b721224f3cd932c076.ctex"
metadata={
"vram_texture": false
}
@@ -10,26 +11,24 @@ metadata={
[deps]
source_file="res://art/enemyFlyingAlt_2.png"
dest_files=[ "res://.import/enemyFlyingAlt_2.png-31dc7310eda6e1b721224f3cd932c076.stex" ]
dest_files=["res://.godot/imported/enemyFlyingAlt_2.png-31dc7310eda6e1b721224f3cd932c076.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/hdr_compression=1
compress/normal_map=0
flags/repeat=0
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

View File

@@ -1,8 +1,9 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/enemySwimming_1.png-dd0e11759dc3d624c8a704f6e98a3d80.stex"
type="CompressedTexture2D"
uid="uid://5lvm88ij4jqn"
path="res://.godot/imported/enemySwimming_1.png-dd0e11759dc3d624c8a704f6e98a3d80.ctex"
metadata={
"vram_texture": false
}
@@ -10,26 +11,24 @@ metadata={
[deps]
source_file="res://art/enemySwimming_1.png"
dest_files=[ "res://.import/enemySwimming_1.png-dd0e11759dc3d624c8a704f6e98a3d80.stex" ]
dest_files=["res://.godot/imported/enemySwimming_1.png-dd0e11759dc3d624c8a704f6e98a3d80.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/hdr_compression=1
compress/normal_map=0
flags/repeat=0
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

View File

@@ -1,8 +1,9 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/enemySwimming_2.png-4c0cbc0732264c4ea3290340bd4a0a62.stex"
type="CompressedTexture2D"
uid="uid://bng45cvsgufqc"
path="res://.godot/imported/enemySwimming_2.png-4c0cbc0732264c4ea3290340bd4a0a62.ctex"
metadata={
"vram_texture": false
}
@@ -10,26 +11,24 @@ metadata={
[deps]
source_file="res://art/enemySwimming_2.png"
dest_files=[ "res://.import/enemySwimming_2.png-4c0cbc0732264c4ea3290340bd4a0a62.stex" ]
dest_files=["res://.godot/imported/enemySwimming_2.png-4c0cbc0732264c4ea3290340bd4a0a62.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/hdr_compression=1
compress/normal_map=0
flags/repeat=0
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

View File

@@ -1,8 +1,9 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/enemyWalking_1.png-5af6eedbe61b701677d490ffdc1e6471.stex"
type="CompressedTexture2D"
uid="uid://bu4221t7qpa7d"
path="res://.godot/imported/enemyWalking_1.png-5af6eedbe61b701677d490ffdc1e6471.ctex"
metadata={
"vram_texture": false
}
@@ -10,26 +11,24 @@ metadata={
[deps]
source_file="res://art/enemyWalking_1.png"
dest_files=[ "res://.import/enemyWalking_1.png-5af6eedbe61b701677d490ffdc1e6471.stex" ]
dest_files=["res://.godot/imported/enemyWalking_1.png-5af6eedbe61b701677d490ffdc1e6471.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/hdr_compression=1
compress/normal_map=0
flags/repeat=0
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

View File

@@ -1,8 +1,9 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/enemyWalking_2.png-67c480ed60c35e95f5acb0436246b935.stex"
type="CompressedTexture2D"
uid="uid://booij5t7h4efb"
path="res://.godot/imported/enemyWalking_2.png-67c480ed60c35e95f5acb0436246b935.ctex"
metadata={
"vram_texture": false
}
@@ -10,26 +11,24 @@ metadata={
[deps]
source_file="res://art/enemyWalking_2.png"
dest_files=[ "res://.import/enemyWalking_2.png-67c480ed60c35e95f5acb0436246b935.stex" ]
dest_files=["res://.godot/imported/enemyWalking_2.png-67c480ed60c35e95f5acb0436246b935.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/hdr_compression=1
compress/normal_map=0
flags/repeat=0
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

View File

@@ -1,13 +1,14 @@
[remap]
importer="wav"
type="AudioStreamSample"
path="res://.import/gameover.wav-98c95c744b35280048c2bd093cf8a356.sample"
type="AudioStreamWAV"
uid="uid://dw26fpygeag8o"
path="res://.godot/imported/gameover.wav-98c95c744b35280048c2bd093cf8a356.sample"
[deps]
source_file="res://art/gameover.wav"
dest_files=[ "res://.import/gameover.wav-98c95c744b35280048c2bd093cf8a356.sample" ]
dest_files=["res://.godot/imported/gameover.wav-98c95c744b35280048c2bd093cf8a356.sample"]
[params]

View File

@@ -1,8 +1,9 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/playerGrey_up1.png-6bd114d0a6beac91f48e3a7314d44564.stex"
type="CompressedTexture2D"
uid="uid://b4yyoafu8bi0q"
path="res://.godot/imported/playerGrey_up1.png-6bd114d0a6beac91f48e3a7314d44564.ctex"
metadata={
"vram_texture": false
}
@@ -10,26 +11,24 @@ metadata={
[deps]
source_file="res://art/playerGrey_up1.png"
dest_files=[ "res://.import/playerGrey_up1.png-6bd114d0a6beac91f48e3a7314d44564.stex" ]
dest_files=["res://.godot/imported/playerGrey_up1.png-6bd114d0a6beac91f48e3a7314d44564.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/hdr_compression=1
compress/normal_map=0
flags/repeat=0
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

View File

@@ -1,8 +1,9 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/playerGrey_up2.png-d6aba85f5f2675ebc7045efa7552ee79.stex"
type="CompressedTexture2D"
uid="uid://bko65a0nd66st"
path="res://.godot/imported/playerGrey_up2.png-d6aba85f5f2675ebc7045efa7552ee79.ctex"
metadata={
"vram_texture": false
}
@@ -10,26 +11,24 @@ metadata={
[deps]
source_file="res://art/playerGrey_up2.png"
dest_files=[ "res://.import/playerGrey_up2.png-d6aba85f5f2675ebc7045efa7552ee79.stex" ]
dest_files=["res://.godot/imported/playerGrey_up2.png-d6aba85f5f2675ebc7045efa7552ee79.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/hdr_compression=1
compress/normal_map=0
flags/repeat=0
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

View File

@@ -1,8 +1,9 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/playerGrey_walk1.png-c4773fe7a7bf85d7ab732eb4458c2742.stex"
type="CompressedTexture2D"
uid="uid://ftkxr8r4qghp"
path="res://.godot/imported/playerGrey_walk1.png-c4773fe7a7bf85d7ab732eb4458c2742.ctex"
metadata={
"vram_texture": false
}
@@ -10,26 +11,24 @@ metadata={
[deps]
source_file="res://art/playerGrey_walk1.png"
dest_files=[ "res://.import/playerGrey_walk1.png-c4773fe7a7bf85d7ab732eb4458c2742.stex" ]
dest_files=["res://.godot/imported/playerGrey_walk1.png-c4773fe7a7bf85d7ab732eb4458c2742.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/hdr_compression=1
compress/normal_map=0
flags/repeat=0
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

View File

@@ -1,8 +1,9 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/playerGrey_walk2.png-34d2d916366100182d08037c51884043.stex"
type="CompressedTexture2D"
uid="uid://couyhcegeihme"
path="res://.godot/imported/playerGrey_walk2.png-34d2d916366100182d08037c51884043.ctex"
metadata={
"vram_texture": false
}
@@ -10,26 +11,24 @@ metadata={
[deps]
source_file="res://art/playerGrey_walk2.png"
dest_files=[ "res://.import/playerGrey_walk2.png-34d2d916366100182d08037c51884043.stex" ]
dest_files=["res://.godot/imported/playerGrey_walk2.png-34d2d916366100182d08037c51884043.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/hdr_compression=1
compress/normal_map=0
flags/repeat=0
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

View File

@@ -0,0 +1,6 @@
[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

@@ -0,0 +1,33 @@
[remap]
importer="font_data_dynamic"
type="FontFile"
uid="uid://cit6gwe5px1q8"
path="res://.godot/imported/Xolonium-Regular.ttf-bc2981e3069cff4c34dd7c8e2bb73fba.fontdata"
[deps]
source_file="res://fonts/Xolonium-Regular.ttf"
dest_files=["res://.godot/imported/Xolonium-Regular.ttf-bc2981e3069cff4c34dd7c8e2bb73fba.fontdata"]
[params]
Rendering=null
antialiasing=1
generate_mipmaps=false
multichannel_signed_distance_field=false
msdf_pixel_range=8
msdf_size=48
allow_system_fallback=true
force_autohinter=false
hinting=1
subpixel_positioning=1
oversampling=0.0
Fallbacks=null
fallbacks=[]
Compress=null
compress=true
preload=[]
language_support={}
script_support={}
opentype_features={}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

View File

@@ -1,35 +0,0 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://icon.png"
dest_files=[ "res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

View File

@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://brwp8bimc75uu"
path="res://.godot/imported/icon.webp-e94f9a68b0f625a567a797079e4d325f.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://icon.webp"
dest_files=["res://.godot/imported/icon.webp-e94f9a68b0f625a567a797079e4d325f.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
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/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

View File

@@ -6,7 +6,7 @@
; [section] ; section goes between []
; param=value ; assign values to parameters
config_version=4
config_version=5
[application]
@@ -18,51 +18,63 @@ This is a finished version of the game featured in the 'Your first 2D game'
tutorial in the documentation. For more details, consider
following the tutorial in the documentation."
run/main_scene="res://Main.tscn"
config/icon="res://icon.png"
config/features=PackedStringArray("4.0")
config/icon="res://icon.webp"
config/tags=PackedStringArray("2d", "demo", "official")
[debug]
gdscript/warnings/redundant_await=false
[display]
window/size/width=480
window/size/height=720
window/stretch/mode="2d"
window/stretch/aspect="keep"
window/size/viewport_width=480
window/size/viewport_height=720
window/size/window_width_override=480
window/size/window_height_override=720
window/stretch/mode="canvas_items"
[input]
move_left={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777231,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":65,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
"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)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":14,"pressure":0.0,"pressed":false,"script":null)
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":0,"axis_value":-1.0,"script":null)
]
]
}
move_right={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777233,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":68,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
"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)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":15,"pressure":0.0,"pressed":false,"script":null)
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":0,"axis_value":1.0,"script":null)
]
]
}
move_up={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777232,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":87,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
"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)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":12,"pressure":0.0,"pressed":false,"script":null)
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":1,"axis_value":-1.0,"script":null)
]
]
}
move_down={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777234,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":83,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
"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)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":13,"pressure":0.0,"pressed":false,"script":null)
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":1,"axis_value":1.0,"script":null)
]
]
}
start_game={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777221,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
]
"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)
]
}
[rendering]
renderer/rendering_method="mobile"

View File

@@ -0,0 +1,13 @@
# Dynamic TileMap Layers
Example of how to make a fake wall using TileMap's
`_tile_data_runtime_update()` method. It shows how
to disable collisions per layer.
Language: GDScript
Renderer: OpenGL
## Screenshots
![Screenshot](screenshots/fake_wall.png)

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

View File

@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bpov140lx7at3"
path="res://.godot/imported/icon.png-487276ed1e3a0c39cad0279d744ee560.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://icon.png"
dest_files=["res://.godot/imported/icon.png-487276ed1e3a0c39cad0279d744ee560.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
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/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

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://cs8h2qyuakmko"
path="res://.godot/imported/obstacle.png-06287f6b2d26dd03335fd87ab78c2cc2.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://level/obstacle.png"
dest_files=["res://.godot/imported/obstacle.png-06287f6b2d26dd03335fd87ab78c2cc2.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
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/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

View File

@@ -0,0 +1,57 @@
extends TileMap
var secret_layer: int # You can have multiple layers if you make this an array.
var player_in_secret: bool
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)
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))
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))
else:
set_process(false)
func _use_tile_data_runtime_update(layer: int, _coords: Vector2i) -> bool:
if layer == secret_layer:
return true
return false
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 _on_secret_detector_body_entered(body: Node2D) -> void:
if not body is CharacterBody2D: # Detect player only.
return
player_in_secret = true
set_process(true)
func _on_secret_detector_body_exited(body: Node2D) -> void:
if not body is CharacterBody2D:
return
player_in_secret = false
set_process(true)

View File

@@ -0,0 +1,32 @@
extends CharacterBody2D
const WALK_FORCE = 600
const WALK_MAX_SPEED = 200
const STOP_FORCE = 1300
const JUMP_SPEED = 200
@onready var gravity = ProjectSettings.get_setting("physics/2d/default_gravity")
func _physics_process(delta):
# Horizontal movement code. First, get the player's input.
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.
velocity.x = move_toward(velocity.x, 0, STOP_FORCE * delta)
else:
velocity.x += walk * delta
# Clamp to the maximum horizontal movement speed.
velocity.x = clamp(velocity.x, -WALK_MAX_SPEED, WALK_MAX_SPEED)
# Vertical movement code. Apply gravity.
velocity.y += gravity * delta
# Move based on the velocity and snap to the ground.
# TODO: This information should be set to the CharacterBody properties instead of arguments: snap, Vector2.DOWN, Vector2.UP
# TODO: Rename velocity to linear_velocity in the rest of the script.
move_and_slide()
# Check for jumping. is_on_floor() must be called after movement code.
if is_on_floor() and Input.is_action_just_pressed(&"jump"):
velocity.y = -JUMP_SPEED

Binary file not shown.

After

Width:  |  Height:  |  Size: 502 B

View File

@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dfb8rr2fakwgp"
path="res://.godot/imported/player.png-1ad27fc2a62fa126eae918723933dd6f.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://player/player.png"
dest_files=["res://.godot/imported/player.png-1ad27fc2a62fa126eae918723933dd6f.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
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/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

View File

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

View File

@@ -0,0 +1,66 @@
; 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="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."
run/main_scene="res://world.tscn"
config/features=PackedStringArray("4.2")
config/icon="res://icon.png"
[display]
window/size/viewport_width=530
window/size/viewport_height=495
window/stretch/mode="canvas_items"
window/stretch/aspect="expand"
[input]
jump={
"deadzone": 0.5,
"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)
]
}
move_left={
"deadzone": 0.5,
"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)
]
}
move_right={
"deadzone": 0.5,
"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)
]
}
[physics]
common/physics_ticks_per_second=120
2d/default_gravity=500
[rendering]
renderer/rendering_method="gl_compatibility"
environment/defaults/default_clear_color=Color(0.156863, 0.133333, 0.25098, 1)
anti_aliasing/quality/msaa_2d=2

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

View File

@@ -0,0 +1,57 @@
[gd_scene load_steps=8 format=3 uid="uid://de7qapkqfycxl"]
[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"]
[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
physics_layer_0/physics_material = SubResource("PhysicsMaterial_on5ov")
sources/0 = SubResource("TileSetAtlasSource_vnjib")
[sub_resource type="RectangleShape2D" id="RectangleShape2D_a2gec"]
size = Vector2(112, 48)
[node name="World" type="Node2D"]
[node name="TileMap" type="TileMap" parent="."]
z_index = 1
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)
[node name="Player" parent="." instance=ExtResource("3")]
position = Vector2(120, 456)
[node name="SecretDetector" type="Area2D" parent="."]
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"]

View File

@@ -1,60 +1,83 @@
[gd_scene load_steps=6 format=2]
[gd_scene load_steps=8 format=3 uid="uid://dmn8nkpogiwsf"]
[ext_resource path="res://player/Player.tscn" type="PackedScene" id=1]
[ext_resource path="res://fonts/source_code_pro_explanations.tres" type="DynamicFont" id=2]
[ext_resource path="res://debug/StatesStackDiplayer.tscn" type="PackedScene" id=3]
[ext_resource path="res://debug/ControlsPanel.tscn" type="PackedScene" id=4]
[ext_resource path="res://fonts/source_code_pro_explanations_bold.tres" type="DynamicFont" id=5]
[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"]
[sub_resource type="Animation" id="1"]
[sub_resource type="Animation" id="2"]
length = 0.6
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("BodyPivot/Body:modulate")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.05, 0.1, 0.15, 0.2, 0.25, 0.4),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1),
"update": 0,
"values": [Color(1, 1, 1, 1), Color(1, 0, 0, 1), Color(1, 1, 1, 1), Color(1, 0, 0, 1), Color(1, 1, 1, 1), Color(1, 0, 0, 1), Color(1, 1, 1, 1)]
}
[sub_resource type="Animation" id="3"]
[sub_resource type="AnimationLibrary" id="AnimationLibrary_qbwwp"]
_data = {
"idle": SubResource("1"),
"stagger": SubResource("2"),
"walk": SubResource("3")
}
[node name="Demo" type="Node"]
[node name="Player" parent="." instance=ExtResource( 1 )]
position = Vector2( 640, 400 )
[node name="Player" parent="." instance=ExtResource("1")]
position = Vector2(640, 400)
[node name="StateMachine" parent="Player" index="0"]
start_state = NodePath("Idle")
[node name="AnimationPlayer" parent="Player" index="1"]
libraries = {
"": SubResource("AnimationLibrary_qbwwp")
}
[node name="Explanations" type="RichTextLabel" parent="."]
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = 10.0
margin_top = -370.0
margin_right = -10.0
margin_bottom = -730.0
rect_clip_content = false
mouse_filter = 2
offset_left = 10.0
offset_top = -370.0
offset_right = -10.0
offset_bottom = -730.0
grow_horizontal = 2
grow_vertical = 2
size_flags_vertical = 4
custom_fonts/bold_font = ExtResource( 5 )
custom_fonts/normal_font = ExtResource( 2 )
mouse_filter = 2
bbcode_enabled = true
bbcode_text = "This example shows how to apply the State programming pattern in GDScript, including Hierarchical States, and a pushdown automaton.
States are common in games. You can use the pattern to:
1. Separate each behavior and transitions between behaviors, thus make scripts shorter and easier to manage
2. Respect the Single Responsibility Principle. Each State object represents [b]one[/b] action
3. Improve your code's structure. Look at the scene tree and FileSystem tab: without looking at the code, you'll know what the Player can or cannot do.
You can read more about States in the excellent [url=http://gameprogrammingpatterns.com/state.html]Game Programming Patterns ebook[/url]."
text = "This example shows how to apply the State programming pattern in GDScript, including Hierarchical States, and a pushdown automaton.
States are common in games. You can use the pattern to:
1. Separate each behavior and transitions between behaviors, thus make scripts shorter and easier to manage
2. Respect the Single Responsibility Principle. Each State object represents one action
1. Separate each behavior and transitions between behaviors, thus make scripts shorter and easier to manage.
2. Respect the Single Responsibility Principle. Each State object represents one action.
3. Improve your code's structure. Look at the scene tree and FileSystem tab: without looking at the code, you'll know what the Player can or cannot do.
You can read more about States in the excellent Game Programming Patterns ebook."
__meta__ = {
"_edit_lock_": true
}
[node name="Control" type="Control" parent="."]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
__meta__ = {
"_edit_use_anchors_": false
}
grow_horizontal = 2
grow_vertical = 2
[node name="StatesStackDiplayer" parent="Control" instance=ExtResource( 3 )]
[node name="StatesStackDiplayer" parent="Control" instance=ExtResource("3")]
layout_mode = 0
[node name="ControlsPanel" parent="Control" instance=ExtResource( 4 )]
[node name="ControlsPanel" parent="Control" instance=ExtResource("4")]
layout_mode = 1
[editable path="Player"]

View File

@@ -6,7 +6,7 @@ pushdown automaton.
Language: GDScript
Renderer: GLES 2
Renderer: Compatibility
Check out this demo on the asset library: https://godotengine.org/asset-library/asset/516

View File

@@ -1,38 +1,41 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://fonts/source_code_pro_explanations.tres" type="DynamicFont" id=1]
[gd_scene format=3 uid="uid://bq6rrfy53rfvo"]
[node name="ControlsPanel" type="Panel"]
anchors_preset = 1
anchor_left = 1.0
anchor_right = 1.0
margin_left = -220.0
margin_bottom = 170.0
offset_left = -150.0
offset_bottom = 171.0
grow_horizontal = 0
[node name="Keys" type="Label" parent="."]
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = 10.0
margin_top = 10.0
margin_right = -10.0
margin_bottom = -10.0
custom_fonts/font = ExtResource( 1 )
text = "Shoot:
[node name="HBoxContainer" type="HBoxContainer" parent="."]
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -56.5
offset_top = -65.0
offset_right = 56.5
offset_bottom = 65.0
grow_horizontal = 2
grow_vertical = 2
[node name="Actions" type="Label" parent="HBoxContainer"]
layout_mode = 2
text = "Move:
Shoot:
Attack:
Stagger:
Jump:
Sprint:"
[node name="Keys2" type="Label" parent="."]
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = 10.0
margin_top = 10.0
margin_right = -10.0
margin_bottom = -10.0
custom_fonts/font = ExtResource( 1 )
text = "R
[node name="Keys" type="Label" parent="HBoxContainer"]
layout_mode = 2
text = "WASD
R
F
X
Space
Shift"
align = 2

View File

@@ -1,30 +1,16 @@
[gd_scene load_steps=3 format=2]
[ext_resource path="res://fonts/source_code_pro_explanations_bold.tres" type="DynamicFont" id=1]
[ext_resource path="res://fonts/source_code_pro_explanations.tres" type="DynamicFont" id=2]
[gd_scene format=3 uid="uid://bywptem1jb35a"]
[node name="Explanations" type="RichTextLabel"]
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = 10.0
margin_top = -370.0
margin_right = -10.0
margin_bottom = -730.0
rect_clip_content = false
mouse_filter = 2
offset_left = 10.0
offset_top = -370.0
offset_right = -10.0
offset_bottom = -730.0
size_flags_vertical = 4
custom_fonts/bold_font = ExtResource( 1 )
custom_fonts/normal_font = ExtResource( 2 )
mouse_filter = 2
bbcode_enabled = true
bbcode_text = "This example shows how to apply the State programming pattern in GDscript, including Hierarchical States, and a pushdown automaton.
States are common in games. You can use the pattern to:
1. Separate each behavior and transitions between behaviors, thus make scripts shorter and easier to manage
2. Respect the Single Responsibility Principle. Each State object represents [b]one[/b] action
3. Improve your code's structure. Look at the scene tree and FileSystem tab: without looking at the code, you'll know what the Player can or cannot do.
You can read more about States in the excellent [url=http://gameprogrammingpatterns.com/state.html]Game Programming Patterns ebook[/url]."
text = "This example shows how to apply the State programming pattern in GDscript, including Hierarchical States, and a pushdown automaton.
States are common in games. You can use the pattern to:
@@ -34,6 +20,3 @@ States are common in games. You can use the pattern to:
3. Improve your code's structure. Look at the scene tree and FileSystem tab: without looking at the code, you'll know what the Player can or cannot do.
You can read more about States in the excellent Game Programming Patterns ebook."
__meta__ = {
"_edit_lock_": true
}

View File

@@ -1,48 +1,37 @@
[gd_scene load_steps=4 format=2]
[gd_scene load_steps=2 format=3 uid="uid://cvi13chv8g4hj"]
[ext_resource path="res://debug/states_stack_displayer.gd" type="Script" id=1]
[ext_resource path="res://fonts/SourceCodePro-Bold.ttf" type="DynamicFontData" id=2]
[sub_resource type="DynamicFont" id=1]
size = 20
use_filter = true
font_data = ExtResource( 2 )
[ext_resource type="Script" path="res://debug/states_stack_displayer.gd" id="1"]
[node name="StatesStackDiplayer" type="Panel"]
margin_right = 210.0
margin_bottom = 170.0
script = ExtResource( 1 )
__meta__ = {
"_edit_group_": true
}
offset_right = 210.0
offset_bottom = 170.0
script = ExtResource("1")
[node name="Title" type="Label" parent="."]
anchor_left = 0.5
anchor_right = 0.5
margin_left = -105.0
margin_right = 105.0
margin_bottom = 40.0
custom_fonts/font = SubResource( 1 )
text = "Pushown"
align = 1
valign = 1
[node name="VBoxContainer" type="VBoxContainer" parent="."]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="Title" type="Label" parent="VBoxContainer"]
layout_mode = 2
text = "StateStack"
uppercase = true
[node name="States" type="Label" parent="."]
margin_left = 20.0
margin_top = 50.0
margin_right = 190.0
margin_bottom = 170.0
custom_fonts/font = SubResource( 1 )
text = "Jump
Test"
align = 1
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer"]
layout_mode = 2
[node name="Numbers" type="Label" parent="."]
margin_left = 20.0
margin_top = 50.0
margin_right = 190.0
margin_bottom = 170.0
custom_fonts/font = SubResource( 1 )
[node name="Numbers" type="Label" parent="VBoxContainer/HBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
text = "1.
2."
horizontal_alignment = 2
[node name="States" type="Label" parent="VBoxContainer/HBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
text = "Jump
Test"

View File

@@ -1,7 +1,6 @@
extends Panel
onready var fsm_node = get_node("../../Player/StateMachine")
@onready var fsm_node = get_node(^"../../Player/StateMachine")
func _process(_delta):
var states_names = ""
@@ -11,5 +10,5 @@ func _process(_delta):
states_names += String(state.get_name()) + "\n"
numbers += str(index) + "\n"
index += 1
$States.text = states_names
$Numbers.text = numbers
%States.text = states_names
%Numbers.text = numbers

View File

@@ -0,0 +1,33 @@
[remap]
importer="font_data_dynamic"
type="FontFile"
uid="uid://b7c5m4mw0jhww"
path="res://.godot/imported/SourceCodePro-Black.ttf-5ac54eeedbdedbc63d01069716d9852f.fontdata"
[deps]
source_file="res://fonts/SourceCodePro-Black.ttf"
dest_files=["res://.godot/imported/SourceCodePro-Black.ttf-5ac54eeedbdedbc63d01069716d9852f.fontdata"]
[params]
Rendering=null
antialiasing=1
generate_mipmaps=false
multichannel_signed_distance_field=false
msdf_pixel_range=8
msdf_size=48
allow_system_fallback=true
force_autohinter=false
hinting=1
subpixel_positioning=1
oversampling=0.0
Fallbacks=null
fallbacks=[]
Compress=null
compress=true
preload=[]
language_support={}
script_support={}
opentype_features={}

View File

@@ -0,0 +1,33 @@
[remap]
importer="font_data_dynamic"
type="FontFile"
uid="uid://b5bspum6ffekd"
path="res://.godot/imported/SourceCodePro-Bold.ttf-bf03bd9c90603419d32725fc00754bf7.fontdata"
[deps]
source_file="res://fonts/SourceCodePro-Bold.ttf"
dest_files=["res://.godot/imported/SourceCodePro-Bold.ttf-bf03bd9c90603419d32725fc00754bf7.fontdata"]
[params]
Rendering=null
antialiasing=1
generate_mipmaps=false
multichannel_signed_distance_field=false
msdf_pixel_range=8
msdf_size=48
allow_system_fallback=true
force_autohinter=false
hinting=1
subpixel_positioning=1
oversampling=0.0
Fallbacks=null
fallbacks=[]
Compress=null
compress=true
preload=[]
language_support={}
script_support={}
opentype_features={}

View File

@@ -1,6 +1,6 @@
[gd_resource type="DynamicFont" load_steps=2 format=2]
[gd_resource type="Font" load_steps=2 format=2]
[ext_resource path="res://fonts/SourceCodePro-Bold.ttf" type="DynamicFontData" id=1]
[ext_resource path="res://fonts/SourceCodePro-Bold.ttf" type="FontData" id=1]
[resource]

View File

@@ -1,6 +1,6 @@
[gd_resource type="DynamicFont" load_steps=2 format=2]
[gd_resource type="Font" load_steps=2 format=2]
[ext_resource path="res://fonts/SourceCodePro-Black.ttf" type="DynamicFontData" id=1]
[ext_resource path="res://fonts/SourceCodePro-Black.ttf" type="FontData" id=1]
[resource]

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

View File

@@ -1,35 +0,0 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://icon.png"
dest_files=[ "res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View File

@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://brwp8bimc75uu"
path="res://.godot/imported/icon.webp-e94f9a68b0f625a567a797079e4d325f.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://icon.webp"
dest_files=["res://.godot/imported/icon.webp-e94f9a68b0f625a567a797079e4d325f.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
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/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

View File

@@ -1,122 +1,118 @@
[gd_scene load_steps=20 format=2]
[gd_scene load_steps=19 format=3 uid="uid://bpdyvy2681m3i"]
[ext_resource path="res://player/player_controller.gd" type="Script" id=1]
[ext_resource path="res://player/player_state_machine.gd" type="Script" id=2]
[ext_resource path="res://player/states/motion/on_ground/idle.gd" type="Script" id=3]
[ext_resource path="res://player/states/motion/on_ground/move.gd" type="Script" id=4]
[ext_resource path="res://player/states/motion/in_air/jump.gd" type="Script" id=5]
[ext_resource path="res://player/states/combat/stagger.gd" type="Script" id=6]
[ext_resource path="res://player/states/combat/attack.gd" type="Script" id=7]
[ext_resource path="res://player/states/die.gd" type="Script" id=8]
[ext_resource path="res://player/shadow.png" type="Texture" id=9]
[ext_resource path="res://player/body.png" type="Texture" id=10]
[ext_resource path="res://player/bullet/bullet_spawner.gd" type="Script" id=11]
[ext_resource path="res://player/weapon/weapon_pivot.gd" type="Script" id=12]
[ext_resource path="res://player/weapon/Sword.tscn" type="PackedScene" id=13]
[ext_resource path="res://fonts/SourceCodePro-Bold.ttf" type="DynamicFontData" id=14]
[ext_resource path="res://player/states/debug/state_name_displayer.gd" type="Script" id=15]
[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"]
[sub_resource type="Animation" id=1]
[sub_resource type="Animation" id="1"]
[sub_resource type="Animation" id=2]
[sub_resource type="Animation" id="2"]
length = 0.6
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("BodyPivot/Body:modulate")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 0.05, 0.1, 0.15, 0.2, 0.25, 0.4 ),
"transitions": PoolRealArray( 1, 1, 1, 1, 1, 1, 1 ),
"times": PackedFloat32Array(0, 0.05, 0.1, 0.15, 0.2, 0.25, 0.4),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1),
"update": 0,
"values": [ Color( 1, 1, 1, 1 ), Color( 1, 0, 0, 1 ), Color( 1, 1, 1, 1 ), Color( 1, 0, 0, 1 ), Color( 1, 1, 1, 1 ), Color( 1, 0, 0, 1 ), Color( 1, 1, 1, 1 ) ]
"values": [Color(1, 1, 1, 1), Color(1, 0, 0, 1), Color(1, 1, 1, 1), Color(1, 0, 0, 1), Color(1, 1, 1, 1), Color(1, 0, 0, 1), Color(1, 1, 1, 1)]
}
[sub_resource type="Animation" id=3]
[sub_resource type="Animation" id="3"]
[sub_resource type="DynamicFont" id=4]
size = 20
use_filter = true
font_data = ExtResource( 14 )
[node name="Player" type="KinematicBody2D"]
script = ExtResource( 1 )
__meta__ = {
"_edit_horizontal_guides_": [ ]
[sub_resource type="AnimationLibrary" id="AnimationLibrary_vi1hn"]
_data = {
"idle": SubResource("1"),
"stagger": SubResource("2"),
"walk": SubResource("3")
}
[node name="Player" type="CharacterBody2D"]
script = ExtResource("1")
[node name="StateMachine" type="Node" parent="."]
script = ExtResource( 2 )
script = ExtResource("2")
[node name="Idle" type="Node" parent="StateMachine"]
script = ExtResource( 3 )
script = ExtResource("3")
[node name="Move" type="Node" parent="StateMachine"]
script = ExtResource( 4 )
script = ExtResource("4")
[node name="Jump" type="Node" parent="StateMachine"]
script = ExtResource( 5 )
script = ExtResource("5")
[node name="Stagger" type="Node" parent="StateMachine"]
script = ExtResource( 6 )
script = ExtResource("6")
[node name="Attack" type="Node" parent="StateMachine"]
script = ExtResource( 7 )
script = ExtResource("7")
[node name="Die" type="Node" parent="StateMachine"]
script = ExtResource( 8 )
script = ExtResource("8")
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
anims/idle = SubResource( 1 )
anims/stagger = SubResource( 2 )
anims/walk = SubResource( 3 )
libraries = {
"": SubResource("AnimationLibrary_vi1hn")
}
[node name="Shadow" type="Sprite" parent="."]
self_modulate = Color( 1, 1, 1, 0.361098 )
position = Vector2( 0, -4 )
texture = ExtResource( 9 )
[node name="Shadow" type="Sprite2D" parent="."]
self_modulate = Color(1, 1, 1, 0.361098)
position = Vector2(0, -4)
texture = ExtResource("9")
[node name="BodyPivot" type="Position2D" parent="."]
[node name="BodyPivot" type="Marker2D" parent="."]
[node name="Body" type="Sprite" parent="BodyPivot"]
position = Vector2( 0, -58 )
texture = ExtResource( 10 )
[node name="Body" type="Sprite2D" parent="BodyPivot"]
position = Vector2(0, -58)
texture = ExtResource("10")
[node name="BulletSpawn" type="Node2D" parent="BodyPivot"]
position = Vector2( 0, -58 )
script = ExtResource( 11 )
position = Vector2(0, -58)
script = ExtResource("11")
[node name="CooldownTimer" type="Timer" parent="BodyPivot/BulletSpawn"]
wait_time = 0.2
one_shot = true
[node name="WeaponPivot" type="Position2D" parent="BodyPivot"]
position = Vector2( 0, -58 )
script = ExtResource( 12 )
[node name="WeaponPivot" type="Marker2D" parent="BodyPivot"]
position = Vector2(0, -58)
script = ExtResource("12")
[node name="Offset" type="Position2D" parent="BodyPivot/WeaponPivot"]
position = Vector2( 110, 0 )
[node name="Offset" type="Marker2D" parent="BodyPivot/WeaponPivot"]
position = Vector2(110, 0)
[node name="Sword" parent="BodyPivot/WeaponPivot/Offset" instance=ExtResource( 13 )]
[node name="Sword" parent="BodyPivot/WeaponPivot/Offset" instance=ExtResource("13")]
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="."]
polygon = PoolVector2Array( -20, 0, -20, -20, 20, -20, 20, 0 )
polygon = PackedVector2Array(-20, 0, -20, -20, 20, -20, 20, 0)
[node name="StateNameDisplayer" type="Label" parent="."]
margin_left = -109.0
margin_top = -172.0
margin_right = 110.0
margin_bottom = -138.0
custom_fonts/font = SubResource( 4 )
offset_left = -109.0
offset_top = -180.0
offset_right = 110.0
offset_bottom = -143.0
theme_override_colors/font_outline_color = Color(0, 0, 0, 1)
theme_override_constants/outline_size = 8
theme_override_font_sizes/font_size = 24
text = "Idle"
align = 1
valign = 1
horizontal_alignment = 1
uppercase = true
script = ExtResource( 15 )
__meta__ = {
"_edit_use_anchors_": false
}
script = ExtResource("15")
[connection signal="state_changed" from="StateMachine" to="BodyPivot/WeaponPivot/Offset/Sword" method="_on_StateMachine_state_changed"]
[connection signal="state_changed" from="StateMachine" to="StateNameDisplayer" method="_on_StateMachine_state_changed"]

View File

@@ -1,8 +1,9 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/body.png-313f6363670a5852a7b7126ab476d8b1.stex"
type="CompressedTexture2D"
uid="uid://ds53oxkqrcumd"
path="res://.godot/imported/body.png-313f6363670a5852a7b7126ab476d8b1.ctex"
metadata={
"vram_texture": false
}
@@ -10,26 +11,24 @@ metadata={
[deps]
source_file="res://player/body.png"
dest_files=[ "res://.import/body.png-313f6363670a5852a7b7126ab476d8b1.stex" ]
dest_files=["res://.godot/imported/body.png-313f6363670a5852a7b7126ab476d8b1.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/hdr_compression=1
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

View File

@@ -1,14 +1,14 @@
[gd_scene load_steps=3 format=2]
[gd_scene load_steps=3 format=3 uid="uid://b6uru8lfx45ma"]
[ext_resource path="res://player/bullet/bullet.gd" type="Script" id=1]
[ext_resource type="Script" path="res://player/bullet/bullet.gd" id="1"]
[sub_resource type="CircleShape2D" id=1]
[sub_resource type="CircleShape2D" id="1"]
radius = 12.0
[node name="Bullet" type="KinematicBody2D"]
[node name="Bullet" type="CharacterBody2D"]
collision_layer = 2
collision_mask = 2
script = ExtResource( 1 )
script = ExtResource("1")
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
shape = SubResource( 1 )
shape = SubResource("1")

View File

@@ -1,13 +1,12 @@
extends KinematicBody2D
extends CharacterBody2D
var direction = Vector2()
export(float) var speed = 1000.0
onready var root = get_tree().root
@export var speed: float = 1000.0
@onready var root = get_tree().root
func _ready():
set_as_toplevel(true)
set_as_top_level(true)
func _physics_process(delta):
@@ -21,4 +20,4 @@ func _physics_process(delta):
func _draw():
draw_circle(Vector2(), $CollisionShape2D.shape.radius, Color.white)
draw_circle(Vector2(), $CollisionShape2D.shape.radius, Color.WHITE)

View File

@@ -2,7 +2,6 @@ extends Node2D
var bullet = preload("Bullet.tscn")
func _unhandled_input(event):
if event.is_action_pressed("fire"):
fire()
@@ -13,7 +12,7 @@ func fire():
return
$CooldownTimer.start()
var new_bullet = bullet.instance()
var new_bullet = bullet.instantiate()
add_child(new_bullet)
new_bullet.position = global_position
new_bullet.direction = owner.look_direction

View File

@@ -1,15 +1,17 @@
extends KinematicBody2D
# The Player is a KinematicBody2D, in other words a physics-driven object.
extends CharacterBody2D
# The Player is a CharacterBody2D, in other words a physics-driven object.
# It can move, collide with the world, etc...
# The player has a state machine, but the body and the state machine are separate.
signal direction_changed(new_direction)
var look_direction = Vector2.RIGHT setget set_look_direction
var look_direction = Vector2.RIGHT:
set(value):
look_direction = value
set_look_direction(value)
func take_damage(attacker, amount, effect = null):
if is_a_parent_of(attacker):
if is_ancestor_of(attacker):
return
$States/Stagger.knockback_direction = (attacker.global_position - global_position).normalized()
$Health.take_damage(amount, effect)
@@ -22,5 +24,4 @@ func set_dead(value):
func set_look_direction(value):
look_direction = value
emit_signal("direction_changed", value)

View File

@@ -1,11 +1,10 @@
extends "res://state_machine/state_machine.gd"
onready var idle = $Idle
onready var move = $Move
onready var jump = $Jump
onready var stagger = $Stagger
onready var attack = $Attack
@onready var idle = $Idle
@onready var move = $Move
@onready var jump = $Jump
@onready var stagger = $Stagger
@onready var attack = $Attack
func _ready():
states_map = {
@@ -25,7 +24,7 @@ func _change_state(state_name):
states_stack.push_front(states_map[state_name])
if state_name == "jump" and current_state == move:
jump.initialize(move.speed, move.velocity)
._change_state(state_name)
super._change_state(state_name)
func _unhandled_input(event):

View File

@@ -1,8 +1,9 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/shadow.png-493c4635eca1ce8bdece629560617dc7.stex"
type="CompressedTexture2D"
uid="uid://eds33w28pilu"
path="res://.godot/imported/shadow.png-493c4635eca1ce8bdece629560617dc7.ctex"
metadata={
"vram_texture": false
}
@@ -10,26 +11,24 @@ metadata={
[deps]
source_file="res://player/shadow.png"
dest_files=[ "res://.import/shadow.png-493c4635eca1ce8bdece629560617dc7.stex" ]
dest_files=["res://.godot/imported/shadow.png-493c4635eca1ce8bdece629560617dc7.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/hdr_compression=1
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

View File

@@ -1,8 +1,7 @@
extends "res://state_machine/state.gd"
func enter():
owner.get_node("AnimationPlayer").play("idle")
owner.get_node(^"AnimationPlayer").play("idle")
func _on_Sword_attack_finished():

View File

@@ -1,11 +1,10 @@
extends "res://state_machine/state.gd"
# The stagger state end with the stagger animation from the AnimationPlayer.
# The animation only affects the Body Sprite's modulate property so it
# The animation only affects the Body Sprite2D's modulate property so it
# could stack with other animations if we had two AnimationPlayer nodes.
func enter():
owner.get_node("AnimationPlayer").play("stagger")
owner.get_node(^"AnimationPlayer").play("stagger")
func _on_animation_finished(anim_name):

View File

@@ -2,13 +2,12 @@ extends Label
var start_position = Vector2()
func _ready():
start_position = rect_position
start_position = position
func _physics_process(_delta):
rect_position = $"../BodyPivot".position + start_position
position = $"../BodyPivot".position + start_position
func _on_StateMachine_state_changed(current_state):

View File

@@ -1,10 +1,9 @@
extends "res://state_machine/state.gd"
# Initialize the state. E.g. change the animation.
func enter():
owner.set_dead(true)
owner.get_node("AnimationPlayer").play("die")
owner.get_node(^"AnimationPlayer").play("die")
func _on_animation_finished(_anim_name):

View File

@@ -1,12 +1,12 @@
extends "../motion.gd"
export(float) var base_max_horizontal_speed = 400.0
@export var base_max_horizontal_speed: float = 400.0
export(float) var air_acceleration = 1000.0
export(float) var air_deceleration = 2000.0
export(float) var air_steering_power = 50.0
@export var air_acceleration: float = 1000.0
@export var air_deceleration: float = 2000.0
@export var air_steering_power: float = 50.0
export(float) var gravity = 1600.0
@export var gravity: float = 1600.0
var enter_velocity = Vector2()
@@ -17,7 +17,6 @@ var horizontal_velocity = Vector2()
var vertical_speed = 0.0
var height = 0.0
func initialize(speed, velocity):
horizontal_speed = speed
if speed > 0.0:
@@ -37,7 +36,7 @@ func enter():
horizontal_velocity = Vector2()
vertical_speed = 600.0
owner.get_node("AnimationPlayer").play("idle")
owner.get_node(^"AnimationPlayer").play("idle")
func update(delta):
@@ -61,7 +60,8 @@ func move_horizontally(delta, direction):
var steering_velocity = (target_velocity - horizontal_velocity).normalized() * air_steering_power
horizontal_velocity += steering_velocity
owner.move_and_slide(horizontal_velocity)
owner.velocity = horizontal_velocity
owner.move_and_slide()
func animate_jump_height(delta):
@@ -69,4 +69,4 @@ func animate_jump_height(delta):
height += vertical_speed * delta
height = max(0.0, height)
owner.get_node("BodyPivot").position.y = -height
owner.get_node(^"BodyPivot").position.y = -height

View File

@@ -1,7 +1,6 @@
extends "res://state_machine/state.gd"
# Collection of important methods to handle direction and animation.
func handle_input(event):
if event.is_action_pressed("simulate_damage"):
emit_signal("finished", "stagger")
@@ -9,8 +8,8 @@ func handle_input(event):
func get_input_direction():
var input_direction = Vector2(
Input.get_action_strength("move_right") - Input.get_action_strength("move_left"),
Input.get_action_strength("move_down") - Input.get_action_strength("move_up")
Input.get_axis(&"move_left", &"move_right"),
Input.get_axis(&"move_up", &"move_down")
)
return input_direction

View File

@@ -1,12 +1,11 @@
extends "on_ground.gd"
func enter():
owner.get_node("AnimationPlayer").play("idle")
owner.get_node(^"AnimationPlayer").play("idle")
func handle_input(event):
return .handle_input(event)
return super.handle_input(event)
func update(_delta):

View File

@@ -1,9 +1,7 @@
extends "on_ground.gd"
export(float) var max_walk_speed = 450.0
export(float) var max_run_speed = 700.0
@export var max_walk_speed: float = 450
@export var max_run_speed: float = 700
func enter():
speed = 0.0
@@ -11,16 +9,16 @@ func enter():
var input_direction = get_input_direction()
update_look_direction(input_direction)
owner.get_node("AnimationPlayer").play("walk")
owner.get_node(^"AnimationPlayer").play("walk")
func handle_input(event):
return .handle_input(event)
return super.handle_input(event)
func update(_delta):
var input_direction = get_input_direction()
if not input_direction:
if input_direction.is_zero_approx():
emit_signal("finished", "idle")
update_look_direction(input_direction)
@@ -37,8 +35,8 @@ func update(_delta):
func move(speed, direction):
velocity = direction.normalized() * speed
owner.move_and_slide(velocity, Vector2(), 5, 2)
if owner.get_slide_count() == 0:
owner.velocity = direction.normalized() * speed
owner.move_and_slide()
if owner.get_slide_collision_count() == 0:
return
return owner.get_slide_collision(0)

View File

@@ -4,8 +4,7 @@ extends "../motion.gd"
var speed = 0.0
var velocity = Vector2()
func handle_input(event):
if event.is_action_pressed("jump"):
emit_signal("finished", "jump")
return .handle_input(event)
return super.handle_input(event)

View File

@@ -1,223 +1,232 @@
[gd_scene load_steps=8 format=2]
[gd_scene load_steps=9 format=3 uid="uid://cdacdp11r3jua"]
[ext_resource path="res://player/weapon/sword.gd" type="Script" id=1]
[ext_resource path="res://player/weapon/sword.png" type="Texture" id=2]
[ext_resource type="Script" path="res://player/weapon/sword.gd" id="1"]
[ext_resource type="Texture2D" uid="uid://7cfjw83v5m75" path="res://player/weapon/sword.png" id="2"]
[sub_resource type="Animation" id=1]
[sub_resource type="Animation" id="1"]
resource_name = "SETUP"
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:rotation_degrees")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [ 0.0 ]
"values": [0.0]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath(".:scale")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [ Vector2( 1, 1 ) ]
"values": [Vector2(1, 1)]
}
tracks/2/type = "value"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath(".:visible")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [ true ]
"values": [true]
}
tracks/3/type = "value"
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/path = NodePath(".:monitoring")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [ true ]
"values": [true]
}
tracks/4/type = "value"
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/path = NodePath(".:monitorable")
tracks/4/interp = 1
tracks/4/loop_wrap = true
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [ false ]
"values": [false]
}
[sub_resource type="Animation" id=2]
[sub_resource type="Animation" id="2"]
resource_name = "attack_circular"
length = 0.3
step = 0.05
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:rotation_degrees")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 0.15, 0.2 ),
"transitions": PoolRealArray( 0.439427, 1, 1 ),
"times": PackedFloat32Array(0, 0.15, 0.2),
"transitions": PackedFloat32Array(0.439427, 1, 1),
"update": 0,
"values": [ -100.0, 100.0, 90.0 ]
"values": [-100.0, 100.0, 90.0]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath(".:scale")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/keys = {
"times": PoolRealArray( 0, 0.05, 0.15, 0.2 ),
"transitions": PoolRealArray( 1, 2.50795, 1, 1 ),
"times": PackedFloat32Array(0, 0.05, 0.15, 0.2),
"transitions": PackedFloat32Array(1, 2.50795, 1, 1),
"update": 0,
"values": [ Vector2( 1, 1 ), Vector2( 1, 1.3 ), Vector2( 1, 1 ), Vector2( 1, 1 ) ]
"values": [Vector2(1, 1), Vector2(1, 1.3), Vector2(1, 1), Vector2(1, 1)]
}
tracks/2/type = "value"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath(".:visible")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [ true ]
"values": [true]
}
[sub_resource type="Animation" id=3]
[sub_resource type="Animation" id="3"]
length = 0.45
step = 0.05
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:rotation_degrees")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 0.15, 0.2 ),
"transitions": PoolRealArray( 0.439427, 1, 1 ),
"times": PackedFloat32Array(0, 0.15, 0.2),
"transitions": PackedFloat32Array(0.439427, 1, 1),
"update": 0,
"values": [ -80.0, 85.0, 75.0 ]
"values": [-80.0, 85.0, 75.0]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath(".:scale")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/keys = {
"times": PoolRealArray( 0, 0.05, 0.15, 0.2 ),
"transitions": PoolRealArray( 1, 2.50795, 1, 1 ),
"times": PackedFloat32Array(0, 0.05, 0.15, 0.2),
"transitions": PackedFloat32Array(1, 2.50795, 1, 1),
"update": 0,
"values": [ Vector2( 1, 1 ), Vector2( 1, 1.3 ), Vector2( 1, 1 ), Vector2( 1, 1 ) ]
"values": [Vector2(1, 1), Vector2(1, 1.3), Vector2(1, 1), Vector2(1, 1)]
}
tracks/2/type = "value"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath(".:visible")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [ true ]
"values": [true]
}
tracks/3/type = "method"
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/path = NodePath(".")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/keys = {
"times": PoolRealArray( 0.1, 0.25 ),
"transitions": PoolRealArray( 1, 1 ),
"values": [ {
"args": [ ],
"method": "set_attack_input_listening"
"times": PackedFloat32Array(0.1, 0.25),
"transitions": PackedFloat32Array(1, 1),
"values": [{
"args": [],
"method": &"set_attack_input_listening"
}, {
"args": [ ],
"method": "set_ready_for_next_attack"
} ]
"args": [],
"method": &"set_ready_for_next_attack"
}]
}
[sub_resource type="Animation" id=4]
[sub_resource type="Animation" id="4"]
resource_name = "attack_medium"
length = 0.5
step = 0.05
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:rotation_degrees")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0.05, 0.25, 0.35 ),
"transitions": PoolRealArray( 0.439427, 1, 1 ),
"times": PackedFloat32Array(0.05, 0.25, 0.35),
"transitions": PackedFloat32Array(0.439427, 1, 1),
"update": 0,
"values": [ 95.0, -95.0, -90.0 ]
"values": [95.0, -95.0, -90.0]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath(".:scale")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/keys = {
"times": PoolRealArray( 0, 0.1, 0.2, 0.25 ),
"transitions": PoolRealArray( 1, 2.50795, 1, 1 ),
"times": PackedFloat32Array(0, 0.1, 0.2, 0.25),
"transitions": PackedFloat32Array(1, 2.50795, 1, 1),
"update": 0,
"values": [ Vector2( 1, 1 ), Vector2( 1, 1.3 ), Vector2( 1, 1 ), Vector2( 1, 1 ) ]
"values": [Vector2(1, 1), Vector2(1, 1.3), Vector2(1, 1), Vector2(1, 1)]
}
tracks/2/type = "value"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath(".:visible")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [ true ]
"values": [true]
}
[sub_resource type="Animation" id=5]
[sub_resource type="Animation" id="5"]
length = 0.01
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:visible")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [ false ]
"values": [false]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_6cp3i"]
_data = {
"SETUP": SubResource("1"),
"attack_circular": SubResource("2"),
"attack_fast": SubResource("3"),
"attack_medium": SubResource("4"),
"idle": SubResource("5")
}
[node name="Sword" type="Area2D"]
@@ -225,19 +234,17 @@ collision_layer = 16
collision_mask = 3
input_pickable = false
monitorable = false
script = ExtResource( 1 )
script = ExtResource("1")
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
anims/SETUP = SubResource( 1 )
anims/attack_circular = SubResource( 2 )
anims/attack_fast = SubResource( 3 )
anims/attack_medium = SubResource( 4 )
anims/idle = SubResource( 5 )
libraries = {
"": SubResource("AnimationLibrary_6cp3i")
}
[node name="Sword" type="Sprite" parent="."]
position = Vector2( 4, 0 )
texture = ExtResource( 2 )
offset = Vector2( 67, 0 )
[node name="Sword" type="Sprite2D" parent="."]
position = Vector2(4, 0)
texture = ExtResource("2")
offset = Vector2(67, 0)
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="."]
polygon = PoolVector2Array( 28.0001, -15.9999, 136, -15.9995, 160, 0, 136, 16.0005, 27.9999, 16.0001 )
polygon = PackedVector2Array(28.0001, -15.9999, 136, -15.9995, 160, 0, 136, 16.0005, 27.9999, 16.0001)

View File

@@ -30,12 +30,9 @@ var combo = [{
var hit_objects = []
func _ready():
# warning-ignore:return_value_discarded
$AnimationPlayer.connect("animation_finished", self, "_on_animation_finished")
# warning-ignore:return_value_discarded
self.connect("body_entered", self, "_on_body_entered")
$AnimationPlayer.animation_finished.connect(self._on_animation_finished)
body_entered.connect(self._on_body_entered)
_change_state(States.IDLE)
@@ -99,7 +96,7 @@ func _on_body_entered(body):
func _on_animation_finished(_name):
if not attack_current:
if attack_current.is_empty():
return
if attack_input_state == AttackInputStates.REGISTERED and combo_count < MAX_COMBO_COUNT:

View File

@@ -1,8 +1,9 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/sword.png-fc7f0084cdf333c826eda2b33f2ec3cc.stex"
type="CompressedTexture2D"
uid="uid://7cfjw83v5m75"
path="res://.godot/imported/sword.png-fc7f0084cdf333c826eda2b33f2ec3cc.ctex"
metadata={
"vram_texture": false
}
@@ -10,26 +11,24 @@ metadata={
[deps]
source_file="res://player/weapon/sword.png"
dest_files=[ "res://.import/sword.png-fc7f0084cdf333c826eda2b33f2ec3cc.stex" ]
dest_files=["res://.godot/imported/sword.png-fc7f0084cdf333c826eda2b33f2ec3cc.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/hdr_compression=1
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

View File

@@ -1,11 +1,9 @@
extends Position2D
extends Marker2D
var z_index_start = 0
func _ready():
#warning-ignore:return_value_discarded
owner.connect("direction_changed", self, "_on_Parent_direction_changed")
owner.direction_changed.connect(self._on_Parent_direction_changed)
z_index_start = z_index

View File

@@ -6,7 +6,7 @@
; [section] ; section goes between []
; param=value ; assign values to parameters
config_version=4
config_version=5
[application]
@@ -15,87 +15,87 @@ config/description="This example shows how to apply the State machine programmin
pattern in GDscript, including Hierarchical States, and a
pushdown automaton."
run/main_scene="res://Demo.tscn"
config/icon="res://icon.png"
config/features=PackedStringArray("4.0")
config/icon="res://icon.webp"
config/tags=PackedStringArray("2d", "ai", "demo", "official")
[display]
window/size/width=1280
window/size/height=720
window/dpi/allow_hidpi=true
window/stretch/mode="2d"
window/size/viewport_width=1280
window/size/viewport_height=720
window/stretch/mode="canvas_items"
window/stretch/aspect="expand"
[gdnative]
singletons=[ ]
[input]
move_left={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777231,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":65,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
"events": [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":-1,"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":113,"echo":false,"script":null)
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":0,"axis_value":-1.0,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":14,"pressure":0.0,"pressed":false,"script":null)
]
]
}
move_up={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777232,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":87,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
"events": [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":4194320,"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":87,"key_label":0,"unicode":122,"echo":false,"script":null)
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":1,"axis_value":-1.0,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":12,"pressure":0.0,"pressed":false,"script":null)
]
]
}
move_right={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777233,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":68,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
"events": [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":4194321,"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":68,"key_label":0,"unicode":100,"echo":false,"script":null)
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":0,"axis_value":1.0,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":15,"pressure":0.0,"pressed":false,"script":null)
]
]
}
move_down={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777234,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":83,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
"events": [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":4194322,"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":83,"key_label":0,"unicode":115,"echo":false,"script":null)
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":1,"axis_value":1.0,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":13,"pressure":0.0,"pressed":false,"script":null)
]
]
}
fire={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":82,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
"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":82,"physical_keycode":0,"key_label":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":7,"pressure":0.0,"pressed":false,"script":null)
]
]
}
run={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777237,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
"events": [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":4194325,"physical_keycode":0,"key_label":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":1,"pressure":0.0,"pressed":false,"script":null)
]
]
}
jump={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":32,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
"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":32,"physical_keycode":0,"key_label":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":0,"pressure":0.0,"pressed":false,"script":null)
]
]
}
simulate_damage={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":88,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
"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":88,"physical_keycode":0,"key_label":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":3,"pressure":0.0,"pressed":false,"script":null)
]
]
}
attack={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":70,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":6,"pressure":0.0,"pressed":false,"script":null)
]
"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":70,"physical_keycode":0,"key_label":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":2,"pressure":0.0,"pressed":true,"script":null)
]
}
[physics]
common/physics_ticks_per_second=120
[rendering]
quality/driver/driver_name="GLES2"
vram_compression/import_etc=true
vram_compression/import_etc2=false
renderer/rendering_method="gl_compatibility"
renderer/rendering_method.mobile="gl_compatibility"

View File

@@ -6,7 +6,6 @@ extends Node
# warning-ignore:unused_signal
signal finished(next_state_name)
# Initialize the state. E.g. change the animation.
func enter():
pass

View File

@@ -10,33 +10,34 @@ signal state_changed(current_state)
# You should set a starting node from the inspector or on the node that inherits
# from this state machine interface. If you don't, the game will default to
# the first state in the state machine's children.
export(NodePath) var start_state
@export var start_state: NodePath
var states_map = {}
var states_stack = []
var current_state = null
var _active = false setget set_active
var _active = false:
set(value):
_active = value
set_active(value)
func _ready():
if not start_state:
func _enter_tree():
if start_state.is_empty():
start_state = get_child(0).get_path()
for child in get_children():
var err = child.connect("finished", self, "_change_state")
var err = child.finished.connect(self._change_state)
if err:
printerr(err)
initialize(start_state)
func initialize(initial_state):
set_active(true)
_active = true
states_stack.push_front(get_node(initial_state))
current_state = states_stack[0]
current_state.enter()
func set_active(value):
_active = value
set_physics_process(value)
set_process_input(value)
if not _active:

Binary file not shown.

Before

Width:  |  Height:  |  Size: 474 B

View File

@@ -1,35 +0,0 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://icon.png"
dest_files=[ "res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

View File

@@ -1,221 +0,0 @@
[gd_scene load_steps=5 format=2]
[ext_resource path="res://paint_control.gd" type="Script" id=1]
[ext_resource path="res://tools_panel.gd" type="Script" id=2]
[ext_resource path="res://paint_tools.png" type="Texture" id=3]
[sub_resource type="StyleBoxFlat" id=1]
bg_color = Color( 1, 1, 1, 1 )
[node name="PaintRoot" type="Control"]
margin_right = 40.0
margin_bottom = 40.0
__meta__ = {
"_edit_use_anchors_": false
}
[node name="DrawingAreaBG" type="Panel" parent="."]
margin_left = 350.0
margin_right = 1280.0
margin_bottom = 720.0
custom_styles/panel = SubResource( 1 )
[node name="PaintControl" type="Control" parent="."]
margin_right = 40.0
margin_bottom = 40.0
script = ExtResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="TLPos" type="Position2D" parent="PaintControl"]
position = Vector2( 350, 0 )
[node name="ToolsPanel" type="Panel" parent="."]
margin_right = 350.0
margin_bottom = 720.0
script = ExtResource( 2 )
[node name="LabelTools" type="Label" parent="ToolsPanel"]
margin_left = 20.0
margin_top = 10.0
margin_right = 330.0
margin_bottom = 24.0
text = "Selected tool: Pencil"
align = 1
[node name="ButtonToolPencil" type="Button" parent="ToolsPanel"]
margin_left = 40.0
margin_top = 40.0
margin_right = 100.0
margin_bottom = 100.0
[node name="Sprite" type="Sprite" parent="ToolsPanel/ButtonToolPencil"]
position = Vector2( 30, 30 )
scale = Vector2( 2.5, 2.5 )
texture = ExtResource( 3 )
region_enabled = true
region_rect = Rect2( 0, 0, 16, 16 )
[node name="ButtonToolEraser" type="Button" parent="ToolsPanel"]
margin_left = 110.0
margin_top = 40.0
margin_right = 170.0
margin_bottom = 100.0
[node name="Sprite" type="Sprite" parent="ToolsPanel/ButtonToolEraser"]
position = Vector2( 30, 30 )
scale = Vector2( 2.5, 2.5 )
texture = ExtResource( 3 )
region_enabled = true
region_rect = Rect2( 16, 0, 16, 16 )
[node name="ButtonToolRectangle" type="Button" parent="ToolsPanel"]
margin_left = 180.0
margin_top = 40.0
margin_right = 240.0
margin_bottom = 100.0
[node name="Sprite" type="Sprite" parent="ToolsPanel/ButtonToolRectangle"]
position = Vector2( 30, 30 )
scale = Vector2( 2.5, 2.5 )
texture = ExtResource( 3 )
region_enabled = true
region_rect = Rect2( 0, 16, 16, 16 )
[node name="ButtonToolCircle" type="Button" parent="ToolsPanel"]
margin_left = 250.0
margin_top = 40.0
margin_right = 310.0
margin_bottom = 100.0
[node name="Sprite" type="Sprite" parent="ToolsPanel/ButtonToolCircle"]
position = Vector2( 30, 30 )
scale = Vector2( 2.5, 2.5 )
texture = ExtResource( 3 )
region_enabled = true
region_rect = Rect2( 16, 16, 16, 16 )
[node name="LabelBrushColor" type="Label" parent="ToolsPanel"]
margin_left = 20.0
margin_top = 120.0
margin_right = 330.0
margin_bottom = 134.0
text = "Current color"
align = 1
[node name="ColorPickerBrush" type="ColorPickerButton" parent="ToolsPanel"]
margin_left = 20.0
margin_top = 140.0
margin_right = 330.0
margin_bottom = 190.0
[node name="BrushSettings" type="Control" parent="ToolsPanel"]
margin_top = 200.0
margin_right = 350.0
margin_bottom = 375.0
[node name="LabelBrushSize" type="Label" parent="ToolsPanel/BrushSettings"]
margin_left = 20.0
margin_top = 10.0
margin_right = 330.0
margin_bottom = 24.0
text = "Brush size: 32px"
align = 1
[node name="HScrollBarBrushSize" type="HScrollBar" parent="ToolsPanel/BrushSettings"]
margin_left = 20.0
margin_top = 30.0
margin_right = 330.0
margin_bottom = 60.0
min_value = 2.0
step = 1.0
value = 32.0
[node name="LabelBrushShape" type="Label" parent="ToolsPanel/BrushSettings"]
margin_left = 20.0
margin_top = 80.0
margin_right = 330.0
margin_bottom = 94.0
text = "Brush shape: Circle"
align = 1
[node name="ButtonShapeBox" type="Button" parent="ToolsPanel/BrushSettings"]
margin_left = 100.0
margin_top = 100.0
margin_right = 160.0
margin_bottom = 160.0
[node name="Sprite" type="Sprite" parent="ToolsPanel/BrushSettings/ButtonShapeBox"]
position = Vector2( 30, 30 )
scale = Vector2( 2.5, 2.5 )
texture = ExtResource( 3 )
region_enabled = true
region_rect = Rect2( 0, 16, 16, 16 )
[node name="ButtonShapeCircle" type="Button" parent="ToolsPanel/BrushSettings"]
margin_left = 190.0
margin_top = 100.0
margin_right = 250.0
margin_bottom = 160.0
[node name="Sprite" type="Sprite" parent="ToolsPanel/BrushSettings/ButtonShapeCircle"]
position = Vector2( 30, 30 )
scale = Vector2( 2.5, 2.5 )
texture = ExtResource( 3 )
region_enabled = true
region_rect = Rect2( 16, 16, 16, 16 )
[node name="LabelBackgroundColor" type="Label" parent="ToolsPanel"]
margin_left = 20.0
margin_top = 400.0
margin_right = 330.0
margin_bottom = 414.0
text = "Background color"
align = 1
[node name="ColorPickerBackground" type="ColorPickerButton" parent="ToolsPanel"]
margin_left = 20.0
margin_top = 420.0
margin_right = 330.0
margin_bottom = 470.0
color = Color( 1, 1, 1, 1 )
edit_alpha = false
[node name="LabelStats" type="Label" parent="ToolsPanel"]
modulate = Color( 0.414062, 0.414062, 0.414062, 1 )
margin_left = 20.0
margin_top = 590.0
margin_right = 330.0
margin_bottom = 604.0
text = "Brush objects: 00000"
align = 1
[node name="ButtonUndo" type="Button" parent="ToolsPanel"]
margin_left = 10.0
margin_top = 520.0
margin_right = 340.0
margin_bottom = 560.0
text = "Undo last stroke"
[node name="ButtonSave" type="Button" parent="ToolsPanel"]
margin_left = 10.0
margin_top = 620.0
margin_right = 340.0
margin_bottom = 660.0
text = "Save picture"
[node name="ButtonClear" type="Button" parent="ToolsPanel"]
margin_left = 10.0
margin_top = 670.0
margin_right = 340.0
margin_bottom = 710.0
text = "Clear picture"
[node name="SaveFileDialog" type="FileDialog" parent="."]
margin_right = 600.0
margin_bottom = 400.0
rect_min_size = Vector2( 300, 105 )
resizable = true
access = 2
filters = PoolStringArray( "*.png" )

View File

@@ -1,35 +0,0 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/paint_tools.png-224b64b7ddb26189a369199f6d686b79.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://paint_tools.png"
dest_files=[ "res://.import/paint_tools.png-224b64b7ddb26189a369199f6d686b79.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

17
2d/glow/README.md Normal file
View File

@@ -0,0 +1,17 @@
# Glow for 2D
This showcases how to use glow in a 2D game via the WorldEnvironment node.
Slide the cave image left and right to observe the glow effect at work.
Language: GDScript
Renderer: Forward Plus
Check out this demo on the asset library: https://godotengine.org/asset-library/asset/110
## Screenshots
![Screenshot](screenshots/left.png)
![Screenshot](screenshots/right.png)

21
2d/glow/beach_cave.gd Normal file
View File

@@ -0,0 +1,21 @@
extends Node2D
const CAVE_LIMIT = 1000
var glow_map = preload("res://glow_map.webp")
@onready var cave = $Cave
func _unhandled_input(event):
if event is InputEventMouseMotion and event.button_mask > 0:
cave.position.x = clampf(cave.position.x + event.relative.x, -CAVE_LIMIT, 0)
if event.is_action_pressed("toggle_glow_map"):
if $WorldEnvironment.environment.glow_map:
$WorldEnvironment.environment.glow_map = null
# Restore glow intensity to its default value
$WorldEnvironment.environment.glow_intensity = 0.8
else:
$WorldEnvironment.environment.glow_map = glow_map
# Increase glow intensity to compensate for the glow map darkening parts of the glow.
$WorldEnvironment.environment.glow_intensity = 1.6

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