{"id":22042570,"url":"https://github.com/renanstn/godot-lab","last_synced_at":"2025-05-08T01:22:21.517Z","repository":{"id":119527725,"uuid":"187317061","full_name":"renanstn/godot-lab","owner":"renanstn","description":"This is my lab of studies, mechanics and scripts in Godot game engine.","archived":false,"fork":false,"pushed_at":"2024-06-09T18:09:02.000Z","size":37652,"stargazers_count":18,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-03-31T16:10:14.282Z","etag":null,"topics":["godot","godot-lab","godot-mechanics","godot-shader","parallax","platform-game"],"latest_commit_sha":null,"homepage":"","language":"GDScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/renanstn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-05-18T05:11:59.000Z","updated_at":"2025-03-27T20:47:44.000Z","dependencies_parsed_at":null,"dependency_job_id":"52141bbc-0fdc-4221-8d4a-45f5da843ee6","html_url":"https://github.com/renanstn/godot-lab","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/renanstn%2Fgodot-lab","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/renanstn%2Fgodot-lab/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/renanstn%2Fgodot-lab/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/renanstn%2Fgodot-lab/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/renanstn","download_url":"https://codeload.github.com/renanstn/godot-lab/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252979608,"owners_count":21835089,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["godot","godot-lab","godot-mechanics","godot-shader","parallax","platform-game"],"created_at":"2024-11-30T12:12:57.833Z","updated_at":"2025-05-08T01:22:21.498Z","avatar_url":"https://github.com/renanstn.png","language":"GDScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Godot Mechanics Lab\n\n[![Godot Engine](https://img.shields.io/badge/GODOT-%23FFFFFF.svg?style=flat\u0026logo=godot-engine)](https://godotengine.org/)\n[![Lint Markdown](https://github.com/renanstn/godot-lab/actions/workflows/markdown-lint.yaml/badge.svg)](https://github.com/renanstn/godot-lab/actions/workflows/markdown-lint.yaml)\n\nAll examples in this repo runs in Godot **v3.5.3**.\n\n# Description\n\nThis project contains a series of experiments, scripts and studies I've made in\nGodot through all this years.\n\nEvery [DemoScene](https://github.com/renanstn/godot-mechanics/tree/master/Mechanics%20Lab/DemoScenes)\nimplements one mechanic I've created, or a mechanic existing in another game\nthat I tried to replicate.\n\nI hope you can use my scripts as an example or as a base for your studies in\nthis amazing engine 😃\n\nEnjoy! 👾\n\n# Demo scenes\n\n## 001 - Parallax Background\n\n- No scripts required, you can make parallax effects in Godot only using the\n`ParallaxBackground` and `ParallaxLayer` nodes\n\n![Parallax background example](Images/ParallaxBackground.gif)\n![Parallax node example](Images/Parallax.png)\n\n## 002 - Look at Mouse Position\n\n- It's simple to make a Node always \"look\" at the mouse position, just use the\n`look_at()` function\n\n```gd\nfunc _process(delta):\n    look_at(get_global_mouse_position())\n```\n\n![Look at mouse example](Images/LookAtMouse.gif)\n\n## 003 - Create Tilesets\n\n- To create a tileset, create your Nodes in a separate scene, and convert the\nwhole scene in menu `Scene -\u003e Convert To -\u003e TileSet`\n\n![Scene tree tilemap](Images/SetupTileset.png)\n![Create tilemap example](Images/CreateTileset.gif)\n\n## 004 - Using Tilesets\n\n- To use a tilemap to create your levels, add a `Tilemap` Node in your scene,\nand load the tileset created in last step\n\n![Load your tileset](Images/LoadTileset.png)\n![Using a tilemap example](Images/UsingTileset.gif)\n\n## 005 - Basic Player\n\n- This is the most simple and basic 2D platform player you can have. He can\nwalk, he can jump, and have Idle, walking, and jumping animations. You can\ncheck the code [here](https://github.com/renanstn/godot-mechanics/blob/master/Mechanics%20Lab/Scripts/SimplePlayer.gd)\n\n![Basic player example](Images/BasicPlayer.gif)\n\n## 006 - Slow Motion Effect\n\n- In this example, I tried to simulate a slow motion effect, just changing\ngradativally the `time_scale` value of the engine. You can check the code\n[here](https://github.com/renanstn/godot-mechanics/blob/master/Mechanics%20Lab/Scripts/SlowMotionEffect.gd)\n\n![Slow motion effect example](Images/SlowMotionEffect.gif)\n\n## 007 - Arcade Car 3D\n\n- This example implements a 3D arcade race car mechanic. This technique uses a\nsphere to run all the physics, and visually replace the sphere for the car 3D\nmodel\n- This technique I've learned from [this](https://kidscancode.org/godot_recipes/3d/3d_sphere_car/)\namazing tutorial\n\n![Arcade car example](Images/CarSphere.gif)\n\n## 008 - Advanced Player\n\n- In this new character script, gravity is not a fixed value randomly chosen by\nyou. Instead, you set the blocks `UNIT_SIZE` of your tilemap, and all values\nwill be calculated according to your blocks\n- This way, it's easier to control how high (in blocks) and how much distance\n(in blocks) your character can reach in a jump\n- Holding the \"jump\" button will make your character jump higher\n- This player also had a `Tween` node to make some cool animations when you're\njumping and when you're landing. You can configure how much the character will\n\"deform\" changing the \"squash\" value.\n- And [here's the code](https://github.com/renanstn/godot-mechanics/blob/master/Mechanics%20Lab/Scripts/AdvancedPlayer.gd)\n\n![Advanced player example](Images/AdvancedPlayer.gif)\n\n## 009 - Boomerang\n\n- A simple and smooth boomerang\n- Go towards mouse click coordinates\n- Always return to the player\n- [Code here](https://github.com/renanstn/godot-mechanics/blob/master/Mechanics%20Lab/Scripts/Boomerang.gd)\n\n**Tips and tricks**\n\n- To get the direction (`Vector2`) between 2 positions (`Vector2`)\n\n```gd\nvar direction = (target - start_position).normalized()\n```\n\n- To move your object towards this direction\n\n```gd\nposition += direction.rotated(rotation) * speed * delta\n```\n\n- To calc the distance between 2 positions\n\n```gd\nvar distance_to_target = position.distance_to(target)\n```\n\n![Boomerang example](Images/Boomerang.gif)\n\n## 010 - The Messenger Jump\n\n- In this demo, I tried to reproduce the \"3 steps jump animation\" used in\n[The Messenger](https://themessengergame.com/)\n- This jump uses 3 animations, one when the character is upping, one when he's\non top, and another when he's falling.\n- I made this script to obtain this result\n\n```gd\n\nfunc animate():\n    if !is_on_floor():\n        if abs(motion.y) \u003e JUMP / 2:\n            if motion.y \u003c 0:\n                animator.play(\"Jump_up\")\n            else:\n                animator.play(\"Jump_down\")\n        else:\n            animator.play(\"Jump_roll\")\n```\n\n![The Messenger jump example](Images/TheMessenger.gif)\n\n## 011 - Rolling Ball\n\n- With\n[this simple script](https://github.com/renanstn/godot-mechanics/blob/master/Mechanics%20Lab/Scripts/RollingBall.gd)\nyou can control a rolling ball through a 2D scenario\n- You can roll to the left, right, and you can jump\n\n![Rolling ball example](Images/RollingBall.gif)\n\n## 012 - Full screen Shader\n\n- This is a simple example of a shader covering the whole screen\n- How I make:\n  - Add a `TextureRect` node\n  - Add a simple\n  [white image](https://github.com/renanstn/godot-mechanics/blob/master/Mechanics%20Lab/Sprites/white.png)\n  as a texture to your `TextureRect` node\n  - Check the `expand` option\n  - Adjust the `rect` size to fill your whole window (you can check your window\n  size in `Project → Project settings → Window`)\n  - In `Material` section, add a `ShaderMaterial`\n  - Load your shader\n- For this example, I used [this](https://github.com/renanstn/godot-mechanics/blob/master/Mechanics%20Lab/Shaders/ScreenGlitch.shader)\nscreen glitch shader\n- You can find some amazing shaders ready to use in your game in [Godot Shaders](https://godotshaders.com/)\nwebsite, or in [Shadertoy](https://www.shadertoy.com/)  (but shaders from\nShadertoy need to be [converted](https://docs.godotengine.org/en/stable/tutorials/shading/migrating_to_godot_shader_language.html?highlight=shadertoy#shadertoy))\n\n![Full screen shader example](Images/FullScreenShader.gif)\n\n## 013 - Olija Spear\n\n- In this example, I tried to reproduce the [Olija](https://olija.com/) spear\neffect\n- You can throw your spear in any direction using the `Mouse Left`\n- The spear sticks to any physic body it hits\n- If you press `R`, you pick you spear back\n- If you press `Mouse Right`, your character teleports to spear position\n- You can check how I made this effect [here](https://github.com/renanstn/godot-mechanics/blob/master/Mechanics%20Lab/Scripts/SpearLauncher.gd)\n\n![Olija spear example](Images/OlijaSpear.gif)\n\n## 014 - Raycast Weapon\n\n- A 2D raycast weapon, with some nice bullet trail, animation hit, and\ncartridge ejection effects\n- Shoots in mouse direction\n- Automatic and semi automatic modes\n- Emit signals when it shoot, reload, hit, etc\n- Shoot, reload, and empty bullets sounds\n- Adjustable `damage`, `spread rate`, `recoil time`, `bullets` and `reload time`\n- Script [here](https://github.com/renanstn/godot-mechanics/blob/master/Mechanics%20Lab/Scripts/RaycastWeapon.gd)\n\n![Raycast weapon example](Images/RaycastWeapon.gif)\n\n# Assets\n\n- [Kenney](https://www.kenney.nl/assets/simplified-platformer-pack)\n- [The Spriters Resource](https://www.spriters-resource.com/)\n- [Sound Bible](http://soundbible.com/)\n- [Screen Glitch Shader](https://github.com/ashima/webgl-noise)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frenanstn%2Fgodot-lab","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frenanstn%2Fgodot-lab","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frenanstn%2Fgodot-lab/lists"}