├── .github
└── assets
│ └── main_banner.png
├── AdvancedMovement
├── .editorconfig
├── .gitignore
├── README.md
├── assets
│ ├── 1024.png
│ ├── 1024.png.import
│ ├── BG256.png
│ ├── BG256.png.import
│ ├── CapsulePlayer.png
│ ├── CapsulePlayer.png.import
│ ├── GridTiles.png
│ └── GridTiles.png.import
├── default_env.tres
├── icon.png
├── icon.png.import
├── project.godot
└── scenes
│ ├── advanced_movement.tscn
│ ├── advanced_player.gd
│ └── water_area.gd
├── DungeonCrawlerMovement
├── .editorconfig
├── .gitignore
├── README.md
├── addons
│ └── level_block
│ │ ├── CHANGELOG.md
│ │ ├── LICENSE
│ │ ├── README.md
│ │ ├── clear.svg
│ │ ├── clear.svg.import
│ │ ├── default_material.tres
│ │ ├── icon.svg
│ │ ├── icon.svg.import
│ │ ├── level_block.gd
│ │ ├── level_block_gizmo.gd
│ │ ├── level_block_inspector.gd
│ │ ├── level_block_node.gd
│ │ ├── plugin.cfg
│ │ ├── texture_selector.gd
│ │ └── texture_selector_scene.tscn
├── assets
│ ├── tileset.png
│ └── tileset.png.import
├── default_env.tres
├── icon.png
├── icon.png.import
├── project.godot
└── scenes
│ ├── entity
│ └── player
│ │ ├── player.gd
│ │ └── player.tscn
│ └── level.tscn
├── FPSInGodot4
├── .gitattributes
├── .gitignore
├── README.md
├── assets
│ ├── 1024.png
│ ├── 1024.png.import
│ ├── Heebo-Medium.ttf
│ └── Heebo-Medium.ttf.import
├── icon.svg
├── icon.svg.import
├── project.godot
└── scenes
│ ├── entity
│ ├── effect
│ │ └── explosion
│ │ │ ├── assets
│ │ │ ├── particles_fire.png
│ │ │ └── particles_fire.png.import
│ │ │ └── explosion.tscn
│ ├── enemy
│ │ ├── bullet
│ │ │ ├── capsule
│ │ │ │ └── capsule_enemy_bullet.tscn
│ │ │ ├── enemy_bullet.gd
│ │ │ └── enemy_bullet.tscn
│ │ ├── capsule
│ │ │ ├── assets
│ │ │ │ ├── capsule_enemy.glb
│ │ │ │ ├── capsule_enemy.glb.import
│ │ │ │ ├── capsule_enemy_albedo.png
│ │ │ │ ├── capsule_enemy_albedo.png.import
│ │ │ │ ├── capsule_enemy_emission.png
│ │ │ │ ├── capsule_enemy_emission.png.import
│ │ │ │ ├── capsule_enemy_material.tres
│ │ │ │ ├── capsule_enemy_mr.png
│ │ │ │ ├── capsule_enemy_mr.png.import
│ │ │ │ ├── capsule_enemy_normal.png
│ │ │ │ ├── capsule_enemy_normal.png.import
│ │ │ │ ├── capsule_enemy_occlusion.png
│ │ │ │ └── capsule_enemy_occlusion.png.import
│ │ │ ├── capsule_dead.tscn
│ │ │ ├── capsule_enemy.gd
│ │ │ ├── capsule_enemy.tscn
│ │ │ └── capsule_enemy_model.tscn
│ │ ├── effects
│ │ │ ├── hit_sparks.gd
│ │ │ └── hit_sparks.tscn
│ │ ├── enemy.gd
│ │ └── enemy_base.tscn
│ ├── enemy_spawner
│ │ ├── enemy_spawner.gd
│ │ └── enemy_spawner.tscn
│ ├── pickup
│ │ ├── health
│ │ │ └── pickup_health.tscn
│ │ ├── pickup.gd
│ │ ├── pickup.tscn
│ │ ├── pistol
│ │ │ └── pickup_pistol.tscn
│ │ └── rifle
│ │ │ └── pickup_rifle.tscn
│ ├── pickup_spawner
│ │ ├── pickup_spawner.gd
│ │ └── pickup_spawner.tscn
│ └── player
│ │ ├── bullet
│ │ ├── assets
│ │ │ ├── bullet_hole_albedo.png
│ │ │ ├── bullet_hole_albedo.png.import
│ │ │ ├── bullet_hole_normal.png
│ │ │ ├── bullet_hole_normal.png.import
│ │ │ ├── bullet_hole_orm.png
│ │ │ └── bullet_hole_orm.png.import
│ │ ├── baton
│ │ │ ├── assets
│ │ │ │ ├── baton_hole_albedo.png
│ │ │ │ ├── baton_hole_albedo.png.import
│ │ │ │ ├── baton_hole_normal.png
│ │ │ │ ├── baton_hole_normal.png.import
│ │ │ │ ├── baton_hole_orm.png
│ │ │ │ └── baton_hole_orm.png.import
│ │ │ ├── baton_hole.tscn
│ │ │ └── bullet_baton.tscn
│ │ ├── bullet.gd
│ │ ├── bullet_base.tscn
│ │ ├── bullet_hole.gd
│ │ ├── bullet_hole.tscn
│ │ ├── pistol
│ │ │ ├── bullet_pistol.gd
│ │ │ └── bullet_pistol.tscn
│ │ └── rifle
│ │ │ └── bullet_rifle.tscn
│ │ ├── gun
│ │ ├── baton
│ │ │ ├── assets
│ │ │ │ ├── baton.glb
│ │ │ │ ├── baton.glb.import
│ │ │ │ ├── baton.tres
│ │ │ │ ├── baton_albedo.png
│ │ │ │ ├── baton_albedo.png.import
│ │ │ │ ├── baton_icon.png
│ │ │ │ ├── baton_icon.png.import
│ │ │ │ ├── baton_normal.png
│ │ │ │ ├── baton_normal.png.import
│ │ │ │ ├── baton_orm.png
│ │ │ │ └── baton_orm.png.import
│ │ │ ├── baton_model.tscn
│ │ │ └── gun_baton.tscn
│ │ ├── gun.gd
│ │ ├── gun_base.tscn
│ │ ├── pistol
│ │ │ ├── assets
│ │ │ │ ├── pistol.glb
│ │ │ │ ├── pistol.glb.import
│ │ │ │ ├── pistol_albedo.png
│ │ │ │ ├── pistol_albedo.png.import
│ │ │ │ ├── pistol_icon.png
│ │ │ │ ├── pistol_icon.png.import
│ │ │ │ ├── pistol_material.tres
│ │ │ │ ├── pistol_normal.png
│ │ │ │ ├── pistol_normal.png.import
│ │ │ │ ├── pistol_orm.png
│ │ │ │ └── pistol_orm.png.import
│ │ │ ├── gun_pistol.tscn
│ │ │ └── pistol_model.tscn
│ │ └── rifle
│ │ │ ├── assets
│ │ │ ├── rifle.glb
│ │ │ ├── rifle.glb.import
│ │ │ ├── rifle.tres
│ │ │ ├── rifle_albedo.png
│ │ │ ├── rifle_albedo.png.import
│ │ │ ├── rifle_icon.png
│ │ │ ├── rifle_icon.png.import
│ │ │ ├── rifle_normal.png
│ │ │ ├── rifle_normal.png.import
│ │ │ ├── rifle_orm.png
│ │ │ └── rifle_orm.png.import
│ │ │ ├── gun_rifle.tscn
│ │ │ └── rifle_model.tscn
│ │ ├── player.gd
│ │ ├── player.tscn
│ │ └── player_guns.gd
│ ├── game
│ ├── game.gd
│ ├── game.tscn
│ ├── hud
│ │ ├── assets
│ │ │ ├── bullet.svg
│ │ │ ├── bullet.svg.import
│ │ │ ├── crosshair.svg
│ │ │ └── crosshair.svg.import
│ │ ├── hud.gd
│ │ ├── hud.tscn
│ │ └── hud_theme.tres
│ └── level
│ │ ├── assets
│ │ ├── concrete.tres
│ │ ├── concrete_albedo.png
│ │ ├── concrete_albedo.png.import
│ │ ├── concrete_normal.png
│ │ ├── concrete_normal.png.import
│ │ ├── concrete_tiles.tres
│ │ ├── concrete_tiles_albedo.png
│ │ ├── concrete_tiles_albedo.png.import
│ │ ├── concrete_tiles_heightmap.png
│ │ ├── concrete_tiles_heightmap.png.import
│ │ ├── concrete_tiles_normal.png
│ │ ├── concrete_tiles_normal.png.import
│ │ ├── concrete_tiles_orm.png
│ │ ├── concrete_tiles_orm.png.import
│ │ ├── level.glb
│ │ ├── level.glb.import
│ │ ├── level.glb.unwrap_cache
│ │ ├── metal_grate.tres
│ │ ├── metal_grate_albedo.png
│ │ ├── metal_grate_albedo.png.import
│ │ ├── metal_grate_heightmap.png
│ │ ├── metal_grate_heightmap.png.import
│ │ ├── metal_grate_normal.png
│ │ ├── metal_grate_normal.png.import
│ │ ├── metal_grate_orm.png
│ │ ├── metal_grate_orm.png.import
│ │ ├── sky.exr
│ │ └── sky.exr.import
│ │ ├── level.tscn
│ │ └── level_geometry.tscn
│ └── main.tscn
├── LICENSE
├── LightDetection
├── .gitattributes
├── .gitignore
├── README.md
├── icon.svg
├── icon.svg.import
├── project.godot
└── scenes
│ ├── level
│ ├── assets
│ │ ├── brick_floor.tres
│ │ ├── brick_wall.tres
│ │ ├── metal.tres
│ │ ├── textures
│ │ │ ├── brick_floor_albedo.png
│ │ │ ├── brick_floor_albedo.png.import
│ │ │ ├── brick_floor_normal.png
│ │ │ ├── brick_floor_normal.png.import
│ │ │ ├── brick_floor_orm.png
│ │ │ ├── brick_floor_orm.png.import
│ │ │ ├── brick_wall_albedo.png
│ │ │ ├── brick_wall_albedo.png.import
│ │ │ ├── brick_wall_normal.png
│ │ │ ├── brick_wall_normal.png.import
│ │ │ ├── brick_wall_orm.png
│ │ │ ├── brick_wall_orm.png.import
│ │ │ ├── metal_albedo.png
│ │ │ ├── metal_albedo.png.import
│ │ │ ├── metal_normal.png
│ │ │ ├── metal_normal.png.import
│ │ │ ├── metal_orm.png
│ │ │ ├── metal_orm.png.import
│ │ │ ├── wood_albedo.png
│ │ │ ├── wood_albedo.png.import
│ │ │ ├── wood_normal.png
│ │ │ ├── wood_normal.png.import
│ │ │ ├── wood_orm.png
│ │ │ └── wood_orm.png.import
│ │ └── wood.tres
│ ├── entity
│ │ └── torch
│ │ │ ├── assets
│ │ │ ├── metal.tres
│ │ │ ├── particles_fire.png
│ │ │ ├── particles_fire.png.import
│ │ │ └── wood.tres
│ │ │ └── torch.tscn
│ └── level.tscn
│ └── player
│ ├── assets
│ ├── light_meter_ui.svg
│ └── light_meter_ui.svg.import
│ ├── player.gd
│ └── player.tscn
├── README.md
├── SmoothMovement
├── .editorconfig
├── .gitignore
├── README.md
├── assets
│ ├── 1024.png
│ ├── 1024.png.import
│ ├── BG256.png
│ ├── BG256.png.import
│ ├── CapsulePlayer.png
│ ├── CapsulePlayer.png.import
│ ├── GridTiles.png
│ └── GridTiles.png.import
├── default_env.tres
├── icon.png
├── icon.png.import
├── project.godot
└── scenes
│ ├── player2D.gd
│ ├── player3D.gd
│ ├── smooth2D.tscn
│ └── smooth3D.tscn
└── TriggersInteraction
├── .editorconfig
├── .gitignore
├── README.md
├── assets
├── 1024.png
├── 1024.png.import
├── BG256.png
├── BG256.png.import
├── CapsulePlayer.png
├── CapsulePlayer.png.import
├── DSEG14Classic-Regular.ttf
├── GridTiles.png
└── GridTiles.png.import
├── default_env.tres
├── icon.png
├── icon.png.import
├── project.godot
└── scenes
├── entity
├── door
│ ├── door.gd
│ └── door.tscn
├── jump_pad
│ ├── jump_pad.gd
│ └── jump_pad.tscn
├── number_display
│ ├── number_display.gd
│ └── number_display.tscn
├── player
│ ├── advanced_player.gd
│ └── player.tscn
├── player_interaction
│ ├── player_interaction.gd
│ └── player_interaction.tscn
└── player_trigger
│ ├── player_trigger.gd
│ └── player_trigger.tscn
├── triggers_interaction.tscn
└── water_area.gd
/.github/assets/main_banner.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ReunMedia/gamedev-compass/4ace5b363ad175a37bf8ab0e5d38afd1b20a96c5/.github/assets/main_banner.png
--------------------------------------------------------------------------------
/AdvancedMovement/.editorconfig:
--------------------------------------------------------------------------------
1 | #
2 | # Godot Game project EditorConfig
3 | #
4 | # @version 1.0.0
5 | #
6 |
7 | root = true
8 |
9 | [*]
10 | charset = utf-8
11 | end_of_line = lf
12 | indent_size = 2
13 | indent_style = space
14 | insert_final_newline = true
15 | trim_trailing_whitespace = true
16 |
17 | [*.md]
18 | trim_trailing_whitespace = false
19 |
20 | [*.gd]
21 | indent_style = tab
22 | indent_size = 4
23 | insert_final_newline = false
24 | trim_trailing_whitespace = false
25 |
26 | [*.cs]
27 | indent_size = 4
28 |
--------------------------------------------------------------------------------
/AdvancedMovement/.gitignore:
--------------------------------------------------------------------------------
1 | ##########################
2 | # Generic project ignore #
3 | ##########################
4 | # Prefix your personal development files and directories with `_`
5 | /_*
6 | /.vscode/
7 | /*.log
8 | **/_temp/**
9 |
10 | #################
11 | # Godot ignores #
12 | #################
13 | # Based on https://github.com/github/gitignore/blob/master/Godot.gitignore
14 | # Godot-specific ignores
15 | .import/
16 | export.cfg
17 | export_presets.cfg
18 |
19 | # Imported translations (automatically generated from CSV files)
20 | *.translation
21 |
22 | # Mono-specific ignores
23 | .mono/
24 | data_*/
25 |
--------------------------------------------------------------------------------
/AdvancedMovement/README.md:
--------------------------------------------------------------------------------
1 | # Advanced Movement Features – Godot 3.5 Tutorial
2 |
3 |
4 |
5 | 
6 | Watch on YouTube
7 |
8 |
9 |
10 | Learn some advanced features you can add to your player movement. Uses the Smooth Player Movement tutorial as a starting point.
11 | The examples here are with 3D player movement, but the scripts should work fine for 2D too.
12 |
13 | Published on 2022-11-25.
14 |
15 | # Relevant files
16 | [advanced_player.gd](./scenes/advanced_player.gd)
17 |
18 | [water_area.gd](./scenes/water_area.gd)
19 |
--------------------------------------------------------------------------------
/AdvancedMovement/assets/1024.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ReunMedia/gamedev-compass/4ace5b363ad175a37bf8ab0e5d38afd1b20a96c5/AdvancedMovement/assets/1024.png
--------------------------------------------------------------------------------
/AdvancedMovement/assets/1024.png.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="StreamTexture"
5 | path="res://.import/1024.png-140204064dfbfbcc03390b538035b994.stex"
6 | metadata={
7 | "vram_texture": false
8 | }
9 |
10 | [deps]
11 |
12 | source_file="res://assets/1024.png"
13 | dest_files=[ "res://.import/1024.png-140204064dfbfbcc03390b538035b994.stex" ]
14 |
15 | [params]
16 |
17 | compress/mode=0
18 | compress/lossy_quality=0.7
19 | compress/hdr_mode=0
20 | compress/bptc_ldr=0
21 | compress/normal_map=0
22 | flags/repeat=1
23 | flags/filter=true
24 | flags/mipmaps=true
25 | flags/anisotropic=true
26 | flags/srgb=1
27 | process/fix_alpha_border=false
28 | process/premult_alpha=false
29 | process/HDR_as_SRGB=false
30 | process/invert_color=false
31 | process/normal_map_invert_y=false
32 | stream=false
33 | size_limit=0
34 | detect_3d=false
35 | svg/scale=1.0
36 |
--------------------------------------------------------------------------------
/AdvancedMovement/assets/BG256.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ReunMedia/gamedev-compass/4ace5b363ad175a37bf8ab0e5d38afd1b20a96c5/AdvancedMovement/assets/BG256.png
--------------------------------------------------------------------------------
/AdvancedMovement/assets/BG256.png.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="StreamTexture"
5 | path.s3tc="res://.import/BG256.png-e407760fdcdf3a122cd0f1764b3c72a1.s3tc.stex"
6 | path.etc2="res://.import/BG256.png-e407760fdcdf3a122cd0f1764b3c72a1.etc2.stex"
7 | metadata={
8 | "imported_formats": [ "s3tc", "etc2" ],
9 | "vram_texture": true
10 | }
11 |
12 | [deps]
13 |
14 | source_file="res://assets/BG256.png"
15 | dest_files=[ "res://.import/BG256.png-e407760fdcdf3a122cd0f1764b3c72a1.s3tc.stex", "res://.import/BG256.png-e407760fdcdf3a122cd0f1764b3c72a1.etc2.stex" ]
16 |
17 | [params]
18 |
19 | compress/mode=2
20 | compress/lossy_quality=0.7
21 | compress/hdr_mode=0
22 | compress/bptc_ldr=0
23 | compress/normal_map=0
24 | flags/repeat=true
25 | flags/filter=true
26 | flags/mipmaps=true
27 | flags/anisotropic=false
28 | flags/srgb=1
29 | process/fix_alpha_border=true
30 | process/premult_alpha=false
31 | process/HDR_as_SRGB=false
32 | process/invert_color=false
33 | process/normal_map_invert_y=false
34 | stream=false
35 | size_limit=0
36 | detect_3d=false
37 | svg/scale=1.0
38 |
--------------------------------------------------------------------------------
/AdvancedMovement/assets/CapsulePlayer.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ReunMedia/gamedev-compass/4ace5b363ad175a37bf8ab0e5d38afd1b20a96c5/AdvancedMovement/assets/CapsulePlayer.png
--------------------------------------------------------------------------------
/AdvancedMovement/assets/CapsulePlayer.png.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="StreamTexture"
5 | path="res://.import/CapsulePlayer.png-8135285809a85ba4b493b4877a17e0f4.stex"
6 | metadata={
7 | "vram_texture": false
8 | }
9 |
10 | [deps]
11 |
12 | source_file="res://assets/CapsulePlayer.png"
13 | dest_files=[ "res://.import/CapsulePlayer.png-8135285809a85ba4b493b4877a17e0f4.stex" ]
14 |
15 | [params]
16 |
17 | compress/mode=0
18 | compress/lossy_quality=0.7
19 | compress/hdr_mode=0
20 | compress/bptc_ldr=0
21 | compress/normal_map=0
22 | flags/repeat=0
23 | flags/filter=true
24 | flags/mipmaps=false
25 | flags/anisotropic=false
26 | flags/srgb=2
27 | process/fix_alpha_border=true
28 | process/premult_alpha=false
29 | process/HDR_as_SRGB=false
30 | process/invert_color=false
31 | process/normal_map_invert_y=false
32 | stream=false
33 | size_limit=0
34 | detect_3d=true
35 | svg/scale=1.0
36 |
--------------------------------------------------------------------------------
/AdvancedMovement/assets/GridTiles.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ReunMedia/gamedev-compass/4ace5b363ad175a37bf8ab0e5d38afd1b20a96c5/AdvancedMovement/assets/GridTiles.png
--------------------------------------------------------------------------------
/AdvancedMovement/assets/GridTiles.png.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="StreamTexture"
5 | path="res://.import/GridTiles.png-6c74ae07696adbabb60e64254b661f82.stex"
6 | metadata={
7 | "vram_texture": false
8 | }
9 |
10 | [deps]
11 |
12 | source_file="res://assets/GridTiles.png"
13 | dest_files=[ "res://.import/GridTiles.png-6c74ae07696adbabb60e64254b661f82.stex" ]
14 |
15 | [params]
16 |
17 | compress/mode=0
18 | compress/lossy_quality=0.7
19 | compress/hdr_mode=0
20 | compress/bptc_ldr=0
21 | compress/normal_map=0
22 | flags/repeat=0
23 | flags/filter=true
24 | flags/mipmaps=false
25 | flags/anisotropic=false
26 | flags/srgb=2
27 | process/fix_alpha_border=true
28 | process/premult_alpha=false
29 | process/HDR_as_SRGB=false
30 | process/invert_color=false
31 | process/normal_map_invert_y=false
32 | stream=false
33 | size_limit=0
34 | detect_3d=false
35 | svg/scale=1.0
36 |
--------------------------------------------------------------------------------
/AdvancedMovement/default_env.tres:
--------------------------------------------------------------------------------
1 | [gd_resource type="Environment" load_steps=2 format=2]
2 |
3 | [sub_resource type="ProceduralSky" id=1]
4 |
5 | [resource]
6 | background_mode = 2
7 | background_sky = SubResource( 1 )
8 |
--------------------------------------------------------------------------------
/AdvancedMovement/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ReunMedia/gamedev-compass/4ace5b363ad175a37bf8ab0e5d38afd1b20a96c5/AdvancedMovement/icon.png
--------------------------------------------------------------------------------
/AdvancedMovement/icon.png.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="StreamTexture"
5 | path="res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex"
6 | metadata={
7 | "vram_texture": false
8 | }
9 |
10 | [deps]
11 |
12 | source_file="res://icon.png"
13 | dest_files=[ "res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex" ]
14 |
15 | [params]
16 |
17 | compress/mode=0
18 | compress/lossy_quality=0.7
19 | compress/hdr_mode=0
20 | compress/bptc_ldr=0
21 | compress/normal_map=0
22 | flags/repeat=0
23 | flags/filter=true
24 | flags/mipmaps=false
25 | flags/anisotropic=false
26 | flags/srgb=2
27 | process/fix_alpha_border=true
28 | process/premult_alpha=false
29 | process/HDR_as_SRGB=false
30 | process/invert_color=false
31 | process/normal_map_invert_y=false
32 | stream=false
33 | size_limit=0
34 | detect_3d=true
35 | svg/scale=1.0
36 |
--------------------------------------------------------------------------------
/AdvancedMovement/project.godot:
--------------------------------------------------------------------------------
1 | ; Engine configuration file.
2 | ; It's best edited using the editor UI and not directly,
3 | ; since the parameters that go here are not all obvious.
4 | ;
5 | ; Format:
6 | ; [section] ; section goes between []
7 | ; param=value ; assign values to parameters
8 |
9 | config_version=4
10 |
11 | [application]
12 |
13 | config/name="AdvancedMovement"
14 | run/main_scene="res://scenes/advanced_movement.tscn"
15 | config/icon="res://icon.png"
16 |
17 | [display]
18 |
19 | window/size/width=1920
20 | window/size/height=1080
21 |
22 | [gui]
23 |
24 | common/drop_mouse_on_gui_input_disabled=true
25 |
26 | [input]
27 |
28 | left={
29 | "deadzone": 0.5,
30 | "events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":65,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
31 | ]
32 | }
33 | right={
34 | "deadzone": 0.5,
35 | "events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":68,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
36 | ]
37 | }
38 | up={
39 | "deadzone": 0.5,
40 | "events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":87,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
41 | ]
42 | }
43 | down={
44 | "deadzone": 0.5,
45 | "events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":83,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
46 | ]
47 | }
48 | jump={
49 | "deadzone": 0.5,
50 | "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)
51 | ]
52 | }
53 | run={
54 | "deadzone": 0.5,
55 | "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)
56 | ]
57 | }
58 |
59 | [physics]
60 |
61 | common/physics_fps=165
62 | common/enable_pause_aware_picking=true
63 | common/physics_interpolation=true
64 |
65 | [rendering]
66 |
67 | quality/filters/anisotropic_filter_level=16
68 | gles3/shaders/shader_compilation_mode=1
69 | quality/filters/msaa=3
70 | quality/filters/use_debanding=true
71 | environment/default_environment="res://default_env.tres"
72 |
--------------------------------------------------------------------------------
/AdvancedMovement/scenes/advanced_player.gd:
--------------------------------------------------------------------------------
1 | extends KinematicBody
2 |
3 | export var speed := 7.0
4 | export var running_speed := 15.0
5 | export var gravity := -20.0
6 | export var jump_power := 15.0
7 | export var h_accel := 35.0
8 | export var v_accel := 35.0
9 | export var max_jumps := 2
10 | export var jump_delay := 0.2
11 | export var water_multiplier := 0.5
12 |
13 | var movement_vector := Vector3.ZERO
14 | var jump_amount := max_jumps
15 | var jump_timer := Timer.new()
16 | var in_water := false
17 |
18 | func _ready():
19 | add_child(jump_timer)
20 | jump_timer.one_shot = true
21 | jump_timer.connect("timeout", self, "jump_timer_timeout")
22 |
23 | func _physics_process(delta) -> void:
24 | var modifier := 1.0
25 | if in_water:
26 | modifier *= water_multiplier
27 | # Horizontal movement
28 | var horizontal_input := Vector3.ZERO
29 | horizontal_input.x = Input.get_axis("down", "up")
30 | horizontal_input.z = Input.get_axis("left", "right")
31 | horizontal_input = horizontal_input.limit_length(1.0)
32 | horizontal_input *= running_speed if Input.is_action_pressed("run") else speed
33 | horizontal_input.y = movement_vector.y
34 | movement_vector = movement_vector.move_toward(horizontal_input, h_accel * delta)
35 | # Vertical movement
36 | movement_vector.y = move_toward(movement_vector.y, gravity, v_accel * delta)
37 | if is_on_floor():
38 | jump_amount = max_jumps
39 | jump_timer.stop()
40 | elif jump_timer.is_stopped() and jump_amount == max_jumps:
41 | jump_timer.start(jump_delay)
42 | if Input.is_action_just_pressed("jump") and jump_amount > 0:
43 | movement_vector.y = jump_power
44 | jump_amount -= 1
45 | jump_timer.stop()
46 | # Move
47 | movement_vector = move_and_slide(movement_vector * modifier, Vector3.UP)
48 | movement_vector /= modifier
49 |
50 | func jump_timer_timeout():
51 | jump_amount -= 1
52 |
--------------------------------------------------------------------------------
/AdvancedMovement/scenes/water_area.gd:
--------------------------------------------------------------------------------
1 | extends Area
2 |
3 | func _body_entered(body):
4 | if body.get("in_water") != null:
5 | body.in_water = true
6 |
7 |
8 | func _body_exited(body):
9 | if body.get("in_water") != null:
10 | body.in_water = false
11 |
--------------------------------------------------------------------------------
/DungeonCrawlerMovement/.editorconfig:
--------------------------------------------------------------------------------
1 | #
2 | # Godot Game project EditorConfig
3 | #
4 | # @version 1.0.0
5 | #
6 |
7 | root = true
8 |
9 | [*]
10 | charset = utf-8
11 | end_of_line = lf
12 | indent_size = 2
13 | indent_style = space
14 | insert_final_newline = true
15 | trim_trailing_whitespace = true
16 |
17 | [*.md]
18 | trim_trailing_whitespace = false
19 |
20 | [*.gd]
21 | indent_style = tab
22 | indent_size = 4
23 | insert_final_newline = false
24 | trim_trailing_whitespace = false
25 |
26 | [*.cs]
27 | indent_size = 4
28 |
--------------------------------------------------------------------------------
/DungeonCrawlerMovement/.gitignore:
--------------------------------------------------------------------------------
1 | ##########################
2 | # Generic project ignore #
3 | ##########################
4 | # Prefix your personal development files and directories with `_`
5 | /_*
6 | /.vscode/
7 | /*.log
8 | **/_temp/**
9 |
10 | #################
11 | # Godot ignores #
12 | #################
13 | # Based on https://github.com/github/gitignore/blob/master/Godot.gitignore
14 | # Godot-specific ignores
15 | .import/
16 | export.cfg
17 | export_presets.cfg
18 |
19 | # Imported translations (automatically generated from CSV files)
20 | *.translation
21 |
22 | # Mono-specific ignores
23 | .mono/
24 | data_*/
25 |
--------------------------------------------------------------------------------
/DungeonCrawlerMovement/README.md:
--------------------------------------------------------------------------------
1 | # Dungeon Crawler Movement in Godot 3.5
2 |
3 |
4 |
5 | 
6 | Watch on YouTube
7 |
8 |
9 |
10 | In Godot 3.5, it's easy to create grid-based movement using tweens. This tutorial shows you how to make movement for a 3D dungeon crawler -style game.
11 | We are also releasing a free plugin for Godot 3.5 alongside this tutorial, which is used to make the level for the tutorial.
12 |
13 | Plugin featured in the tutorial: [LevelBlock plugin for Godot 3.5](https://github.com/ReunMedia/godot-levelblock)
14 |
15 | Published on 2022-12-22.
16 |
17 | # Relevant files
18 | [player.gd](./scenes/entity/player/player.gd)
19 |
--------------------------------------------------------------------------------
/DungeonCrawlerMovement/addons/level_block/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # Changelog
2 |
3 | All notable changes to this project will be documented in this file.
4 |
5 | The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6 | and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7 |
8 | ## [Unreleased]
9 |
10 | ## [1.0.2] - 2022-12-22
11 | ### Fixed
12 | - Global transforms are only set inside scene tree
13 | - Physics bodies now have object instance attached (enables getting collider via raycasts)
14 |
15 | ## [1.0.1] - 2022-12-17
16 | ### Fixed
17 | - Fixed node visibility not being applied
18 | - Fixed global transformation not being applied
19 |
20 | ## [1.0.0] - 2022-12-15
21 | - Initial release
22 |
23 | [unreleased]: https://github.com/ReunMedia/godot-levelblock/compare/1.0.2...HEAD
24 | [1.0.2]: https://github.com/ReunMedia/godot-levelblock/compare/1.0.1...1.0.2
25 | [1.0.1]: https://github.com/ReunMedia/godot-levelblock/compare/1.0.0...1.0.1
26 | [1.0.0]: https://github.com/ReunMedia/godot-levelblock/releases/tag/1.0.0
27 |
--------------------------------------------------------------------------------
/DungeonCrawlerMovement/addons/level_block/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2022 Reun Media Partnership
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/DungeonCrawlerMovement/addons/level_block/README.md:
--------------------------------------------------------------------------------
1 | # LevelBlock plugin for Godot 3.5
2 | 
3 | **LevelBlock** is a new node for Godot 3.5 meant for the creation of levels in dungeon crawler -style games.
4 |
5 | This node acts as an inside-facing cube, using a texture atlas sheet to display different parts for each face.
6 | ## Getting started
7 | 1. Download the plugin from GitHub and install it. See a guide here: [Godot Docs](https://docs.godotengine.org/en/stable/tutorials/plugins/editor/installing_plugins.html)
8 | 2. Add new LevelBlock nodes to your scene.
9 | 3. Configure the texture sheet (and optionally material) you want to use.
10 | 4. Configure the size of the square textures contained in the texture sheet.
11 | 5. Customize each face of the LevelBlock using the face values. Negative values disable generating the face.
12 | 6. Optionally enable generating collisions, generating occlusion culling and flipping the faces.
13 | ## Features
14 | - Use a single texture sheet, with each face displaying a different part of it using an index value. This texture sheet will replace the albedo texture of the material.
15 | - Customize the material or use the included default material.
16 | - Use an arbitary size for the square textures in the atlast.
17 | - Quickly customize the texture displayed on each face.
18 | - Automatic collision generation for visible faces.
19 | - Automatic occluder node generation for visible faces.
20 | - Option to flip faces to face outward instead.
21 | - Uses Godot's server system for optimized results.
22 | ## Limitations
23 | - Only square textures supported.
24 | - All textures in the atlas must be the same size.
25 | - Works best if texture filtering is disabled for a pixelated look.
26 | - No support for normal or roughness maps, only albedo.
27 |
--------------------------------------------------------------------------------
/DungeonCrawlerMovement/addons/level_block/clear.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
10 |
--------------------------------------------------------------------------------
/DungeonCrawlerMovement/addons/level_block/clear.svg.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="StreamTexture"
5 | path="res://.import/clear.svg-029a2888fe635d68609c343a20d9a19a.stex"
6 | metadata={
7 | "vram_texture": false
8 | }
9 |
10 | [deps]
11 |
12 | source_file="res://addons/level_block/clear.svg"
13 | dest_files=[ "res://.import/clear.svg-029a2888fe635d68609c343a20d9a19a.stex" ]
14 |
15 | [params]
16 |
17 | compress/mode=0
18 | compress/lossy_quality=0.7
19 | compress/hdr_mode=0
20 | compress/bptc_ldr=0
21 | compress/normal_map=0
22 | flags/repeat=0
23 | flags/filter=true
24 | flags/mipmaps=false
25 | flags/anisotropic=false
26 | flags/srgb=2
27 | process/fix_alpha_border=true
28 | process/premult_alpha=false
29 | process/HDR_as_SRGB=false
30 | process/invert_color=false
31 | process/normal_map_invert_y=false
32 | stream=false
33 | size_limit=0
34 | detect_3d=false
35 | svg/scale=1.0
36 |
--------------------------------------------------------------------------------
/DungeonCrawlerMovement/addons/level_block/default_material.tres:
--------------------------------------------------------------------------------
1 | [gd_resource type="SpatialMaterial" load_steps=2 format=2]
2 |
3 | [ext_resource path="res://assets/tileset.png" type="Texture" id=1]
4 |
5 | [resource]
6 | params_specular_mode = 4
7 | albedo_texture = ExtResource( 1 )
8 | metallic_specular = 0.0
9 |
--------------------------------------------------------------------------------
/DungeonCrawlerMovement/addons/level_block/icon.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 |
--------------------------------------------------------------------------------
/DungeonCrawlerMovement/addons/level_block/icon.svg.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="StreamTexture"
5 | path="res://.import/icon.svg-37502c4328f880b221342b460c8ed07a.stex"
6 | metadata={
7 | "vram_texture": false
8 | }
9 |
10 | [deps]
11 |
12 | source_file="res://addons/level_block/icon.svg"
13 | dest_files=[ "res://.import/icon.svg-37502c4328f880b221342b460c8ed07a.stex" ]
14 |
15 | [params]
16 |
17 | compress/mode=0
18 | compress/lossy_quality=0.7
19 | compress/hdr_mode=0
20 | compress/bptc_ldr=0
21 | compress/normal_map=0
22 | flags/repeat=0
23 | flags/filter=true
24 | flags/mipmaps=false
25 | flags/anisotropic=false
26 | flags/srgb=2
27 | process/fix_alpha_border=true
28 | process/premult_alpha=false
29 | process/HDR_as_SRGB=false
30 | process/invert_color=false
31 | process/normal_map_invert_y=false
32 | stream=false
33 | size_limit=0
34 | detect_3d=true
35 | svg/scale=1.0
36 |
--------------------------------------------------------------------------------
/DungeonCrawlerMovement/addons/level_block/level_block.gd:
--------------------------------------------------------------------------------
1 | tool
2 | extends EditorPlugin
3 |
4 | const Icon = preload("res://addons/level_block/icon.svg")
5 | const BlockNode = preload("res://addons/level_block/level_block_node.gd")
6 | const GizmoPlugin = preload("res://addons/level_block/level_block_gizmo.gd")
7 | const InspectorPlugin = preload("res://addons/level_block/level_block_inspector.gd")
8 |
9 | var gizmo_plugin = GizmoPlugin.new()
10 | var inspector_plugin = InspectorPlugin.new()
11 |
12 | func _enter_tree():
13 | add_custom_type("LevelBlock", "Spatial", BlockNode, Icon)
14 | add_spatial_gizmo_plugin(gizmo_plugin)
15 | add_inspector_plugin(inspector_plugin)
16 |
17 | func _exit_tree():
18 | remove_custom_type("LevelBlock")
19 | remove_spatial_gizmo_plugin(gizmo_plugin)
20 | remove_inspector_plugin(inspector_plugin)
21 |
--------------------------------------------------------------------------------
/DungeonCrawlerMovement/addons/level_block/level_block_gizmo.gd:
--------------------------------------------------------------------------------
1 | extends EditorSpatialGizmoPlugin
2 |
3 | const LevelBlock = preload("res://addons/level_block/level_block_node.gd")
4 |
5 | const cube_line_points = [
6 | Vector3(-1.0, -1.0, -1.0),
7 | Vector3(1.0, -1.0, -1.0),
8 | Vector3(1.0, -1.0, -1.0),
9 | Vector3(1.0, -1.0, 1.0),
10 | Vector3(1.0, -1.0, 1.0),
11 | Vector3(-1.0, -1.0, 1.0),
12 | Vector3(-1.0, -1.0, 1.0),
13 | Vector3(-1.0, -1.0, -1.0),
14 | Vector3(-1.0, 1.0, -1.0),
15 | Vector3(1.0, 1.0, -1.0),
16 | Vector3(1.0, 1.0, -1.0),
17 | Vector3(1.0, 1.0, 1.0),
18 | Vector3(1.0, 1.0, 1.0),
19 | Vector3(-1.0, 1.0, 1.0),
20 | Vector3(-1.0, 1.0, 1.0),
21 | Vector3(-1.0, 1.0, -1.0),
22 | Vector3(-1.0, -1.0, -1.0),
23 | Vector3(-1.0, 1.0, -1.0),
24 | Vector3(1.0, -1.0, -1.0),
25 | Vector3(1.0, 1.0, -1.0),
26 | Vector3(1.0, -1.0, 1.0),
27 | Vector3(1.0, 1.0, 1.0),
28 | Vector3(-1.0, -1.0, 1.0),
29 | Vector3(-1.0, 1.0, 1.0),
30 | ]
31 |
32 | func _init():
33 | create_material("cube", Color.orange)
34 |
35 | func get_name():
36 | return "LevelBlock"
37 |
38 | func has_gizmo(spatial):
39 | return spatial is LevelBlock
40 |
41 | func redraw(gizmo):
42 | gizmo.clear()
43 |
44 | var block = gizmo.get_spatial_node() as LevelBlock
45 | var cube := CubeMesh.new()
46 | cube.size = Vector3.ONE * 2.0
47 | gizmo.add_collision_triangles(cube.generate_triangle_mesh())
48 | var lines = PoolVector3Array(cube_line_points)
49 | gizmo.add_lines(lines, get_material("cube", gizmo))
50 |
--------------------------------------------------------------------------------
/DungeonCrawlerMovement/addons/level_block/level_block_inspector.gd:
--------------------------------------------------------------------------------
1 | extends EditorInspectorPlugin
2 |
3 | var BlockNode := preload("res://addons/level_block/level_block_node.gd")
4 | var TextureSelector := preload("res://addons/level_block/texture_selector.gd")
5 |
6 | var face_paths := [
7 | "north_face",
8 | "east_face",
9 | "south_face",
10 | "west_face",
11 | "top_face",
12 | "bottom_face"
13 | ]
14 |
15 | func can_handle(object):
16 | if object is BlockNode:
17 | return true
18 | return false
19 |
20 | func parse_property(object, type, path, hint, hint_text, usage):
21 | if type == TYPE_INT:
22 | for p in face_paths:
23 | if p == path:
24 | var selector := TextureSelector.new()
25 | selector.texture_sheet = object.texture_sheet
26 | object.connect("texture_updated", selector, "update_texture")
27 | object.connect("texture_size_updated", selector, "update_texture_size")
28 | selector.texture_size = object.texture_size
29 | add_property_editor(path, selector)
30 | return true
31 | return false
32 | else:
33 | return false
34 |
--------------------------------------------------------------------------------
/DungeonCrawlerMovement/addons/level_block/plugin.cfg:
--------------------------------------------------------------------------------
1 | [plugin]
2 |
3 | name="Level Block"
4 | description="A node for creating simple cubes with customizable sides and collision. Intended for dungeon crawler level design."
5 | author="Reun Media"
6 | version="1.0.2"
7 | script="level_block.gd"
8 |
--------------------------------------------------------------------------------
/DungeonCrawlerMovement/addons/level_block/texture_selector.gd:
--------------------------------------------------------------------------------
1 | extends EditorProperty
2 |
3 | var property_control := preload("res://addons/level_block/texture_selector_scene.tscn").instance()
4 | var clear_image := preload("res://addons/level_block/clear.svg")
5 |
6 | var current_value := 0
7 | var updating := false
8 | var texture_sheet : Texture
9 | var texture_size : float
10 |
11 | var texture
12 | var value
13 |
14 | func _init():
15 | add_child(property_control)
16 | texture = property_control.get_node("TextureRect")
17 | value = property_control.get_node("SpinBox")
18 | add_focusable(property_control)
19 | value.connect("value_changed", self, "update_value")
20 | refresh_control()
21 |
22 | func update_value(new_value: float):
23 | if updating:
24 | return
25 | current_value = new_value
26 | refresh_control()
27 | emit_changed(get_edited_property(), current_value)
28 |
29 | func update_property():
30 | var new_value = get_edited_object()[get_edited_property()]
31 | if (new_value == current_value):
32 | refresh_control()
33 | return
34 | updating = true
35 | current_value = new_value
36 | value.value = new_value
37 | refresh_control()
38 | updating = false
39 |
40 | func update_texture(new_texture: Texture):
41 | texture_sheet = new_texture
42 | refresh_control()
43 |
44 | func update_texture_size(new_size: float):
45 | texture_size = new_size
46 | refresh_control()
47 |
48 | func refresh_control():
49 | if not texture_sheet is Texture:
50 | return
51 | if current_value < 0:
52 | texture.texture = clear_image
53 | return
54 | texture.texture = AtlasTexture.new()
55 | texture.texture.atlas = texture_sheet.duplicate()
56 | if texture.texture.flags ^ Texture.FLAG_CONVERT_TO_LINEAR:
57 | texture.texture.flags &= Texture.FLAG_CONVERT_TO_LINEAR
58 | var pos = Vector2.ZERO
59 | var gap = texture_size / texture_sheet.get_size().x
60 | pos.x = fmod(gap * current_value, 1.0) * texture_sheet.get_size().x
61 | pos.y = floor(current_value / (1.0 / gap)) * gap * texture_sheet.get_size().y
62 | texture.texture.region.position = pos
63 | texture.texture.region.size = Vector2(texture_size, texture_size)
64 |
--------------------------------------------------------------------------------
/DungeonCrawlerMovement/addons/level_block/texture_selector_scene.tscn:
--------------------------------------------------------------------------------
1 | [gd_scene load_steps=2 format=2]
2 |
3 | [ext_resource path="res://addons/level_block/clear.svg" type="Texture" id=1]
4 |
5 | [node name="TextureSelector" type="HBoxContainer"]
6 | size_flags_horizontal = 0
7 | size_flags_vertical = 0
8 | custom_constants/separation = 20
9 |
10 | [node name="TextureRect" type="TextureRect" parent="."]
11 | margin_right = 64.0
12 | margin_bottom = 64.0
13 | rect_min_size = Vector2( 64, 64 )
14 | texture = ExtResource( 1 )
15 | expand = true
16 | stretch_mode = 6
17 |
18 | [node name="SpinBox" type="SpinBox" parent="."]
19 | margin_left = 84.0
20 | margin_top = 20.0
21 | margin_right = 158.0
22 | margin_bottom = 44.0
23 | size_flags_vertical = 4
24 | min_value = -1.0
25 | max_value = 255.0
26 | rounded = true
27 | allow_greater = true
28 |
--------------------------------------------------------------------------------
/DungeonCrawlerMovement/assets/tileset.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ReunMedia/gamedev-compass/4ace5b363ad175a37bf8ab0e5d38afd1b20a96c5/DungeonCrawlerMovement/assets/tileset.png
--------------------------------------------------------------------------------
/DungeonCrawlerMovement/assets/tileset.png.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="StreamTexture"
5 | path="res://.import/tileset.png-c50288acd069fa293d7940a084811264.stex"
6 | metadata={
7 | "vram_texture": false
8 | }
9 |
10 | [deps]
11 |
12 | source_file="res://assets/tileset.png"
13 | dest_files=[ "res://.import/tileset.png-c50288acd069fa293d7940a084811264.stex" ]
14 |
15 | [params]
16 |
17 | compress/mode=0
18 | compress/lossy_quality=0.7
19 | compress/hdr_mode=0
20 | compress/bptc_ldr=0
21 | compress/normal_map=0
22 | flags/repeat=1
23 | flags/filter=false
24 | flags/mipmaps=false
25 | flags/anisotropic=false
26 | flags/srgb=0
27 | process/fix_alpha_border=true
28 | process/premult_alpha=false
29 | process/HDR_as_SRGB=false
30 | process/invert_color=false
31 | process/normal_map_invert_y=false
32 | stream=false
33 | size_limit=0
34 | detect_3d=false
35 | svg/scale=1.0
36 |
--------------------------------------------------------------------------------
/DungeonCrawlerMovement/default_env.tres:
--------------------------------------------------------------------------------
1 | [gd_resource type="Environment" load_steps=2 format=2]
2 |
3 | [sub_resource type="ProceduralSky" id=1]
4 |
5 | [resource]
6 | background_mode = 2
7 | background_sky = SubResource( 1 )
8 |
--------------------------------------------------------------------------------
/DungeonCrawlerMovement/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ReunMedia/gamedev-compass/4ace5b363ad175a37bf8ab0e5d38afd1b20a96c5/DungeonCrawlerMovement/icon.png
--------------------------------------------------------------------------------
/DungeonCrawlerMovement/icon.png.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="StreamTexture"
5 | path="res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex"
6 | metadata={
7 | "vram_texture": false
8 | }
9 |
10 | [deps]
11 |
12 | source_file="res://icon.png"
13 | dest_files=[ "res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex" ]
14 |
15 | [params]
16 |
17 | compress/mode=0
18 | compress/lossy_quality=0.7
19 | compress/hdr_mode=0
20 | compress/bptc_ldr=0
21 | compress/normal_map=0
22 | flags/repeat=0
23 | flags/filter=true
24 | flags/mipmaps=false
25 | flags/anisotropic=false
26 | flags/srgb=2
27 | process/fix_alpha_border=true
28 | process/premult_alpha=false
29 | process/HDR_as_SRGB=false
30 | process/invert_color=false
31 | process/normal_map_invert_y=false
32 | stream=false
33 | size_limit=0
34 | detect_3d=true
35 | svg/scale=1.0
36 |
--------------------------------------------------------------------------------
/DungeonCrawlerMovement/scenes/entity/player/player.gd:
--------------------------------------------------------------------------------
1 | extends Spatial
2 |
3 | const TRAVEL_TIME := 0.3
4 |
5 | onready var front_ray := $FrontRay
6 | onready var back_ray := $BackRay
7 | onready var animation := $Animation
8 |
9 | var tween
10 |
11 | func _physics_process(delta):
12 | if tween is SceneTreeTween:
13 | if tween.is_running():
14 | return
15 | if Input.is_action_pressed("forward") and not front_ray.is_colliding():
16 | tween = create_tween().set_trans(Tween.TRANS_QUAD).set_ease(Tween.EASE_OUT)
17 | tween.tween_property(self, "transform", transform.translated(Vector3.FORWARD * 2), TRAVEL_TIME)
18 | animation.play("headbob")
19 | if Input.is_action_pressed("back") and not back_ray.is_colliding():
20 | tween = create_tween().set_trans(Tween.TRANS_QUAD).set_ease(Tween.EASE_OUT)
21 | tween.tween_property(self, "transform", transform.translated(Vector3.BACK * 2), TRAVEL_TIME)
22 | animation.play("headbob")
23 | if Input.is_action_pressed("left"):
24 | tween = create_tween().set_trans(Tween.TRANS_QUAD).set_ease(Tween.EASE_OUT)
25 | tween.tween_property(self, "transform:basis", transform.basis.rotated(Vector3.UP, PI / 2), TRAVEL_TIME)
26 | if Input.is_action_pressed("right"):
27 | tween = create_tween().set_trans(Tween.TRANS_QUAD).set_ease(Tween.EASE_OUT)
28 | tween.tween_property(self, "transform:basis", transform.basis.rotated(Vector3.UP, -PI / 2), TRAVEL_TIME)
29 |
--------------------------------------------------------------------------------
/DungeonCrawlerMovement/scenes/entity/player/player.tscn:
--------------------------------------------------------------------------------
1 | [gd_scene load_steps=4 format=2]
2 |
3 | [ext_resource path="res://scenes/entity/player/player.gd" type="Script" id=1]
4 |
5 | [sub_resource type="Animation" id=1]
6 | length = 0.001
7 | tracks/0/type = "value"
8 | tracks/0/path = NodePath("Camera:translation")
9 | tracks/0/interp = 1
10 | tracks/0/loop_wrap = true
11 | tracks/0/imported = false
12 | tracks/0/enabled = true
13 | tracks/0/keys = {
14 | "times": PoolRealArray( 0 ),
15 | "transitions": PoolRealArray( 1 ),
16 | "update": 0,
17 | "values": [ Vector3( 0, 0, 0 ) ]
18 | }
19 |
20 | [sub_resource type="Animation" id=2]
21 | resource_name = "headbob"
22 | length = 0.3
23 | tracks/0/type = "value"
24 | tracks/0/path = NodePath("Camera:translation")
25 | tracks/0/interp = 2
26 | tracks/0/loop_wrap = true
27 | tracks/0/imported = false
28 | tracks/0/enabled = true
29 | tracks/0/keys = {
30 | "times": PoolRealArray( 0, 0.1, 0.2, 0.3 ),
31 | "transitions": PoolRealArray( 1, 1, 1, 1 ),
32 | "update": 0,
33 | "values": [ Vector3( 0, 0, 0 ), Vector3( 0, 0.05, 0 ), Vector3( 0, -0.05, 0 ), Vector3( 0, 0, 0 ) ]
34 | }
35 |
36 | [node name="Player" type="Spatial"]
37 | script = ExtResource( 1 )
38 |
39 | [node name="Camera" type="Camera" parent="."]
40 | fov = 90.0
41 |
42 | [node name="FrontRay" type="RayCast" parent="."]
43 | enabled = true
44 | cast_to = Vector3( 0, 0, -2 )
45 |
46 | [node name="BackRay" type="RayCast" parent="."]
47 | enabled = true
48 | cast_to = Vector3( 0, 0, 2 )
49 |
50 | [node name="Light" type="OmniLight" parent="."]
51 | light_energy = 0.25
52 |
53 | [node name="Animation" type="AnimationPlayer" parent="."]
54 | anims/RESET = SubResource( 1 )
55 | anims/headbob = SubResource( 2 )
56 |
--------------------------------------------------------------------------------
/FPSInGodot4/.gitattributes:
--------------------------------------------------------------------------------
1 | # Normalize EOL for all files that Git considers text files.
2 | * text=auto eol=lf
3 |
--------------------------------------------------------------------------------
/FPSInGodot4/.gitignore:
--------------------------------------------------------------------------------
1 | # Godot 4+ specific ignores
2 | .godot/
3 |
--------------------------------------------------------------------------------
/FPSInGodot4/README.md:
--------------------------------------------------------------------------------
1 | # First-Person Shooter in Godot 4.0
2 |
3 |
4 |
5 | 
6 | Watch on YouTube
7 |
8 |
9 |
10 | This tutorial covers the structure of a simple first-person shooter game in Godot 4.0. This video isn't a step-by-step tutorial, but rather a showcase of a complete project.
11 | Note that the project has not been updated for Godot 4.1+.
12 |
13 | # Game Features
14 | - A full player controller with movement, jumping, stair-climbing and weapon switching.
15 | - Controller support.
16 | - Melee, projectile and raycast weapons.
17 | - One enemy unit with pathfinding AI.
18 | - Weapon and health pickups.
19 | - A simple symmetrical arena-style level.
20 | - PBR assets for weapons, level surfaces and enemies.
21 |
22 | Published on 2023-10-17.
23 |
24 | # Relevant files
25 | [player.gd](./scenes/entity/player/player.gd)
26 | [player_guns.gd](./scenes/entity/player/player_guns.gd)
27 | [gun.gd](./scenes/entity/player/gun/gun.gd)
28 | [enemy.gd](./scenes/entity/enemy/enemy.gd)
29 | [capsule_enemy.gd](./scenes/entity/enemy/capsule/capsule_enemy.gd)
30 | [enemy_bullet.gd](./scenes/entity/enemy/bullet/enemy_bullet.gd)
31 | [game.gd](./scenes/game/game.gd)
32 | [enemy_spawner.gd](./scenes/entity/enemy_spawner/enemy_spawner.gd)
33 | [pickup_spawner.gd](./scenes/entity/pickup_spawner/pickup_spawner.gd)
34 | [pickup.gd](./scenes/entity/pickup/pickup.gd)
35 | [hud.gd](./scenes/game/hud/hud.gd)
36 |
37 | # License and Assets
38 | This project is licensed CC BY 4.0 https://creativecommons.org/licenses/by/4.0/
39 | All assets are custom made for this project with the following exception:
40 | Heebo Medium font from Google Fonts: https://fonts.google.com/specimen/Heebo
41 |
--------------------------------------------------------------------------------
/FPSInGodot4/assets/1024.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ReunMedia/gamedev-compass/4ace5b363ad175a37bf8ab0e5d38afd1b20a96c5/FPSInGodot4/assets/1024.png
--------------------------------------------------------------------------------
/FPSInGodot4/assets/1024.png.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="CompressedTexture2D"
5 | uid="uid://c8bdlem5jmcsh"
6 | path.s3tc="res://.godot/imported/1024.png-140204064dfbfbcc03390b538035b994.s3tc.ctex"
7 | metadata={
8 | "imported_formats": ["s3tc_bptc"],
9 | "vram_texture": true
10 | }
11 |
12 | [deps]
13 |
14 | source_file="res://assets/1024.png"
15 | dest_files=["res://.godot/imported/1024.png-140204064dfbfbcc03390b538035b994.s3tc.ctex"]
16 |
17 | [params]
18 |
19 | compress/mode=2
20 | compress/high_quality=false
21 | compress/lossy_quality=0.7
22 | compress/hdr_compression=1
23 | compress/normal_map=0
24 | compress/channel_pack=0
25 | mipmaps/generate=true
26 | mipmaps/limit=-1
27 | roughness/mode=0
28 | roughness/src_normal=""
29 | process/fix_alpha_border=true
30 | process/premult_alpha=false
31 | process/normal_map_invert_y=false
32 | process/hdr_as_srgb=false
33 | process/hdr_clamp_exposure=false
34 | process/size_limit=0
35 | detect_3d/compress_to=0
36 |
--------------------------------------------------------------------------------
/FPSInGodot4/assets/Heebo-Medium.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ReunMedia/gamedev-compass/4ace5b363ad175a37bf8ab0e5d38afd1b20a96c5/FPSInGodot4/assets/Heebo-Medium.ttf
--------------------------------------------------------------------------------
/FPSInGodot4/assets/Heebo-Medium.ttf.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="font_data_dynamic"
4 | type="FontFile"
5 | uid="uid://d35d868jbn6cx"
6 | path="res://.godot/imported/Heebo-Medium.ttf-aadc91dba4d6d636b95b53cd966363a3.fontdata"
7 |
8 | [deps]
9 |
10 | source_file="res://assets/Heebo-Medium.ttf"
11 | dest_files=["res://.godot/imported/Heebo-Medium.ttf-aadc91dba4d6d636b95b53cd966363a3.fontdata"]
12 |
13 | [params]
14 |
15 | Rendering=null
16 | antialiasing=1
17 | generate_mipmaps=false
18 | multichannel_signed_distance_field=false
19 | msdf_pixel_range=8
20 | msdf_size=48
21 | allow_system_fallback=true
22 | force_autohinter=false
23 | hinting=1
24 | subpixel_positioning=1
25 | oversampling=0.0
26 | Fallbacks=null
27 | fallbacks=[]
28 | Compress=null
29 | compress=true
30 | preload=[]
31 | language_support={}
32 | script_support={}
33 | opentype_features={}
34 |
--------------------------------------------------------------------------------
/FPSInGodot4/icon.svg.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="CompressedTexture2D"
5 | uid="uid://ctfstie1yjg05"
6 | path="res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"
7 | metadata={
8 | "vram_texture": false
9 | }
10 |
11 | [deps]
12 |
13 | source_file="res://icon.svg"
14 | dest_files=["res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"]
15 |
16 | [params]
17 |
18 | compress/mode=0
19 | compress/high_quality=false
20 | compress/lossy_quality=0.7
21 | compress/hdr_compression=1
22 | compress/normal_map=0
23 | compress/channel_pack=0
24 | mipmaps/generate=false
25 | mipmaps/limit=-1
26 | roughness/mode=0
27 | roughness/src_normal=""
28 | process/fix_alpha_border=true
29 | process/premult_alpha=false
30 | process/normal_map_invert_y=false
31 | process/hdr_as_srgb=false
32 | process/hdr_clamp_exposure=false
33 | process/size_limit=0
34 | detect_3d/compress_to=1
35 | svg/scale=1.0
36 | editor/scale_with_editor_scale=false
37 | editor/convert_colors_with_editor_theme=false
38 |
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/entity/effect/explosion/assets/particles_fire.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ReunMedia/gamedev-compass/4ace5b363ad175a37bf8ab0e5d38afd1b20a96c5/FPSInGodot4/scenes/entity/effect/explosion/assets/particles_fire.png
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/entity/effect/explosion/assets/particles_fire.png.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="CompressedTexture2D"
5 | uid="uid://k1oubtk68x58"
6 | path.s3tc="res://.godot/imported/particles_fire.png-a473f5ebd845e14f1ebfadc7a1b43ced.s3tc.ctex"
7 | metadata={
8 | "imported_formats": ["s3tc_bptc"],
9 | "vram_texture": true
10 | }
11 |
12 | [deps]
13 |
14 | source_file="res://scenes/entity/effect/explosion/assets/particles_fire.png"
15 | dest_files=["res://.godot/imported/particles_fire.png-a473f5ebd845e14f1ebfadc7a1b43ced.s3tc.ctex"]
16 |
17 | [params]
18 |
19 | compress/mode=2
20 | compress/high_quality=false
21 | compress/lossy_quality=0.7
22 | compress/hdr_compression=1
23 | compress/normal_map=0
24 | compress/channel_pack=0
25 | mipmaps/generate=true
26 | mipmaps/limit=-1
27 | roughness/mode=0
28 | roughness/src_normal=""
29 | process/fix_alpha_border=true
30 | process/premult_alpha=false
31 | process/normal_map_invert_y=false
32 | process/hdr_as_srgb=false
33 | process/hdr_clamp_exposure=false
34 | process/size_limit=0
35 | detect_3d/compress_to=0
36 |
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/entity/enemy/bullet/enemy_bullet.gd:
--------------------------------------------------------------------------------
1 | extends Node3D
2 |
3 | @export var damage := 10.0
4 | @export var speed : float
5 | @export var life_span := 10.0
6 |
7 | func _ready() -> void:
8 | get_tree().create_timer(life_span).timeout.connect(queue_free)
9 |
10 | func _on_body_entered(body: Node3D) -> void:
11 | if body is Player:
12 | body.health -= damage
13 | queue_free()
14 |
15 | func _physics_process(delta: float) -> void:
16 | translate(Vector3.FORWARD * speed * delta)
17 |
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/entity/enemy/bullet/enemy_bullet.tscn:
--------------------------------------------------------------------------------
1 | [gd_scene load_steps=3 format=3 uid="uid://jdny71ns3ajs"]
2 |
3 | [ext_resource type="Script" path="res://scenes/entity/enemy/bullet/enemy_bullet.gd" id="1_6g22d"]
4 |
5 | [sub_resource type="SphereShape3D" id="SphereShape3D_2h8fx"]
6 |
7 | [node name="EnemyBullet" type="Area3D"]
8 | collision_layer = 16
9 | collision_mask = 3
10 | script = ExtResource("1_6g22d")
11 |
12 | [node name="CollisionShape3D" type="CollisionShape3D" parent="."]
13 | shape = SubResource("SphereShape3D_2h8fx")
14 |
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/entity/enemy/capsule/assets/capsule_enemy.glb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ReunMedia/gamedev-compass/4ace5b363ad175a37bf8ab0e5d38afd1b20a96c5/FPSInGodot4/scenes/entity/enemy/capsule/assets/capsule_enemy.glb
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/entity/enemy/capsule/assets/capsule_enemy.glb.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="scene"
4 | importer_version=1
5 | type="PackedScene"
6 | uid="uid://c5q6tfqljalv3"
7 | path="res://.godot/imported/capsule_enemy.glb-5b51babe0d792db0eb7d35630e394f5d.scn"
8 |
9 | [deps]
10 |
11 | source_file="res://scenes/entity/enemy/capsule/assets/capsule_enemy.glb"
12 | dest_files=["res://.godot/imported/capsule_enemy.glb-5b51babe0d792db0eb7d35630e394f5d.scn"]
13 |
14 | [params]
15 |
16 | nodes/root_type="Node3D"
17 | nodes/root_name="Scene Root"
18 | nodes/apply_root_scale=true
19 | nodes/root_scale=1.0
20 | meshes/ensure_tangents=true
21 | meshes/generate_lods=true
22 | meshes/create_shadow_meshes=true
23 | meshes/light_baking=1
24 | meshes/lightmap_texel_size=0.2
25 | skins/use_named_skins=true
26 | animation/import=true
27 | animation/fps=30
28 | animation/trimming=false
29 | animation/remove_immutable_tracks=true
30 | import_script/path=""
31 | _subresources={}
32 | gltf/embedded_image_handling=1
33 |
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/entity/enemy/capsule/assets/capsule_enemy_albedo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ReunMedia/gamedev-compass/4ace5b363ad175a37bf8ab0e5d38afd1b20a96c5/FPSInGodot4/scenes/entity/enemy/capsule/assets/capsule_enemy_albedo.png
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/entity/enemy/capsule/assets/capsule_enemy_albedo.png.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="CompressedTexture2D"
5 | uid="uid://cchfdn7ep5xdc"
6 | path.s3tc="res://.godot/imported/capsule_enemy_albedo.png-2976d1b3da4cc8df4f658518a5abb594.s3tc.ctex"
7 | metadata={
8 | "imported_formats": ["s3tc_bptc"],
9 | "vram_texture": true
10 | }
11 |
12 | [deps]
13 |
14 | source_file="res://scenes/entity/enemy/capsule/assets/capsule_enemy_albedo.png"
15 | dest_files=["res://.godot/imported/capsule_enemy_albedo.png-2976d1b3da4cc8df4f658518a5abb594.s3tc.ctex"]
16 |
17 | [params]
18 |
19 | compress/mode=2
20 | compress/high_quality=false
21 | compress/lossy_quality=0.7
22 | compress/hdr_compression=1
23 | compress/normal_map=0
24 | compress/channel_pack=0
25 | mipmaps/generate=true
26 | mipmaps/limit=-1
27 | roughness/mode=0
28 | roughness/src_normal=""
29 | process/fix_alpha_border=true
30 | process/premult_alpha=false
31 | process/normal_map_invert_y=false
32 | process/hdr_as_srgb=false
33 | process/hdr_clamp_exposure=false
34 | process/size_limit=0
35 | detect_3d/compress_to=0
36 |
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/entity/enemy/capsule/assets/capsule_enemy_emission.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ReunMedia/gamedev-compass/4ace5b363ad175a37bf8ab0e5d38afd1b20a96c5/FPSInGodot4/scenes/entity/enemy/capsule/assets/capsule_enemy_emission.png
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/entity/enemy/capsule/assets/capsule_enemy_emission.png.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="CompressedTexture2D"
5 | uid="uid://bp84w151bvqj0"
6 | path.s3tc="res://.godot/imported/capsule_enemy_emission.png-cacd77214922945475c13eb7f2a2d6b1.s3tc.ctex"
7 | metadata={
8 | "imported_formats": ["s3tc_bptc"],
9 | "vram_texture": true
10 | }
11 |
12 | [deps]
13 |
14 | source_file="res://scenes/entity/enemy/capsule/assets/capsule_enemy_emission.png"
15 | dest_files=["res://.godot/imported/capsule_enemy_emission.png-cacd77214922945475c13eb7f2a2d6b1.s3tc.ctex"]
16 |
17 | [params]
18 |
19 | compress/mode=2
20 | compress/high_quality=false
21 | compress/lossy_quality=0.7
22 | compress/hdr_compression=1
23 | compress/normal_map=0
24 | compress/channel_pack=0
25 | mipmaps/generate=true
26 | mipmaps/limit=-1
27 | roughness/mode=0
28 | roughness/src_normal=""
29 | process/fix_alpha_border=true
30 | process/premult_alpha=false
31 | process/normal_map_invert_y=false
32 | process/hdr_as_srgb=false
33 | process/hdr_clamp_exposure=false
34 | process/size_limit=0
35 | detect_3d/compress_to=0
36 |
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/entity/enemy/capsule/assets/capsule_enemy_material.tres:
--------------------------------------------------------------------------------
1 | [gd_resource type="StandardMaterial3D" load_steps=6 format=3 uid="uid://4jadpueur0uu"]
2 |
3 | [ext_resource type="Texture2D" uid="uid://cchfdn7ep5xdc" path="res://scenes/entity/enemy/capsule/assets/capsule_enemy_albedo.png" id="1_jc4bn"]
4 | [ext_resource type="Texture2D" uid="uid://620d25nolebq" path="res://scenes/entity/enemy/capsule/assets/capsule_enemy_occlusion.png" id="2_rmpaw"]
5 | [ext_resource type="Texture2D" uid="uid://bp84w151bvqj0" path="res://scenes/entity/enemy/capsule/assets/capsule_enemy_emission.png" id="3_3u3jt"]
6 | [ext_resource type="Texture2D" uid="uid://dxvfc8bnittxe" path="res://scenes/entity/enemy/capsule/assets/capsule_enemy_mr.png" id="4_jihqt"]
7 | [ext_resource type="Texture2D" uid="uid://brs6v4es60tog" path="res://scenes/entity/enemy/capsule/assets/capsule_enemy_normal.png" id="5_qjdox"]
8 |
9 | [resource]
10 | albedo_texture = ExtResource("1_jc4bn")
11 | metallic = 1.0
12 | metallic_texture = ExtResource("4_jihqt")
13 | roughness_texture = ExtResource("4_jihqt")
14 | roughness_texture_channel = 1
15 | emission_enabled = true
16 | emission_texture = ExtResource("3_3u3jt")
17 | normal_enabled = true
18 | normal_texture = ExtResource("5_qjdox")
19 | ao_enabled = true
20 | ao_light_affect = 1.0
21 | ao_texture = ExtResource("2_rmpaw")
22 | ao_texture_channel = 1
23 |
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/entity/enemy/capsule/assets/capsule_enemy_mr.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ReunMedia/gamedev-compass/4ace5b363ad175a37bf8ab0e5d38afd1b20a96c5/FPSInGodot4/scenes/entity/enemy/capsule/assets/capsule_enemy_mr.png
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/entity/enemy/capsule/assets/capsule_enemy_mr.png.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="CompressedTexture2D"
5 | uid="uid://dxvfc8bnittxe"
6 | path.s3tc="res://.godot/imported/capsule_enemy_mr.png-58798cacf6eee62e73dfdc9883a5b4cf.s3tc.ctex"
7 | metadata={
8 | "imported_formats": ["s3tc_bptc"],
9 | "vram_texture": true
10 | }
11 |
12 | [deps]
13 |
14 | source_file="res://scenes/entity/enemy/capsule/assets/capsule_enemy_mr.png"
15 | dest_files=["res://.godot/imported/capsule_enemy_mr.png-58798cacf6eee62e73dfdc9883a5b4cf.s3tc.ctex"]
16 |
17 | [params]
18 |
19 | compress/mode=2
20 | compress/high_quality=false
21 | compress/lossy_quality=0.7
22 | compress/hdr_compression=1
23 | compress/normal_map=0
24 | compress/channel_pack=0
25 | mipmaps/generate=true
26 | mipmaps/limit=-1
27 | roughness/mode=0
28 | roughness/src_normal=""
29 | process/fix_alpha_border=true
30 | process/premult_alpha=false
31 | process/normal_map_invert_y=false
32 | process/hdr_as_srgb=false
33 | process/hdr_clamp_exposure=false
34 | process/size_limit=0
35 | detect_3d/compress_to=0
36 |
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/entity/enemy/capsule/assets/capsule_enemy_normal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ReunMedia/gamedev-compass/4ace5b363ad175a37bf8ab0e5d38afd1b20a96c5/FPSInGodot4/scenes/entity/enemy/capsule/assets/capsule_enemy_normal.png
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/entity/enemy/capsule/assets/capsule_enemy_normal.png.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="CompressedTexture2D"
5 | uid="uid://brs6v4es60tog"
6 | path.s3tc="res://.godot/imported/capsule_enemy_normal.png-dde6bdac327dc46de0a79db6cc57b413.s3tc.ctex"
7 | metadata={
8 | "imported_formats": ["s3tc_bptc"],
9 | "vram_texture": true
10 | }
11 |
12 | [deps]
13 |
14 | source_file="res://scenes/entity/enemy/capsule/assets/capsule_enemy_normal.png"
15 | dest_files=["res://.godot/imported/capsule_enemy_normal.png-dde6bdac327dc46de0a79db6cc57b413.s3tc.ctex"]
16 |
17 | [params]
18 |
19 | compress/mode=2
20 | compress/high_quality=false
21 | compress/lossy_quality=0.7
22 | compress/hdr_compression=1
23 | compress/normal_map=1
24 | compress/channel_pack=0
25 | mipmaps/generate=true
26 | mipmaps/limit=-1
27 | roughness/mode=1
28 | roughness/src_normal="res://scenes/entity/enemy/capsule/assets/capsule_enemy_normal.png"
29 | process/fix_alpha_border=true
30 | process/premult_alpha=false
31 | process/normal_map_invert_y=false
32 | process/hdr_as_srgb=false
33 | process/hdr_clamp_exposure=false
34 | process/size_limit=0
35 | detect_3d/compress_to=0
36 |
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/entity/enemy/capsule/assets/capsule_enemy_occlusion.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ReunMedia/gamedev-compass/4ace5b363ad175a37bf8ab0e5d38afd1b20a96c5/FPSInGodot4/scenes/entity/enemy/capsule/assets/capsule_enemy_occlusion.png
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/entity/enemy/capsule/assets/capsule_enemy_occlusion.png.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="CompressedTexture2D"
5 | uid="uid://620d25nolebq"
6 | path.s3tc="res://.godot/imported/capsule_enemy_occlusion.png-6f7c16287b3223aebe35b82a51552982.s3tc.ctex"
7 | metadata={
8 | "imported_formats": ["s3tc_bptc"],
9 | "vram_texture": true
10 | }
11 |
12 | [deps]
13 |
14 | source_file="res://scenes/entity/enemy/capsule/assets/capsule_enemy_occlusion.png"
15 | dest_files=["res://.godot/imported/capsule_enemy_occlusion.png-6f7c16287b3223aebe35b82a51552982.s3tc.ctex"]
16 |
17 | [params]
18 |
19 | compress/mode=2
20 | compress/high_quality=false
21 | compress/lossy_quality=0.7
22 | compress/hdr_compression=1
23 | compress/normal_map=0
24 | compress/channel_pack=0
25 | mipmaps/generate=true
26 | mipmaps/limit=-1
27 | roughness/mode=0
28 | roughness/src_normal=""
29 | process/fix_alpha_border=true
30 | process/premult_alpha=false
31 | process/normal_map_invert_y=false
32 | process/hdr_as_srgb=false
33 | process/hdr_clamp_exposure=false
34 | process/size_limit=0
35 | detect_3d/compress_to=0
36 |
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/entity/enemy/capsule/capsule_enemy.tscn:
--------------------------------------------------------------------------------
1 | [gd_scene load_steps=10 format=3 uid="uid://cacc6ubmnonw"]
2 |
3 | [ext_resource type="PackedScene" uid="uid://dhlhxoc8xl0aa" path="res://scenes/entity/enemy/enemy_base.tscn" id="1_wpfav"]
4 | [ext_resource type="Script" path="res://scenes/entity/enemy/capsule/capsule_enemy.gd" id="2_5llr3"]
5 | [ext_resource type="PackedScene" uid="uid://la1w4fr0ukx2" path="res://scenes/entity/enemy/capsule/capsule_enemy_model.tscn" id="2_qr5b4"]
6 | [ext_resource type="PackedScene" uid="uid://bmh4hmqoctqke" path="res://scenes/entity/enemy/capsule/capsule_dead.tscn" id="3_xjspt"]
7 | [ext_resource type="PackedScene" uid="uid://cwo6ueep74lbe" path="res://scenes/entity/enemy/bullet/capsule/capsule_enemy_bullet.tscn" id="4_2ndl2"]
8 | [ext_resource type="PackedScene" uid="uid://ctdreptefjukn" path="res://scenes/entity/effect/explosion/explosion.tscn" id="5_q1fkq"]
9 |
10 | [sub_resource type="CapsuleShape3D" id="CapsuleShape3D_pd2jk"]
11 | height = 1.7
12 |
13 | [sub_resource type="SeparationRayShape3D" id="SeparationRayShape3D_sy82j"]
14 | length = 0.4
15 |
16 | [sub_resource type="SphereMesh" id="SphereMesh_ept31"]
17 | radius = 0.1
18 | height = 0.2
19 |
20 | [node name="CapsuleEnemy" instance=ExtResource("1_wpfav")]
21 | script = ExtResource("2_5llr3")
22 | dead_enemy = ExtResource("3_xjspt")
23 | bullet_scene = ExtResource("4_2ndl2")
24 | death_effect = ExtResource("5_q1fkq")
25 | fire_rate = 1.5
26 |
27 | [node name="CollisionShape3D" parent="." index="0"]
28 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.25, 0)
29 | shape = SubResource("CapsuleShape3D_pd2jk")
30 |
31 | [node name="CollisionShape3D2" type="CollisionShape3D" parent="." index="1"]
32 | transform = Transform3D(1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 0, 0.4, 0)
33 | shape = SubResource("SeparationRayShape3D_sy82j")
34 |
35 | [node name="capsule_enemy" parent="." index="2" instance=ExtResource("2_qr5b4")]
36 |
37 | [node name="RotateReference" type="MeshInstance3D" parent="capsule_enemy/Wheel" index="0"]
38 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.4, 0)
39 | visible = false
40 | mesh = SubResource("SphereMesh_ept31")
41 | skeleton = NodePath("../..")
42 |
43 | [node name="Point" type="Marker3D" parent="capsule_enemy/Barrel" index="0"]
44 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -0.4)
45 |
46 | [node name="OmniLight3D" type="OmniLight3D" parent="capsule_enemy" index="3"]
47 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.845, -0.666)
48 | light_color = Color(1, 0.207843, 0, 1)
49 | light_energy = 0.5
50 | omni_range = 2.5
51 |
52 | [node name="NavigationAgent3D" type="NavigationAgent3D" parent="." index="3"]
53 |
54 | [node name="CenterPoint" parent="." index="4"]
55 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.15, 0)
56 |
57 | [editable path="capsule_enemy"]
58 |
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/entity/enemy/capsule/capsule_enemy_model.tscn:
--------------------------------------------------------------------------------
1 | [gd_scene load_steps=3 format=3 uid="uid://la1w4fr0ukx2"]
2 |
3 | [ext_resource type="PackedScene" uid="uid://c5q6tfqljalv3" path="res://scenes/entity/enemy/capsule/assets/capsule_enemy.glb" id="1_1gp1g"]
4 | [ext_resource type="Material" uid="uid://4jadpueur0uu" path="res://scenes/entity/enemy/capsule/assets/capsule_enemy_material.tres" id="2_23ece"]
5 |
6 | [node name="capsule_enemy" instance=ExtResource("1_1gp1g")]
7 |
8 | [node name="Body" parent="." index="0"]
9 | surface_material_override/0 = ExtResource("2_23ece")
10 | surface_material_override/1 = ExtResource("2_23ece")
11 | surface_material_override/2 = ExtResource("2_23ece")
12 |
13 | [node name="Wheel" parent="." index="1"]
14 | surface_material_override/0 = ExtResource("2_23ece")
15 | surface_material_override/1 = ExtResource("2_23ece")
16 |
17 | [node name="Barrel" parent="." index="2"]
18 | surface_material_override/0 = ExtResource("2_23ece")
19 |
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/entity/enemy/effects/hit_sparks.gd:
--------------------------------------------------------------------------------
1 | extends Node3D
2 | var strength := 1.0
3 |
4 | func _ready() -> void:
5 | $GPUParticles3D.amount *= strength
6 |
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/entity/enemy/enemy.gd:
--------------------------------------------------------------------------------
1 | class_name Enemy
2 | extends CharacterBody3D
3 |
4 | signal destroyed(score)
5 |
6 | @export var score_value := 1
7 | @export var hit_effect : PackedScene
8 | @export var dead_enemy : PackedScene
9 | @export var bullet_scene : PackedScene
10 | @export var death_effect: PackedScene
11 | @export var fire_rate := 1.0
12 | @export var health := 100.0:
13 | set(value):
14 | health = value
15 | if health <= 0:
16 | destroy()
17 | @onready var center_point: Marker3D = $CenterPoint
18 | var player : Player
19 |
20 | func _ready() -> void:
21 | add_to_group("Enemy")
22 |
23 | func hit(damage: float, point: Vector3) -> void:
24 | health -= damage
25 | var effect = hit_effect.instantiate() as Node3D
26 | # The effect particles are more numerous based on bullet damage
27 | effect.strength = damage
28 | add_sibling(effect)
29 | effect.global_position = point
30 | # Turn the effect to face the center of the enemy
31 | effect.look_at(effect.global_position + (point - center_point.global_position))
32 |
33 | func destroy() -> void:
34 | destroyed.emit(score_value)
35 | var effect = death_effect.instantiate()
36 | if dead_enemy:
37 | var dead = dead_enemy.instantiate() as RigidBody3D
38 | add_sibling(dead)
39 | # Add a bit of believeable motion to the dead enemy
40 | dead.apply_impulse(-velocity)
41 | dead.apply_impulse(Vector3(randf(), 0, randf()))
42 | dead.global_transform = global_transform
43 | dead.add_child(effect)
44 | else:
45 | add_sibling(effect)
46 | effect.global_transform = center_point.global_transform
47 | queue_free()
48 |
49 | func has_sight_of_player() -> bool:
50 | var space_state = get_world_3d().direct_space_state
51 | var query = PhysicsRayQueryParameters3D.create(center_point.global_position, player.center_point.global_position)
52 | query.exclude = [self.get_rid()]
53 | var result = space_state.intersect_ray(query)
54 | if result and result.collider == player:
55 | return true
56 | else:
57 | return false
58 |
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/entity/enemy/enemy_base.tscn:
--------------------------------------------------------------------------------
1 | [gd_scene load_steps=4 format=3 uid="uid://dhlhxoc8xl0aa"]
2 |
3 | [ext_resource type="Script" path="res://scenes/entity/enemy/enemy.gd" id="1_t82jd"]
4 | [ext_resource type="PackedScene" uid="uid://vaywvgy3uvkj" path="res://scenes/entity/enemy/effects/hit_sparks.tscn" id="2_yxp2a"]
5 |
6 | [sub_resource type="SphereShape3D" id="SphereShape3D_dj1qf"]
7 |
8 | [node name="Enemy" type="CharacterBody3D"]
9 | collision_layer = 4
10 | collision_mask = 31
11 | script = ExtResource("1_t82jd")
12 | hit_effect = ExtResource("2_yxp2a")
13 |
14 | [node name="CollisionShape3D" type="CollisionShape3D" parent="."]
15 | shape = SubResource("SphereShape3D_dj1qf")
16 |
17 | [node name="CenterPoint" type="Marker3D" parent="."]
18 |
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/entity/enemy_spawner/enemy_spawner.gd:
--------------------------------------------------------------------------------
1 | extends Node3D
2 |
3 | signal enemy_spawned(enemy)
4 |
5 | const ENEMY_LIMIT = 50
6 |
7 | @export var enabled := true
8 | @export var enemy_to_spawn : PackedScene
9 | @export var spawn_interval := 10.0
10 | @export var spawn_speedup := 0.98
11 | @export var spawn_speed_limit := 2.0
12 |
13 | var player
14 | var spawn_points : Array[Node]
15 |
16 | func _ready() -> void:
17 | spawn_points = get_children()
18 | get_tree().create_timer(1.0).timeout.connect(spawn)
19 |
20 | func spawn() -> void:
21 | if enabled and player and !get_tree().paused:
22 | if get_tree().get_nodes_in_group("Enemy").size() < 50:
23 | var enemy := enemy_to_spawn.instantiate() as Enemy
24 | enemy.player = player
25 | enemy.transform = find_furthest_marker().global_transform
26 | add_sibling(enemy)
27 | enemy_spawned.emit(enemy)
28 | spawn_interval *= spawn_speedup
29 | spawn_interval = max(spawn_interval, spawn_speed_limit)
30 | get_tree().create_timer(spawn_interval).timeout.connect(spawn)
31 |
32 | func find_furthest_marker() -> Marker3D:
33 | var furthest_marker = spawn_points[0]
34 | var furthest_distance = 0
35 | for marker in spawn_points:
36 | var distance = marker.global_position.distance_to(player.global_position)
37 | if distance > furthest_distance:
38 | furthest_marker = marker
39 | furthest_distance = distance
40 | return furthest_marker
41 |
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/entity/enemy_spawner/enemy_spawner.tscn:
--------------------------------------------------------------------------------
1 | [gd_scene load_steps=3 format=3 uid="uid://d35mm8t73qbm6"]
2 |
3 | [ext_resource type="Script" path="res://scenes/entity/enemy_spawner/enemy_spawner.gd" id="1_x3a7u"]
4 | [ext_resource type="PackedScene" uid="uid://cacc6ubmnonw" path="res://scenes/entity/enemy/capsule/capsule_enemy.tscn" id="2_pvbyf"]
5 |
6 | [node name="EnemySpawner" type="Node3D"]
7 | script = ExtResource("1_x3a7u")
8 | enemy_to_spawn = ExtResource("2_pvbyf")
9 |
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/entity/pickup/pickup.gd:
--------------------------------------------------------------------------------
1 | class_name Pickup
2 | extends Area3D
3 |
4 | const TIMEOUT_ANIM_NAME = "timeout"
5 |
6 | enum PickupType {GUN, HEALTH}
7 |
8 | @export var pickup_type : PickupType
9 | @export var gun_scene : PackedScene
10 | @export var health_add_amount : float
11 | @export var timeout_time := 20.0
12 |
13 | @onready var timeout_animation: AnimationPlayer = $TimeoutAnimation
14 |
15 | func _ready() -> void:
16 | var timeout_anim_time := timeout_animation.get_animation(TIMEOUT_ANIM_NAME).length
17 | get_tree().create_timer(timeout_time - timeout_anim_time).timeout.connect(on_timeout)
18 |
19 | func on_pickup(body: Node3D) -> void:
20 | match pickup_type:
21 | PickupType.GUN:
22 | if body is Player:
23 | var gun = gun_scene.instantiate()
24 | if body.guns.has_node(str(gun.name)):
25 | body.guns.get_node(str(gun.name)).ammo += gun.ammo
26 | gun.queue_free()
27 | body.guns.add_child(gun)
28 | body.overlay(body.PICKUP_ANIM)
29 | PickupType.HEALTH:
30 | if body is Player:
31 | body.health += health_add_amount
32 | queue_free()
33 |
34 | func on_timeout() -> void:
35 | timeout_animation.play(TIMEOUT_ANIM_NAME)
36 | timeout_animation.animation_finished.connect(func(anim_name): if anim_name == TIMEOUT_ANIM_NAME: queue_free())
37 |
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/entity/pickup/pistol/pickup_pistol.tscn:
--------------------------------------------------------------------------------
1 | [gd_scene load_steps=4 format=3 uid="uid://owojm8hgm5yt"]
2 |
3 | [ext_resource type="PackedScene" uid="uid://dt6r571md0tnp" path="res://scenes/entity/pickup/pickup.tscn" id="1_610kr"]
4 | [ext_resource type="PackedScene" uid="uid://bc8q6i6jkrr5g" path="res://scenes/entity/player/gun/pistol/pistol_model.tscn" id="2_3dq7k"]
5 | [ext_resource type="PackedScene" uid="uid://xtnnwdon0bya" path="res://scenes/entity/player/gun/pistol/gun_pistol.tscn" id="2_tj1ty"]
6 |
7 | [node name="PickupPistol" instance=ExtResource("1_610kr")]
8 | gun_scene = ExtResource("2_tj1ty")
9 |
10 | [node name="pistol" parent="Model" index="1" instance=ExtResource("2_3dq7k")]
11 | transform = Transform3D(0.25, 0, 0, 0, 0.25, 0, 0, 0, 0.25, 0, -0.0122993, 0.0720291)
12 |
13 | [node name="Pistol" parent="Model/pistol" index="0"]
14 | layers = 1
15 |
16 | [editable path="Model/pistol"]
17 |
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/entity/pickup/rifle/pickup_rifle.tscn:
--------------------------------------------------------------------------------
1 | [gd_scene load_steps=4 format=3 uid="uid://b21j5wtnvq6wk"]
2 |
3 | [ext_resource type="PackedScene" uid="uid://dt6r571md0tnp" path="res://scenes/entity/pickup/pickup.tscn" id="1_r8rx2"]
4 | [ext_resource type="PackedScene" uid="uid://uu63qv1dxp4y" path="res://scenes/entity/player/gun/rifle/rifle_model.tscn" id="2_4dykr"]
5 | [ext_resource type="PackedScene" uid="uid://cqov4loln82m1" path="res://scenes/entity/player/gun/rifle/gun_rifle.tscn" id="2_gnc5s"]
6 |
7 | [node name="PickupRifle" instance=ExtResource("1_r8rx2")]
8 | gun_scene = ExtResource("2_gnc5s")
9 |
10 | [node name="rifle" parent="Model" index="1" instance=ExtResource("2_4dykr")]
11 | transform = Transform3D(0.5, 0, 0, 0, 0.5, 0, 0, 0, 0.5, 0, 0, 0)
12 |
13 | [node name="Rifle" parent="Model/rifle" index="0"]
14 | layers = 1
15 |
16 | [editable path="Model/rifle"]
17 |
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/entity/pickup_spawner/pickup_spawner.gd:
--------------------------------------------------------------------------------
1 | extends Node3D
2 |
3 | @export var pickup_list : Array[PackedScene]
4 | @export var spawn_delay := 25.0
5 |
6 | var pickup_points : Array[Node]
7 | var pickup_index := 0
8 |
9 | func _ready() -> void:
10 | pickup_points = get_children()
11 | get_tree().create_timer(spawn_delay).timeout.connect(spawn_pickup)
12 |
13 | func spawn_pickup() -> void:
14 | if get_tree().paused:
15 | return
16 | # Choose pickup and increment wrapping index
17 | var pickup = pickup_list[pickup_index].instantiate() as Pickup
18 | pickup_index = wrapi(pickup_index + 1, 0, pickup_list.size() - 1)
19 | add_sibling(pickup)
20 | pickup.global_position = pickup_points.pick_random().global_position
21 | get_tree().create_timer(spawn_delay).timeout.connect(spawn_pickup)
22 |
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/entity/pickup_spawner/pickup_spawner.tscn:
--------------------------------------------------------------------------------
1 | [gd_scene load_steps=5 format=3 uid="uid://b6tgkq80n5kvv"]
2 |
3 | [ext_resource type="Script" path="res://scenes/entity/pickup_spawner/pickup_spawner.gd" id="1_hxjh0"]
4 | [ext_resource type="PackedScene" uid="uid://b3rml6sdi3i3t" path="res://scenes/entity/pickup/health/pickup_health.tscn" id="2_r8mq6"]
5 | [ext_resource type="PackedScene" uid="uid://owojm8hgm5yt" path="res://scenes/entity/pickup/pistol/pickup_pistol.tscn" id="3_cvl6y"]
6 | [ext_resource type="PackedScene" uid="uid://b21j5wtnvq6wk" path="res://scenes/entity/pickup/rifle/pickup_rifle.tscn" id="4_wms5u"]
7 |
8 | [node name="PickupSpawner" type="Node3D"]
9 | script = ExtResource("1_hxjh0")
10 | pickup_list = Array[PackedScene]([ExtResource("3_cvl6y"), ExtResource("2_r8mq6"), ExtResource("4_wms5u"), ExtResource("2_r8mq6")])
11 |
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/entity/player/bullet/assets/bullet_hole_albedo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ReunMedia/gamedev-compass/4ace5b363ad175a37bf8ab0e5d38afd1b20a96c5/FPSInGodot4/scenes/entity/player/bullet/assets/bullet_hole_albedo.png
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/entity/player/bullet/assets/bullet_hole_albedo.png.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="CompressedTexture2D"
5 | uid="uid://bfu1v1he70v8m"
6 | path="res://.godot/imported/bullet_hole_albedo.png-f44dc15f7418ef8fe72ade0b5cc417a6.ctex"
7 | metadata={
8 | "vram_texture": false
9 | }
10 |
11 | [deps]
12 |
13 | source_file="res://scenes/entity/player/bullet/assets/bullet_hole_albedo.png"
14 | dest_files=["res://.godot/imported/bullet_hole_albedo.png-f44dc15f7418ef8fe72ade0b5cc417a6.ctex"]
15 |
16 | [params]
17 |
18 | compress/mode=0
19 | compress/high_quality=false
20 | compress/lossy_quality=0.7
21 | compress/hdr_compression=1
22 | compress/normal_map=0
23 | compress/channel_pack=0
24 | mipmaps/generate=false
25 | mipmaps/limit=-1
26 | roughness/mode=0
27 | roughness/src_normal=""
28 | process/fix_alpha_border=true
29 | process/premult_alpha=false
30 | process/normal_map_invert_y=false
31 | process/hdr_as_srgb=false
32 | process/hdr_clamp_exposure=false
33 | process/size_limit=0
34 | detect_3d/compress_to=1
35 |
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/entity/player/bullet/assets/bullet_hole_normal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ReunMedia/gamedev-compass/4ace5b363ad175a37bf8ab0e5d38afd1b20a96c5/FPSInGodot4/scenes/entity/player/bullet/assets/bullet_hole_normal.png
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/entity/player/bullet/assets/bullet_hole_normal.png.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="CompressedTexture2D"
5 | uid="uid://cppesousvg33e"
6 | path="res://.godot/imported/bullet_hole_normal.png-b66b074c9f6869f6454dc705941e9a73.ctex"
7 | metadata={
8 | "vram_texture": false
9 | }
10 |
11 | [deps]
12 |
13 | source_file="res://scenes/entity/player/bullet/assets/bullet_hole_normal.png"
14 | dest_files=["res://.godot/imported/bullet_hole_normal.png-b66b074c9f6869f6454dc705941e9a73.ctex"]
15 |
16 | [params]
17 |
18 | compress/mode=0
19 | compress/high_quality=false
20 | compress/lossy_quality=0.7
21 | compress/hdr_compression=1
22 | compress/normal_map=0
23 | compress/channel_pack=0
24 | mipmaps/generate=false
25 | mipmaps/limit=-1
26 | roughness/mode=1
27 | roughness/src_normal="res://scenes/entity/player/bullet/assets/bullet_hole_normal.png"
28 | process/fix_alpha_border=true
29 | process/premult_alpha=false
30 | process/normal_map_invert_y=false
31 | process/hdr_as_srgb=false
32 | process/hdr_clamp_exposure=false
33 | process/size_limit=0
34 | detect_3d/compress_to=1
35 |
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/entity/player/bullet/assets/bullet_hole_orm.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ReunMedia/gamedev-compass/4ace5b363ad175a37bf8ab0e5d38afd1b20a96c5/FPSInGodot4/scenes/entity/player/bullet/assets/bullet_hole_orm.png
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/entity/player/bullet/assets/bullet_hole_orm.png.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="CompressedTexture2D"
5 | uid="uid://clg6y83fvlnwj"
6 | path="res://.godot/imported/bullet_hole_orm.png-52b6bc4a2d66fa810bbe4cbc6a4f58af.ctex"
7 | metadata={
8 | "vram_texture": false
9 | }
10 |
11 | [deps]
12 |
13 | source_file="res://scenes/entity/player/bullet/assets/bullet_hole_orm.png"
14 | dest_files=["res://.godot/imported/bullet_hole_orm.png-52b6bc4a2d66fa810bbe4cbc6a4f58af.ctex"]
15 |
16 | [params]
17 |
18 | compress/mode=0
19 | compress/high_quality=false
20 | compress/lossy_quality=0.7
21 | compress/hdr_compression=1
22 | compress/normal_map=0
23 | compress/channel_pack=0
24 | mipmaps/generate=false
25 | mipmaps/limit=-1
26 | roughness/mode=0
27 | roughness/src_normal=""
28 | process/fix_alpha_border=true
29 | process/premult_alpha=false
30 | process/normal_map_invert_y=false
31 | process/hdr_as_srgb=false
32 | process/hdr_clamp_exposure=false
33 | process/size_limit=0
34 | detect_3d/compress_to=1
35 |
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/entity/player/bullet/baton/assets/baton_hole_albedo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ReunMedia/gamedev-compass/4ace5b363ad175a37bf8ab0e5d38afd1b20a96c5/FPSInGodot4/scenes/entity/player/bullet/baton/assets/baton_hole_albedo.png
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/entity/player/bullet/baton/assets/baton_hole_albedo.png.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="CompressedTexture2D"
5 | uid="uid://cmf8ekganf445"
6 | path="res://.godot/imported/baton_hole_albedo.png-2a1606078fa022279705425c2be34cce.ctex"
7 | metadata={
8 | "vram_texture": false
9 | }
10 |
11 | [deps]
12 |
13 | source_file="res://scenes/entity/player/bullet/baton/assets/baton_hole_albedo.png"
14 | dest_files=["res://.godot/imported/baton_hole_albedo.png-2a1606078fa022279705425c2be34cce.ctex"]
15 |
16 | [params]
17 |
18 | compress/mode=0
19 | compress/high_quality=false
20 | compress/lossy_quality=0.7
21 | compress/hdr_compression=1
22 | compress/normal_map=0
23 | compress/channel_pack=0
24 | mipmaps/generate=false
25 | mipmaps/limit=-1
26 | roughness/mode=0
27 | roughness/src_normal=""
28 | process/fix_alpha_border=true
29 | process/premult_alpha=false
30 | process/normal_map_invert_y=false
31 | process/hdr_as_srgb=false
32 | process/hdr_clamp_exposure=false
33 | process/size_limit=0
34 | detect_3d/compress_to=1
35 |
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/entity/player/bullet/baton/assets/baton_hole_normal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ReunMedia/gamedev-compass/4ace5b363ad175a37bf8ab0e5d38afd1b20a96c5/FPSInGodot4/scenes/entity/player/bullet/baton/assets/baton_hole_normal.png
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/entity/player/bullet/baton/assets/baton_hole_normal.png.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="CompressedTexture2D"
5 | uid="uid://15ftc8wkgnph"
6 | path="res://.godot/imported/baton_hole_normal.png-b222f5cd721ad11dd503a2f31d1f2b17.ctex"
7 | metadata={
8 | "vram_texture": false
9 | }
10 |
11 | [deps]
12 |
13 | source_file="res://scenes/entity/player/bullet/baton/assets/baton_hole_normal.png"
14 | dest_files=["res://.godot/imported/baton_hole_normal.png-b222f5cd721ad11dd503a2f31d1f2b17.ctex"]
15 |
16 | [params]
17 |
18 | compress/mode=0
19 | compress/high_quality=false
20 | compress/lossy_quality=0.7
21 | compress/hdr_compression=1
22 | compress/normal_map=0
23 | compress/channel_pack=0
24 | mipmaps/generate=false
25 | mipmaps/limit=-1
26 | roughness/mode=0
27 | roughness/src_normal=""
28 | process/fix_alpha_border=true
29 | process/premult_alpha=false
30 | process/normal_map_invert_y=false
31 | process/hdr_as_srgb=false
32 | process/hdr_clamp_exposure=false
33 | process/size_limit=0
34 | detect_3d/compress_to=1
35 |
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/entity/player/bullet/baton/assets/baton_hole_orm.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ReunMedia/gamedev-compass/4ace5b363ad175a37bf8ab0e5d38afd1b20a96c5/FPSInGodot4/scenes/entity/player/bullet/baton/assets/baton_hole_orm.png
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/entity/player/bullet/baton/assets/baton_hole_orm.png.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="CompressedTexture2D"
5 | uid="uid://5n84k0hubcrb"
6 | path="res://.godot/imported/baton_hole_orm.png-cae1b8b90a4ebdbfac307311b54a9084.ctex"
7 | metadata={
8 | "vram_texture": false
9 | }
10 |
11 | [deps]
12 |
13 | source_file="res://scenes/entity/player/bullet/baton/assets/baton_hole_orm.png"
14 | dest_files=["res://.godot/imported/baton_hole_orm.png-cae1b8b90a4ebdbfac307311b54a9084.ctex"]
15 |
16 | [params]
17 |
18 | compress/mode=0
19 | compress/high_quality=false
20 | compress/lossy_quality=0.7
21 | compress/hdr_compression=1
22 | compress/normal_map=0
23 | compress/channel_pack=0
24 | mipmaps/generate=false
25 | mipmaps/limit=-1
26 | roughness/mode=0
27 | roughness/src_normal=""
28 | process/fix_alpha_border=true
29 | process/premult_alpha=false
30 | process/normal_map_invert_y=false
31 | process/hdr_as_srgb=false
32 | process/hdr_clamp_exposure=false
33 | process/size_limit=0
34 | detect_3d/compress_to=1
35 |
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/entity/player/bullet/baton/baton_hole.tscn:
--------------------------------------------------------------------------------
1 | [gd_scene load_steps=5 format=3 uid="uid://bktwacbsocov5"]
2 |
3 | [ext_resource type="PackedScene" uid="uid://dcs1blqefn0m3" path="res://scenes/entity/player/bullet/bullet_hole.tscn" id="1_iql1d"]
4 | [ext_resource type="Texture2D" uid="uid://cmf8ekganf445" path="res://scenes/entity/player/bullet/baton/assets/baton_hole_albedo.png" id="2_yguwg"]
5 | [ext_resource type="Texture2D" uid="uid://15ftc8wkgnph" path="res://scenes/entity/player/bullet/baton/assets/baton_hole_normal.png" id="3_kiucc"]
6 | [ext_resource type="Texture2D" uid="uid://5n84k0hubcrb" path="res://scenes/entity/player/bullet/baton/assets/baton_hole_orm.png" id="4_2p5t1"]
7 |
8 | [node name="BatonHole" instance=ExtResource("1_iql1d")]
9 | transform = Transform3D(-0.965926, -1.13134e-08, -0.258819, -0.258819, 4.2222e-08, 0.965926, -6.68479e-15, 1, -4.37114e-08, 0, 0, 0)
10 | size = Vector3(1, 1, 1)
11 | texture_albedo = ExtResource("2_yguwg")
12 | texture_normal = ExtResource("3_kiucc")
13 | texture_orm = ExtResource("4_2p5t1")
14 |
15 | [node name="Test" parent="." index="0"]
16 | transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0, 0, 0)
17 |
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/entity/player/bullet/baton/bullet_baton.tscn:
--------------------------------------------------------------------------------
1 | [gd_scene load_steps=3 format=3 uid="uid://dm73j3rv7xgtd"]
2 |
3 | [ext_resource type="PackedScene" uid="uid://y07gqvbn72rj" path="res://scenes/entity/player/bullet/bullet_base.tscn" id="1_1hye6"]
4 | [ext_resource type="PackedScene" uid="uid://bktwacbsocov5" path="res://scenes/entity/player/bullet/baton/baton_hole.tscn" id="2_8af62"]
5 |
6 | [node name="BulletBaton" node_paths=PackedStringArray("area", "raycast") instance=ExtResource("1_1hye6")]
7 | damage = 40.0
8 | destroy_delay = 0.1
9 | timeout_delay = 0.1
10 | bullet_hole = ExtResource("2_8af62")
11 | bullet_hole_rot_start = -20.0
12 | bullet_hole_rot_end = 20.0
13 | area = NodePath("")
14 | raycast = NodePath("RayCast3D")
15 |
16 | [node name="RayCast3D" type="RayCast3D" parent="." index="0"]
17 | target_position = Vector3(0, 0, -2)
18 | collision_mask = 5
19 |
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/entity/player/bullet/bullet.gd:
--------------------------------------------------------------------------------
1 | extends Node3D
2 |
3 | @export var damage := 20.0
4 | @export var speed : float
5 | @export var destroy_delay : float
6 | @export var timeout_delay := 10.0
7 | @export var bullet_hole : PackedScene
8 | @export var bullet_hole_rot_start := -180.0
9 | @export var bullet_hole_rot_end := 180.0
10 | @export var area : Area3D
11 | @export var raycast : RayCast3D
12 | @export var piercing := false
13 |
14 | func _ready() -> void:
15 | # If area and raycast are not manually set, try to find them
16 | if !area:
17 | var find = find_children("*", "Area3D", false)
18 | if !find.is_empty():
19 | area = find[0]
20 | if !raycast:
21 | var find = find_children("*", "RayCast3D", false)
22 | if !find.is_empty():
23 | raycast = find[0]
24 | get_tree().create_timer(timeout_delay).timeout.connect(queue_free)
25 | if area:
26 | area.body_entered.connect(hit)
27 |
28 | func hit(body: PhysicsBody3D = null) -> void:
29 | # Disable the bullet once it hits something
30 | if area:
31 | area.set_deferred("monitoring", false)
32 | set_physics_process(false)
33 | # Set the body to be the raycast collider to reuse the logic
34 | if raycast and raycast.is_colliding():
35 | body = raycast.get_collider()
36 | create_bullet_hole(body)
37 | # Collision layer value 3 is the Enemy layer
38 | if body.get_collision_layer_value(3):
39 | # The hit functions are provided a position for secondary effects
40 | if raycast and raycast.is_colliding():
41 | body.hit(damage, raycast.get_collision_point())
42 | else:
43 | body.hit(damage, global_position)
44 | # Piercing bullets are duplicated
45 | if piercing:
46 | var new = duplicate()
47 | new.raycast.add_exception(body)
48 | await get_tree().physics_frame
49 | add_sibling(new)
50 | destroy()
51 |
52 | func create_bullet_hole(body: PhysicsBody3D) -> void:
53 | var hole := bullet_hole.instantiate() as Decal
54 | # Add bullet holes on enemies as children
55 | if body.get_collision_layer_value(3):
56 | body.add_child(hole)
57 | else:
58 | add_sibling(hole)
59 | hole.top_level = true
60 | # Set the position to either the bullet or the raycast collision point
61 | hole.global_position = global_position
62 | if raycast and raycast.is_colliding():
63 | hole.global_position = raycast.get_collision_point()
64 | # Rotate the bullet hole randomly
65 | hole.rotate_object_local(Vector3.UP, deg_to_rad(randf_range(bullet_hole_rot_start, bullet_hole_rot_end)))
66 |
67 | func _physics_process(delta: float) -> void:
68 | # Bullet movement
69 | translate(Vector3.FORWARD * speed * delta)
70 | # Trigger raycast collision
71 | if raycast and raycast.is_colliding():
72 | hit()
73 |
74 | func destroy() -> void:
75 | get_tree().create_timer(destroy_delay).timeout.connect(queue_free)
76 |
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/entity/player/bullet/bullet_base.tscn:
--------------------------------------------------------------------------------
1 | [gd_scene load_steps=3 format=3 uid="uid://y07gqvbn72rj"]
2 |
3 | [ext_resource type="Script" path="res://scenes/entity/player/bullet/bullet.gd" id="1_coyu4"]
4 | [ext_resource type="PackedScene" uid="uid://dcs1blqefn0m3" path="res://scenes/entity/player/bullet/bullet_hole.tscn" id="2_rvxcw"]
5 |
6 | [node name="BulletBase" type="Node3D"]
7 | top_level = true
8 | script = ExtResource("1_coyu4")
9 | bullet_hole = ExtResource("2_rvxcw")
10 |
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/entity/player/bullet/bullet_hole.gd:
--------------------------------------------------------------------------------
1 | extends Decal
2 |
3 | const FADE_TIME = 5.0
4 |
5 | func _ready() -> void:
6 | var tween := create_tween()
7 | tween.tween_property(self, "modulate:a", 0, FADE_TIME)
8 | get_tree().create_timer(FADE_TIME).timeout.connect(queue_free)
9 |
10 |
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/entity/player/bullet/bullet_hole.tscn:
--------------------------------------------------------------------------------
1 | [gd_scene load_steps=6 format=3 uid="uid://dcs1blqefn0m3"]
2 |
3 | [ext_resource type="Texture2D" uid="uid://bfu1v1he70v8m" path="res://scenes/entity/player/bullet/assets/bullet_hole_albedo.png" id="1_3vw8j"]
4 | [ext_resource type="Texture2D" uid="uid://cppesousvg33e" path="res://scenes/entity/player/bullet/assets/bullet_hole_normal.png" id="1_aw75a"]
5 | [ext_resource type="Script" path="res://scenes/entity/player/bullet/bullet_hole.gd" id="1_h4r45"]
6 | [ext_resource type="Texture2D" uid="uid://clg6y83fvlnwj" path="res://scenes/entity/player/bullet/assets/bullet_hole_orm.png" id="3_bc6a3"]
7 |
8 | [sub_resource type="QuadMesh" id="QuadMesh_1c6c4"]
9 |
10 | [node name="BulletHole" type="Decal"]
11 | transform = Transform3D(1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 0, 0, 0)
12 | size = Vector3(0.25, 1, 0.25)
13 | texture_albedo = ExtResource("1_3vw8j")
14 | texture_normal = ExtResource("1_aw75a")
15 | texture_orm = ExtResource("3_bc6a3")
16 | script = ExtResource("1_h4r45")
17 |
18 | [node name="Test" type="MeshInstance3D" parent="."]
19 | transform = Transform3D(0.25, 0, 0, 0, -1.09278e-08, 0.25, 0, -0.25, -1.09278e-08, 0, 0, 0)
20 | visible = false
21 | mesh = SubResource("QuadMesh_1c6c4")
22 |
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/entity/player/bullet/pistol/bullet_pistol.gd:
--------------------------------------------------------------------------------
1 | extends "res://scenes/entity/player/bullet/bullet.gd"
2 |
3 | func destroy() -> void:
4 | $MeshInstance3D.visible = false
5 | $OmniLight3D.visible = false
6 | $GPUParticles3D.emitting = false
7 | super.destroy()
8 |
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/entity/player/bullet/rifle/bullet_rifle.tscn:
--------------------------------------------------------------------------------
1 | [gd_scene load_steps=2 format=3 uid="uid://b10kvgli1ablb"]
2 |
3 | [ext_resource type="PackedScene" uid="uid://y07gqvbn72rj" path="res://scenes/entity/player/bullet/bullet_base.tscn" id="1_baw3y"]
4 |
5 | [node name="BulletRifle" node_paths=PackedStringArray("raycast") instance=ExtResource("1_baw3y")]
6 | damage = 75.0
7 | raycast = NodePath("RayCast3D")
8 | piercing = true
9 |
10 | [node name="RayCast3D" type="RayCast3D" parent="." index="0"]
11 | target_position = Vector3(0, 0, -100)
12 | collision_mask = 5
13 |
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/entity/player/gun/baton/assets/baton.glb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ReunMedia/gamedev-compass/4ace5b363ad175a37bf8ab0e5d38afd1b20a96c5/FPSInGodot4/scenes/entity/player/gun/baton/assets/baton.glb
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/entity/player/gun/baton/assets/baton.glb.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="scene"
4 | importer_version=1
5 | type="PackedScene"
6 | uid="uid://dqt21lo3vwnyk"
7 | path="res://.godot/imported/baton.glb-e7f2a99f30e3971f046324d2518e3717.scn"
8 |
9 | [deps]
10 |
11 | source_file="res://scenes/entity/player/gun/baton/assets/baton.glb"
12 | dest_files=["res://.godot/imported/baton.glb-e7f2a99f30e3971f046324d2518e3717.scn"]
13 |
14 | [params]
15 |
16 | nodes/root_type="Node3D"
17 | nodes/root_name="Scene Root"
18 | nodes/apply_root_scale=true
19 | nodes/root_scale=1.0
20 | meshes/ensure_tangents=true
21 | meshes/generate_lods=true
22 | meshes/create_shadow_meshes=true
23 | meshes/light_baking=1
24 | meshes/lightmap_texel_size=0.2
25 | skins/use_named_skins=true
26 | animation/import=true
27 | animation/fps=30
28 | animation/trimming=false
29 | animation/remove_immutable_tracks=true
30 | import_script/path=""
31 | _subresources={}
32 | gltf/embedded_image_handling=1
33 |
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/entity/player/gun/baton/assets/baton.tres:
--------------------------------------------------------------------------------
1 | [gd_resource type="StandardMaterial3D" load_steps=4 format=3 uid="uid://wjb0c08queaq"]
2 |
3 | [ext_resource type="Texture2D" uid="uid://cr34skso0npoi" path="res://scenes/entity/player/gun/baton/assets/baton_albedo.png" id="1"]
4 | [ext_resource type="Texture2D" uid="uid://cs6ahrykmfi6j" path="res://scenes/entity/player/gun/baton/assets/baton_orm.png" id="2"]
5 | [ext_resource type="Texture2D" uid="uid://dnubcxesmic3y" path="res://scenes/entity/player/gun/baton/assets/baton_normal.png" id="3"]
6 |
7 | [resource]
8 | albedo_texture = ExtResource("1")
9 | metallic = 1.0
10 | metallic_texture = ExtResource("2")
11 | metallic_texture_channel = 2
12 | roughness_texture = ExtResource("2")
13 | roughness_texture_channel = 1
14 | normal_enabled = true
15 | normal_texture = ExtResource("3")
16 | ao_enabled = true
17 | ao_light_affect = 1.0
18 | ao_texture = ExtResource("2")
19 |
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/entity/player/gun/baton/assets/baton_albedo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ReunMedia/gamedev-compass/4ace5b363ad175a37bf8ab0e5d38afd1b20a96c5/FPSInGodot4/scenes/entity/player/gun/baton/assets/baton_albedo.png
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/entity/player/gun/baton/assets/baton_albedo.png.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="CompressedTexture2D"
5 | uid="uid://cr34skso0npoi"
6 | path.s3tc="res://.godot/imported/baton_albedo.png-3107890de136c54b59e92ac633ff830a.s3tc.ctex"
7 | metadata={
8 | "imported_formats": ["s3tc_bptc"],
9 | "vram_texture": true
10 | }
11 |
12 | [deps]
13 |
14 | source_file="res://scenes/entity/player/gun/baton/assets/baton_albedo.png"
15 | dest_files=["res://.godot/imported/baton_albedo.png-3107890de136c54b59e92ac633ff830a.s3tc.ctex"]
16 |
17 | [params]
18 |
19 | compress/mode=2
20 | compress/high_quality=false
21 | compress/lossy_quality=0.7
22 | compress/hdr_compression=1
23 | compress/normal_map=0
24 | compress/channel_pack=0
25 | mipmaps/generate=true
26 | mipmaps/limit=-1
27 | roughness/mode=0
28 | roughness/src_normal=""
29 | process/fix_alpha_border=true
30 | process/premult_alpha=false
31 | process/normal_map_invert_y=false
32 | process/hdr_as_srgb=false
33 | process/hdr_clamp_exposure=false
34 | process/size_limit=0
35 | detect_3d/compress_to=0
36 |
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/entity/player/gun/baton/assets/baton_icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ReunMedia/gamedev-compass/4ace5b363ad175a37bf8ab0e5d38afd1b20a96c5/FPSInGodot4/scenes/entity/player/gun/baton/assets/baton_icon.png
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/entity/player/gun/baton/assets/baton_icon.png.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="CompressedTexture2D"
5 | uid="uid://lm6cqlsgh87y"
6 | path="res://.godot/imported/baton_icon.png-e5416cfc49e2216096a1c132798f9be5.ctex"
7 | metadata={
8 | "vram_texture": false
9 | }
10 |
11 | [deps]
12 |
13 | source_file="res://scenes/entity/player/gun/baton/assets/baton_icon.png"
14 | dest_files=["res://.godot/imported/baton_icon.png-e5416cfc49e2216096a1c132798f9be5.ctex"]
15 |
16 | [params]
17 |
18 | compress/mode=0
19 | compress/high_quality=false
20 | compress/lossy_quality=0.7
21 | compress/hdr_compression=1
22 | compress/normal_map=0
23 | compress/channel_pack=0
24 | mipmaps/generate=false
25 | mipmaps/limit=-1
26 | roughness/mode=0
27 | roughness/src_normal=""
28 | process/fix_alpha_border=true
29 | process/premult_alpha=false
30 | process/normal_map_invert_y=false
31 | process/hdr_as_srgb=false
32 | process/hdr_clamp_exposure=false
33 | process/size_limit=0
34 | detect_3d/compress_to=0
35 |
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/entity/player/gun/baton/assets/baton_normal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ReunMedia/gamedev-compass/4ace5b363ad175a37bf8ab0e5d38afd1b20a96c5/FPSInGodot4/scenes/entity/player/gun/baton/assets/baton_normal.png
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/entity/player/gun/baton/assets/baton_normal.png.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="CompressedTexture2D"
5 | uid="uid://dnubcxesmic3y"
6 | path.s3tc="res://.godot/imported/baton_normal.png-a3d4085dd2f106749b57fb99c4516007.s3tc.ctex"
7 | metadata={
8 | "imported_formats": ["s3tc_bptc"],
9 | "vram_texture": true
10 | }
11 |
12 | [deps]
13 |
14 | source_file="res://scenes/entity/player/gun/baton/assets/baton_normal.png"
15 | dest_files=["res://.godot/imported/baton_normal.png-a3d4085dd2f106749b57fb99c4516007.s3tc.ctex"]
16 |
17 | [params]
18 |
19 | compress/mode=2
20 | compress/high_quality=false
21 | compress/lossy_quality=0.7
22 | compress/hdr_compression=1
23 | compress/normal_map=1
24 | compress/channel_pack=0
25 | mipmaps/generate=true
26 | mipmaps/limit=-1
27 | roughness/mode=1
28 | roughness/src_normal="res://scenes/entity/player/gun/baton/assets/baton_normal.png"
29 | process/fix_alpha_border=true
30 | process/premult_alpha=false
31 | process/normal_map_invert_y=false
32 | process/hdr_as_srgb=false
33 | process/hdr_clamp_exposure=false
34 | process/size_limit=0
35 | detect_3d/compress_to=0
36 |
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/entity/player/gun/baton/assets/baton_orm.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ReunMedia/gamedev-compass/4ace5b363ad175a37bf8ab0e5d38afd1b20a96c5/FPSInGodot4/scenes/entity/player/gun/baton/assets/baton_orm.png
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/entity/player/gun/baton/assets/baton_orm.png.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="CompressedTexture2D"
5 | uid="uid://cs6ahrykmfi6j"
6 | path.s3tc="res://.godot/imported/baton_orm.png-30ff5c3bcf77f9c6fb0c6e2d56629791.s3tc.ctex"
7 | metadata={
8 | "imported_formats": ["s3tc_bptc"],
9 | "vram_texture": true
10 | }
11 |
12 | [deps]
13 |
14 | source_file="res://scenes/entity/player/gun/baton/assets/baton_orm.png"
15 | dest_files=["res://.godot/imported/baton_orm.png-30ff5c3bcf77f9c6fb0c6e2d56629791.s3tc.ctex"]
16 |
17 | [params]
18 |
19 | compress/mode=2
20 | compress/high_quality=false
21 | compress/lossy_quality=0.7
22 | compress/hdr_compression=1
23 | compress/normal_map=0
24 | compress/channel_pack=0
25 | mipmaps/generate=true
26 | mipmaps/limit=-1
27 | roughness/mode=8
28 | roughness/src_normal="res://scenes/entity/player/gun/baton/assets/baton_normal.png"
29 | process/fix_alpha_border=true
30 | process/premult_alpha=false
31 | process/normal_map_invert_y=false
32 | process/hdr_as_srgb=false
33 | process/hdr_clamp_exposure=false
34 | process/size_limit=0
35 | detect_3d/compress_to=0
36 |
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/entity/player/gun/baton/baton_model.tscn:
--------------------------------------------------------------------------------
1 | [gd_scene load_steps=3 format=3 uid="uid://ds7ww8fvv2kbe"]
2 |
3 | [ext_resource type="PackedScene" uid="uid://dqt21lo3vwnyk" path="res://scenes/entity/player/gun/baton/assets/baton.glb" id="1_iv4w2"]
4 | [ext_resource type="Material" uid="uid://wjb0c08queaq" path="res://scenes/entity/player/gun/baton/assets/baton.tres" id="2_m2e2m"]
5 |
6 | [node name="baton" instance=ExtResource("1_iv4w2")]
7 |
8 | [node name="Baton" parent="." index="0"]
9 | layers = 2
10 | surface_material_override/0 = ExtResource("2_m2e2m")
11 | surface_material_override/1 = ExtResource("2_m2e2m")
12 |
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/entity/player/gun/gun.gd:
--------------------------------------------------------------------------------
1 | class_name Gun
2 | extends Node3D
3 |
4 | signal ammo_changed(value)
5 |
6 | const RAY_MAX = 100.0
7 | const AIM_DISTANCE = 5.0
8 | const FIRE_ANIM_NAME = "fire"
9 |
10 | enum WeaponType {PROJECTILE, RAYCAST}
11 |
12 | @export var display_name: String
13 | @export var gun_icon: Texture2D
14 | @export var ammo := 0:
15 | set(value):
16 | ammo = value
17 | ammo_changed.emit(ammo)
18 | @export var use_ammo := true
19 | @export var weapon_type := WeaponType.PROJECTILE
20 | @export var bullet_scene : PackedScene
21 | @export var fire_rate := 0.2
22 | @export var fire_delay := 0.0
23 |
24 | @onready var animation: AnimationPlayer = $AnimationPlayer
25 | @onready var shoot_point: Marker3D = $ShootPoint
26 |
27 | var rate_timer := Timer.new()
28 |
29 | func _ready() -> void:
30 | rate_timer.one_shot = true
31 | add_child(rate_timer)
32 | visible = false
33 |
34 | func fire() -> void:
35 | if !visible:
36 | return
37 | if !rate_timer.is_stopped():
38 | return
39 | if use_ammo and ammo <= 0:
40 | return
41 | ammo -= 1
42 | rate_timer.start(fire_rate)
43 | if animation.has_animation(FIRE_ANIM_NAME):
44 | if animation.is_playing() and animation.current_animation == FIRE_ANIM_NAME:
45 | animation.seek(0.0)
46 | animation.play(FIRE_ANIM_NAME)
47 | get_tree().create_timer(fire_delay).timeout.connect(create_bullet)
48 |
49 | func create_bullet() -> void:
50 | var bullet := bullet_scene.instantiate() as Node3D
51 | get_parent().bullets.add_child(bullet)
52 | if weapon_type == WeaponType.PROJECTILE:
53 | var space = get_world_3d().direct_space_state
54 | var query = PhysicsRayQueryParameters3D.create(global_position, (-global_transform.basis.z * RAY_MAX) + global_position)
55 | var result = space.intersect_ray(query)
56 | var target_pos = (-global_transform.basis.z * RAY_MAX) + global_position
57 | if result:
58 | var distance = shoot_point.global_position.distance_to(result.position)
59 | if distance < AIM_DISTANCE:
60 | target_pos = (-global_transform.basis.z * AIM_DISTANCE) + global_position
61 | else:
62 | target_pos = result.position
63 | bullet.look_at_from_position(shoot_point.global_position, target_pos)
64 |
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/entity/player/gun/gun_base.tscn:
--------------------------------------------------------------------------------
1 | [gd_scene load_steps=4 format=3 uid="uid://hs87njuiclwl"]
2 |
3 | [ext_resource type="Script" path="res://scenes/entity/player/gun/gun.gd" id="1_63k4f"]
4 |
5 | [sub_resource type="AnimationLibrary" id="AnimationLibrary_5xj3v"]
6 |
7 | [sub_resource type="SphereMesh" id="SphereMesh_8qwhr"]
8 | radius = 0.2
9 | height = 0.4
10 |
11 | [node name="GunBase" type="Node3D"]
12 | script = ExtResource("1_63k4f")
13 |
14 | [node name="Model" type="Node3D" parent="."]
15 |
16 | [node name="AnimationPlayer" type="AnimationPlayer" parent="."]
17 | libraries = {
18 | "": SubResource("AnimationLibrary_5xj3v")
19 | }
20 |
21 | [node name="Reference" type="MeshInstance3D" parent="."]
22 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.25, -0.25, -0.5)
23 | layers = 2
24 | mesh = SubResource("SphereMesh_8qwhr")
25 |
26 | [node name="ShootPoint" type="Marker3D" parent="."]
27 |
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/entity/player/gun/pistol/assets/pistol.glb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ReunMedia/gamedev-compass/4ace5b363ad175a37bf8ab0e5d38afd1b20a96c5/FPSInGodot4/scenes/entity/player/gun/pistol/assets/pistol.glb
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/entity/player/gun/pistol/assets/pistol.glb.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="scene"
4 | importer_version=1
5 | type="PackedScene"
6 | uid="uid://dlarvrv3lqfr8"
7 | path="res://.godot/imported/pistol.glb-e4f714ef404232765e47d7c31b09c75d.scn"
8 |
9 | [deps]
10 |
11 | source_file="res://scenes/entity/player/gun/pistol/assets/pistol.glb"
12 | dest_files=["res://.godot/imported/pistol.glb-e4f714ef404232765e47d7c31b09c75d.scn"]
13 |
14 | [params]
15 |
16 | nodes/root_type="Node3D"
17 | nodes/root_name="Scene Root"
18 | nodes/apply_root_scale=true
19 | nodes/root_scale=1.0
20 | meshes/ensure_tangents=true
21 | meshes/generate_lods=true
22 | meshes/create_shadow_meshes=true
23 | meshes/light_baking=1
24 | meshes/lightmap_texel_size=0.2
25 | skins/use_named_skins=true
26 | animation/import=true
27 | animation/fps=30
28 | animation/trimming=false
29 | animation/remove_immutable_tracks=true
30 | import_script/path=""
31 | _subresources={}
32 | gltf/embedded_image_handling=1
33 |
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/entity/player/gun/pistol/assets/pistol_albedo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ReunMedia/gamedev-compass/4ace5b363ad175a37bf8ab0e5d38afd1b20a96c5/FPSInGodot4/scenes/entity/player/gun/pistol/assets/pistol_albedo.png
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/entity/player/gun/pistol/assets/pistol_albedo.png.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="CompressedTexture2D"
5 | uid="uid://bx8ij6m747op4"
6 | path.s3tc="res://.godot/imported/pistol_albedo.png-ea2f68b933c37b09e08b6715b320ff9e.s3tc.ctex"
7 | metadata={
8 | "imported_formats": ["s3tc_bptc"],
9 | "vram_texture": true
10 | }
11 |
12 | [deps]
13 |
14 | source_file="res://scenes/entity/player/gun/pistol/assets/pistol_albedo.png"
15 | dest_files=["res://.godot/imported/pistol_albedo.png-ea2f68b933c37b09e08b6715b320ff9e.s3tc.ctex"]
16 |
17 | [params]
18 |
19 | compress/mode=2
20 | compress/high_quality=false
21 | compress/lossy_quality=0.7
22 | compress/hdr_compression=1
23 | compress/normal_map=0
24 | compress/channel_pack=0
25 | mipmaps/generate=true
26 | mipmaps/limit=-1
27 | roughness/mode=0
28 | roughness/src_normal=""
29 | process/fix_alpha_border=true
30 | process/premult_alpha=false
31 | process/normal_map_invert_y=false
32 | process/hdr_as_srgb=false
33 | process/hdr_clamp_exposure=false
34 | process/size_limit=0
35 | detect_3d/compress_to=0
36 |
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/entity/player/gun/pistol/assets/pistol_icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ReunMedia/gamedev-compass/4ace5b363ad175a37bf8ab0e5d38afd1b20a96c5/FPSInGodot4/scenes/entity/player/gun/pistol/assets/pistol_icon.png
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/entity/player/gun/pistol/assets/pistol_icon.png.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="CompressedTexture2D"
5 | uid="uid://civcmkuh4l0yw"
6 | path="res://.godot/imported/pistol_icon.png-52fa5a709ee929eeaf2d17164c4c92ef.ctex"
7 | metadata={
8 | "vram_texture": false
9 | }
10 |
11 | [deps]
12 |
13 | source_file="res://scenes/entity/player/gun/pistol/assets/pistol_icon.png"
14 | dest_files=["res://.godot/imported/pistol_icon.png-52fa5a709ee929eeaf2d17164c4c92ef.ctex"]
15 |
16 | [params]
17 |
18 | compress/mode=0
19 | compress/high_quality=false
20 | compress/lossy_quality=0.7
21 | compress/hdr_compression=1
22 | compress/normal_map=0
23 | compress/channel_pack=0
24 | mipmaps/generate=false
25 | mipmaps/limit=-1
26 | roughness/mode=0
27 | roughness/src_normal=""
28 | process/fix_alpha_border=true
29 | process/premult_alpha=false
30 | process/normal_map_invert_y=false
31 | process/hdr_as_srgb=false
32 | process/hdr_clamp_exposure=false
33 | process/size_limit=0
34 | detect_3d/compress_to=0
35 |
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/entity/player/gun/pistol/assets/pistol_material.tres:
--------------------------------------------------------------------------------
1 | [gd_resource type="StandardMaterial3D" load_steps=4 format=3 uid="uid://2cww3hlfumc1"]
2 |
3 | [ext_resource type="Texture2D" uid="uid://bx8ij6m747op4" path="res://scenes/entity/player/gun/pistol/assets/pistol_albedo.png" id="1"]
4 | [ext_resource type="Texture2D" uid="uid://w0syywfwodcb" path="res://scenes/entity/player/gun/pistol/assets/pistol_orm.png" id="2"]
5 | [ext_resource type="Texture2D" uid="uid://bucqd6fwmuhcu" path="res://scenes/entity/player/gun/pistol/assets/pistol_normal.png" id="3"]
6 |
7 | [resource]
8 | albedo_texture = ExtResource("1")
9 | metallic = 1.0
10 | metallic_texture = ExtResource("2")
11 | metallic_texture_channel = 2
12 | roughness_texture = ExtResource("2")
13 | roughness_texture_channel = 1
14 | normal_enabled = true
15 | normal_texture = ExtResource("3")
16 | ao_enabled = true
17 | ao_light_affect = 1.0
18 | ao_texture = ExtResource("2")
19 |
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/entity/player/gun/pistol/assets/pistol_normal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ReunMedia/gamedev-compass/4ace5b363ad175a37bf8ab0e5d38afd1b20a96c5/FPSInGodot4/scenes/entity/player/gun/pistol/assets/pistol_normal.png
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/entity/player/gun/pistol/assets/pistol_normal.png.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="CompressedTexture2D"
5 | uid="uid://bucqd6fwmuhcu"
6 | path.s3tc="res://.godot/imported/pistol_normal.png-08b0069ff97c73525aed92a52372bd26.s3tc.ctex"
7 | metadata={
8 | "imported_formats": ["s3tc_bptc"],
9 | "vram_texture": true
10 | }
11 |
12 | [deps]
13 |
14 | source_file="res://scenes/entity/player/gun/pistol/assets/pistol_normal.png"
15 | dest_files=["res://.godot/imported/pistol_normal.png-08b0069ff97c73525aed92a52372bd26.s3tc.ctex"]
16 |
17 | [params]
18 |
19 | compress/mode=2
20 | compress/high_quality=false
21 | compress/lossy_quality=0.7
22 | compress/hdr_compression=1
23 | compress/normal_map=1
24 | compress/channel_pack=0
25 | mipmaps/generate=true
26 | mipmaps/limit=-1
27 | roughness/mode=1
28 | roughness/src_normal="res://scenes/entity/player/gun/pistol/assets/pistol_normal.png"
29 | process/fix_alpha_border=true
30 | process/premult_alpha=false
31 | process/normal_map_invert_y=false
32 | process/hdr_as_srgb=false
33 | process/hdr_clamp_exposure=false
34 | process/size_limit=0
35 | detect_3d/compress_to=0
36 |
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/entity/player/gun/pistol/assets/pistol_orm.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ReunMedia/gamedev-compass/4ace5b363ad175a37bf8ab0e5d38afd1b20a96c5/FPSInGodot4/scenes/entity/player/gun/pistol/assets/pistol_orm.png
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/entity/player/gun/pistol/assets/pistol_orm.png.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="CompressedTexture2D"
5 | uid="uid://w0syywfwodcb"
6 | path.s3tc="res://.godot/imported/pistol_orm.png-0014f6eb8ed847ad25ca37cf9b296d26.s3tc.ctex"
7 | metadata={
8 | "imported_formats": ["s3tc_bptc"],
9 | "vram_texture": true
10 | }
11 |
12 | [deps]
13 |
14 | source_file="res://scenes/entity/player/gun/pistol/assets/pistol_orm.png"
15 | dest_files=["res://.godot/imported/pistol_orm.png-0014f6eb8ed847ad25ca37cf9b296d26.s3tc.ctex"]
16 |
17 | [params]
18 |
19 | compress/mode=2
20 | compress/high_quality=false
21 | compress/lossy_quality=0.7
22 | compress/hdr_compression=1
23 | compress/normal_map=0
24 | compress/channel_pack=0
25 | mipmaps/generate=true
26 | mipmaps/limit=-1
27 | roughness/mode=8
28 | roughness/src_normal="res://scenes/entity/player/gun/pistol/assets/pistol_normal.png"
29 | process/fix_alpha_border=true
30 | process/premult_alpha=false
31 | process/normal_map_invert_y=false
32 | process/hdr_as_srgb=false
33 | process/hdr_clamp_exposure=false
34 | process/size_limit=0
35 | detect_3d/compress_to=0
36 |
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/entity/player/gun/pistol/pistol_model.tscn:
--------------------------------------------------------------------------------
1 | [gd_scene load_steps=3 format=3 uid="uid://bc8q6i6jkrr5g"]
2 |
3 | [ext_resource type="PackedScene" uid="uid://dlarvrv3lqfr8" path="res://scenes/entity/player/gun/pistol/assets/pistol.glb" id="1_pw0at"]
4 | [ext_resource type="Material" uid="uid://2cww3hlfumc1" path="res://scenes/entity/player/gun/pistol/assets/pistol_material.tres" id="2_istwc"]
5 |
6 | [node name="pistol" instance=ExtResource("1_pw0at")]
7 |
8 | [node name="Pistol" parent="." index="0"]
9 | layers = 2
10 | surface_material_override/0 = ExtResource("2_istwc")
11 | surface_material_override/1 = ExtResource("2_istwc")
12 |
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/entity/player/gun/rifle/assets/rifle.glb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ReunMedia/gamedev-compass/4ace5b363ad175a37bf8ab0e5d38afd1b20a96c5/FPSInGodot4/scenes/entity/player/gun/rifle/assets/rifle.glb
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/entity/player/gun/rifle/assets/rifle.glb.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="scene"
4 | importer_version=1
5 | type="PackedScene"
6 | uid="uid://bb7xpxfbv0e27"
7 | path="res://.godot/imported/rifle.glb-f898ea0fe2697e8701536dcbb047c229.scn"
8 |
9 | [deps]
10 |
11 | source_file="res://scenes/entity/player/gun/rifle/assets/rifle.glb"
12 | dest_files=["res://.godot/imported/rifle.glb-f898ea0fe2697e8701536dcbb047c229.scn"]
13 |
14 | [params]
15 |
16 | nodes/root_type="Node3D"
17 | nodes/root_name="Scene Root"
18 | nodes/apply_root_scale=true
19 | nodes/root_scale=1.0
20 | meshes/ensure_tangents=true
21 | meshes/generate_lods=true
22 | meshes/create_shadow_meshes=true
23 | meshes/light_baking=1
24 | meshes/lightmap_texel_size=0.2
25 | skins/use_named_skins=true
26 | animation/import=true
27 | animation/fps=30
28 | animation/trimming=false
29 | animation/remove_immutable_tracks=true
30 | import_script/path=""
31 | _subresources={}
32 | gltf/embedded_image_handling=1
33 |
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/entity/player/gun/rifle/assets/rifle.tres:
--------------------------------------------------------------------------------
1 | [gd_resource type="StandardMaterial3D" load_steps=4 format=3 uid="uid://cwr2ygcyjy2h4"]
2 |
3 | [ext_resource type="Texture2D" uid="uid://oipd421abs5w" path="res://scenes/entity/player/gun/rifle/assets/rifle_albedo.png" id="1"]
4 | [ext_resource type="Texture2D" uid="uid://12gm2chr8vvf" path="res://scenes/entity/player/gun/rifle/assets/rifle_orm.png" id="2"]
5 | [ext_resource type="Texture2D" uid="uid://b37gfb4wpawg" path="res://scenes/entity/player/gun/rifle/assets/rifle_normal.png" id="3"]
6 |
7 | [resource]
8 | albedo_texture = ExtResource("1")
9 | metallic = 1.0
10 | metallic_texture = ExtResource("2")
11 | metallic_texture_channel = 2
12 | roughness_texture = ExtResource("2")
13 | roughness_texture_channel = 1
14 | normal_enabled = true
15 | normal_texture = ExtResource("3")
16 | ao_enabled = true
17 | ao_light_affect = 1.0
18 | ao_texture = ExtResource("2")
19 |
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/entity/player/gun/rifle/assets/rifle_albedo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ReunMedia/gamedev-compass/4ace5b363ad175a37bf8ab0e5d38afd1b20a96c5/FPSInGodot4/scenes/entity/player/gun/rifle/assets/rifle_albedo.png
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/entity/player/gun/rifle/assets/rifle_albedo.png.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="CompressedTexture2D"
5 | uid="uid://oipd421abs5w"
6 | path.s3tc="res://.godot/imported/rifle_albedo.png-02a6a61d3154873a29ddaec226fd852c.s3tc.ctex"
7 | metadata={
8 | "imported_formats": ["s3tc_bptc"],
9 | "vram_texture": true
10 | }
11 |
12 | [deps]
13 |
14 | source_file="res://scenes/entity/player/gun/rifle/assets/rifle_albedo.png"
15 | dest_files=["res://.godot/imported/rifle_albedo.png-02a6a61d3154873a29ddaec226fd852c.s3tc.ctex"]
16 |
17 | [params]
18 |
19 | compress/mode=2
20 | compress/high_quality=false
21 | compress/lossy_quality=0.7
22 | compress/hdr_compression=1
23 | compress/normal_map=0
24 | compress/channel_pack=0
25 | mipmaps/generate=true
26 | mipmaps/limit=-1
27 | roughness/mode=0
28 | roughness/src_normal=""
29 | process/fix_alpha_border=true
30 | process/premult_alpha=false
31 | process/normal_map_invert_y=false
32 | process/hdr_as_srgb=false
33 | process/hdr_clamp_exposure=false
34 | process/size_limit=0
35 | detect_3d/compress_to=0
36 |
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/entity/player/gun/rifle/assets/rifle_icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ReunMedia/gamedev-compass/4ace5b363ad175a37bf8ab0e5d38afd1b20a96c5/FPSInGodot4/scenes/entity/player/gun/rifle/assets/rifle_icon.png
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/entity/player/gun/rifle/assets/rifle_icon.png.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="CompressedTexture2D"
5 | uid="uid://n2ageufudyrj"
6 | path="res://.godot/imported/rifle_icon.png-22616497b99e241c55961c48faabfd4c.ctex"
7 | metadata={
8 | "vram_texture": false
9 | }
10 |
11 | [deps]
12 |
13 | source_file="res://scenes/entity/player/gun/rifle/assets/rifle_icon.png"
14 | dest_files=["res://.godot/imported/rifle_icon.png-22616497b99e241c55961c48faabfd4c.ctex"]
15 |
16 | [params]
17 |
18 | compress/mode=0
19 | compress/high_quality=false
20 | compress/lossy_quality=0.7
21 | compress/hdr_compression=1
22 | compress/normal_map=0
23 | compress/channel_pack=0
24 | mipmaps/generate=false
25 | mipmaps/limit=-1
26 | roughness/mode=0
27 | roughness/src_normal=""
28 | process/fix_alpha_border=true
29 | process/premult_alpha=false
30 | process/normal_map_invert_y=false
31 | process/hdr_as_srgb=false
32 | process/hdr_clamp_exposure=false
33 | process/size_limit=0
34 | detect_3d/compress_to=0
35 |
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/entity/player/gun/rifle/assets/rifle_normal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ReunMedia/gamedev-compass/4ace5b363ad175a37bf8ab0e5d38afd1b20a96c5/FPSInGodot4/scenes/entity/player/gun/rifle/assets/rifle_normal.png
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/entity/player/gun/rifle/assets/rifle_normal.png.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="CompressedTexture2D"
5 | uid="uid://b37gfb4wpawg"
6 | path.s3tc="res://.godot/imported/rifle_normal.png-d0364b7918dd997e50ba60c9cb2def40.s3tc.ctex"
7 | metadata={
8 | "imported_formats": ["s3tc_bptc"],
9 | "vram_texture": true
10 | }
11 |
12 | [deps]
13 |
14 | source_file="res://scenes/entity/player/gun/rifle/assets/rifle_normal.png"
15 | dest_files=["res://.godot/imported/rifle_normal.png-d0364b7918dd997e50ba60c9cb2def40.s3tc.ctex"]
16 |
17 | [params]
18 |
19 | compress/mode=2
20 | compress/high_quality=false
21 | compress/lossy_quality=0.7
22 | compress/hdr_compression=1
23 | compress/normal_map=1
24 | compress/channel_pack=0
25 | mipmaps/generate=true
26 | mipmaps/limit=-1
27 | roughness/mode=1
28 | roughness/src_normal="res://scenes/entity/player/gun/rifle/assets/rifle_normal.png"
29 | process/fix_alpha_border=true
30 | process/premult_alpha=false
31 | process/normal_map_invert_y=false
32 | process/hdr_as_srgb=false
33 | process/hdr_clamp_exposure=false
34 | process/size_limit=0
35 | detect_3d/compress_to=0
36 |
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/entity/player/gun/rifle/assets/rifle_orm.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ReunMedia/gamedev-compass/4ace5b363ad175a37bf8ab0e5d38afd1b20a96c5/FPSInGodot4/scenes/entity/player/gun/rifle/assets/rifle_orm.png
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/entity/player/gun/rifle/assets/rifle_orm.png.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="CompressedTexture2D"
5 | uid="uid://12gm2chr8vvf"
6 | path.s3tc="res://.godot/imported/rifle_orm.png-15c90bbc9d6e9c685ece05d2127b26fa.s3tc.ctex"
7 | metadata={
8 | "imported_formats": ["s3tc_bptc"],
9 | "vram_texture": true
10 | }
11 |
12 | [deps]
13 |
14 | source_file="res://scenes/entity/player/gun/rifle/assets/rifle_orm.png"
15 | dest_files=["res://.godot/imported/rifle_orm.png-15c90bbc9d6e9c685ece05d2127b26fa.s3tc.ctex"]
16 |
17 | [params]
18 |
19 | compress/mode=2
20 | compress/high_quality=false
21 | compress/lossy_quality=0.7
22 | compress/hdr_compression=1
23 | compress/normal_map=0
24 | compress/channel_pack=0
25 | mipmaps/generate=true
26 | mipmaps/limit=-1
27 | roughness/mode=8
28 | roughness/src_normal="res://scenes/entity/player/gun/rifle/assets/rifle_normal.png"
29 | process/fix_alpha_border=true
30 | process/premult_alpha=false
31 | process/normal_map_invert_y=false
32 | process/hdr_as_srgb=false
33 | process/hdr_clamp_exposure=false
34 | process/size_limit=0
35 | detect_3d/compress_to=0
36 |
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/entity/player/gun/rifle/rifle_model.tscn:
--------------------------------------------------------------------------------
1 | [gd_scene load_steps=3 format=3 uid="uid://uu63qv1dxp4y"]
2 |
3 | [ext_resource type="PackedScene" uid="uid://bb7xpxfbv0e27" path="res://scenes/entity/player/gun/rifle/assets/rifle.glb" id="1_j0iid"]
4 | [ext_resource type="Material" uid="uid://cwr2ygcyjy2h4" path="res://scenes/entity/player/gun/rifle/assets/rifle.tres" id="2_bi3uy"]
5 |
6 | [node name="rifle" instance=ExtResource("1_j0iid")]
7 |
8 | [node name="Rifle" parent="." index="0"]
9 | layers = 2
10 | surface_material_override/0 = ExtResource("2_bi3uy")
11 | surface_material_override/1 = ExtResource("2_bi3uy")
12 |
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/entity/player/player_guns.gd:
--------------------------------------------------------------------------------
1 | extends Node3D
2 |
3 | signal gun_changed(value: Gun)
4 |
5 | @onready var bullets: Node3D = $"../Bullets"
6 |
7 | var current_gun: Gun
8 |
9 | func _ready() -> void:
10 | current_gun = get_child(0)
11 | equip_gun.call_deferred(0)
12 |
13 | func _process(_delta: float) -> void:
14 | # Fire input is in process to enable repeat firing when holding the button
15 | if Input.is_action_pressed("fire"):
16 | current_gun.fire()
17 |
18 | func _unhandled_input(event: InputEvent) -> void:
19 | # Weapon cycling
20 | if event.is_action_pressed("weapon_next"):
21 | equip_gun(current_gun.get_index() + 1)
22 | elif event.is_action_pressed("weapon_previous"):
23 | equip_gun(current_gun.get_index() - 1)
24 |
25 | func equip_gun(index: int) -> void:
26 | for node in get_children():
27 | node.visible = false
28 | # Wrap the value to repeat the order and avoid invalid indexes
29 | current_gun = get_child(wrapi(index, 0, get_child_count()))
30 | current_gun.visible = true
31 | gun_changed.emit(current_gun)
32 |
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/game/game.gd:
--------------------------------------------------------------------------------
1 | extends Node3D
2 |
3 | signal score_changed(value)
4 |
5 | const GAME_OVER_TIME = 10.0
6 |
7 | @onready var player: Player = $Player
8 | @onready var hud: Control = $HUD
9 | @onready var enemy_spawner: Node3D = $Enemy/EnemySpawner
10 | @onready var game_over_screen: Control = $GameOver
11 | @onready var game_over_text: Label = $GameOver/Text
12 | @onready var bg: ColorRect = $GameOver/BG
13 |
14 | var score : int:
15 | set(value):
16 | score = value
17 | score_changed.emit(score)
18 |
19 | func _ready() -> void:
20 | player.guns.gun_changed.connect(hud.update_gun)
21 | player.health_changed.connect(hud.update_health)
22 | player.death.connect(game_over)
23 | score_changed.connect(hud.update_score)
24 | enemy_spawner.player = player
25 | enemy_spawner.enemy_spawned.connect(enemy_spawned)
26 | game_over_screen.visible = false
27 |
28 | func enemy_spawned(enemy: Enemy) -> void:
29 | enemy.destroyed.connect(func(value): score += value)
30 |
31 | func game_over() -> void:
32 | game_over_screen.visible = true
33 | hud.visible = false
34 | game_over_text.text += str(score)
35 | var tween = get_tree().create_tween()
36 | tween.tween_property(bg, "color:a", 1.0, GAME_OVER_TIME)
37 | tween.set_pause_mode(Tween.TWEEN_PAUSE_PROCESS)
38 | get_tree().paused = true
39 | await get_tree().create_timer(GAME_OVER_TIME).timeout
40 | get_tree().paused = false
41 | get_tree().reload_current_scene()
42 |
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/game/hud/assets/bullet.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 |
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/game/hud/assets/bullet.svg.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="CompressedTexture2D"
5 | uid="uid://b4horxilt8oln"
6 | path="res://.godot/imported/bullet.svg-0b3d10f83097cd46a2daf6c91e153bdd.ctex"
7 | metadata={
8 | "vram_texture": false
9 | }
10 |
11 | [deps]
12 |
13 | source_file="res://scenes/game/hud/assets/bullet.svg"
14 | dest_files=["res://.godot/imported/bullet.svg-0b3d10f83097cd46a2daf6c91e153bdd.ctex"]
15 |
16 | [params]
17 |
18 | compress/mode=0
19 | compress/high_quality=false
20 | compress/lossy_quality=0.7
21 | compress/hdr_compression=1
22 | compress/normal_map=0
23 | compress/channel_pack=0
24 | mipmaps/generate=false
25 | mipmaps/limit=-1
26 | roughness/mode=0
27 | roughness/src_normal=""
28 | process/fix_alpha_border=true
29 | process/premult_alpha=false
30 | process/normal_map_invert_y=false
31 | process/hdr_as_srgb=false
32 | process/hdr_clamp_exposure=false
33 | process/size_limit=0
34 | detect_3d/compress_to=1
35 | svg/scale=1.0
36 | editor/scale_with_editor_scale=false
37 | editor/convert_colors_with_editor_theme=false
38 |
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/game/hud/assets/crosshair.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
23 |
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/game/hud/assets/crosshair.svg.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="CompressedTexture2D"
5 | uid="uid://bfl4joy0fdlja"
6 | path="res://.godot/imported/crosshair.svg-8d4379e17d1480814df34c2b7af42bfc.ctex"
7 | metadata={
8 | "vram_texture": false
9 | }
10 |
11 | [deps]
12 |
13 | source_file="res://scenes/game/hud/assets/crosshair.svg"
14 | dest_files=["res://.godot/imported/crosshair.svg-8d4379e17d1480814df34c2b7af42bfc.ctex"]
15 |
16 | [params]
17 |
18 | compress/mode=0
19 | compress/high_quality=false
20 | compress/lossy_quality=0.7
21 | compress/hdr_compression=1
22 | compress/normal_map=0
23 | compress/channel_pack=0
24 | mipmaps/generate=false
25 | mipmaps/limit=-1
26 | roughness/mode=0
27 | roughness/src_normal=""
28 | process/fix_alpha_border=true
29 | process/premult_alpha=false
30 | process/normal_map_invert_y=false
31 | process/hdr_as_srgb=false
32 | process/hdr_clamp_exposure=false
33 | process/size_limit=0
34 | detect_3d/compress_to=1
35 | svg/scale=2.0
36 | editor/scale_with_editor_scale=false
37 | editor/convert_colors_with_editor_theme=false
38 |
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/game/hud/hud.gd:
--------------------------------------------------------------------------------
1 | extends Control
2 |
3 | var current_gun: Gun
4 |
5 | func update_gun_info(ammo: int) -> void:
6 | if current_gun:
7 | $GunInfo/Name.text = current_gun.display_name
8 | if current_gun.gun_icon:
9 | $GunInfo/Icon.texture = current_gun.gun_icon
10 | else:
11 | $GunInfo/Icon.texture = null
12 | $GunInfo/AmmoBox/Ammo.text = str(ammo)
13 |
14 | func update_gun(value: Gun) -> void:
15 | if current_gun and current_gun.ammo_changed.is_connected(update_gun_info):
16 | current_gun.ammo_changed.disconnect(update_gun_info)
17 | current_gun = value
18 | $GunInfo/AmmoBox.visible = current_gun.use_ammo
19 | current_gun.ammo_changed.connect(update_gun_info)
20 | update_gun_info(current_gun.ammo)
21 |
22 | func update_health(value: float) -> void:
23 | $Health/HealthBar.value = value
24 |
25 | func update_score(value: int) -> void:
26 | $Score/Amount.text = str(value)
27 |
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/game/hud/hud_theme.tres:
--------------------------------------------------------------------------------
1 | [gd_resource type="Theme" load_steps=5 format=3 uid="uid://xm8frptocv3o"]
2 |
3 | [ext_resource type="FontFile" uid="uid://d35d868jbn6cx" path="res://assets/Heebo-Medium.ttf" id="1_5tki3"]
4 |
5 | [sub_resource type="StyleBoxFlat" id="StyleBoxFlat_6d5u1"]
6 | bg_color = Color(0, 0, 0, 0.501961)
7 | skew = Vector2(0.25, 0)
8 |
9 | [sub_resource type="StyleBoxFlat" id="StyleBoxFlat_q3380"]
10 | bg_color = Color(1, 1, 1, 1)
11 | skew = Vector2(0.25, 0)
12 |
13 | [sub_resource type="FontVariation" id="FontVariation_oqnog"]
14 | base_font = ExtResource("1_5tki3")
15 | spacing_top = -5
16 | spacing_bottom = -10
17 |
18 | [resource]
19 | default_font = SubResource("FontVariation_oqnog")
20 | default_font_size = 24
21 | ProgressBar/styles/background = SubResource("StyleBoxFlat_6d5u1")
22 | ProgressBar/styles/fill = SubResource("StyleBoxFlat_q3380")
23 |
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/game/level/assets/concrete.tres:
--------------------------------------------------------------------------------
1 | [gd_resource type="StandardMaterial3D" load_steps=3 format=3 uid="uid://c7m4dund6n2ph"]
2 |
3 | [ext_resource type="Texture2D" uid="uid://cwnhj0s4si3kd" path="res://scenes/game/level/assets/concrete_albedo.png" id="1"]
4 | [ext_resource type="Texture2D" uid="uid://cdhehjy484abl" path="res://scenes/game/level/assets/concrete_normal.png" id="3"]
5 |
6 | [resource]
7 | albedo_texture = ExtResource("1")
8 | normal_enabled = true
9 | normal_texture = ExtResource("3")
10 | texture_filter = 4
11 |
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/game/level/assets/concrete_albedo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ReunMedia/gamedev-compass/4ace5b363ad175a37bf8ab0e5d38afd1b20a96c5/FPSInGodot4/scenes/game/level/assets/concrete_albedo.png
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/game/level/assets/concrete_albedo.png.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="CompressedTexture2D"
5 | uid="uid://cwnhj0s4si3kd"
6 | path="res://.godot/imported/concrete_albedo.png-1ee84b431bdef06810afc07d87dcab09.ctex"
7 | metadata={
8 | "vram_texture": false
9 | }
10 |
11 | [deps]
12 |
13 | source_file="res://scenes/game/level/assets/concrete_albedo.png"
14 | dest_files=["res://.godot/imported/concrete_albedo.png-1ee84b431bdef06810afc07d87dcab09.ctex"]
15 |
16 | [params]
17 |
18 | compress/mode=0
19 | compress/high_quality=false
20 | compress/lossy_quality=0.7
21 | compress/hdr_compression=1
22 | compress/normal_map=0
23 | compress/channel_pack=0
24 | mipmaps/generate=true
25 | mipmaps/limit=-1
26 | roughness/mode=0
27 | roughness/src_normal=""
28 | process/fix_alpha_border=true
29 | process/premult_alpha=false
30 | process/normal_map_invert_y=false
31 | process/hdr_as_srgb=false
32 | process/hdr_clamp_exposure=false
33 | process/size_limit=0
34 | detect_3d/compress_to=0
35 |
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/game/level/assets/concrete_normal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ReunMedia/gamedev-compass/4ace5b363ad175a37bf8ab0e5d38afd1b20a96c5/FPSInGodot4/scenes/game/level/assets/concrete_normal.png
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/game/level/assets/concrete_normal.png.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="CompressedTexture2D"
5 | uid="uid://cdhehjy484abl"
6 | path="res://.godot/imported/concrete_normal.png-7401993c99397c40a5361b845f96b498.ctex"
7 | metadata={
8 | "vram_texture": false
9 | }
10 |
11 | [deps]
12 |
13 | source_file="res://scenes/game/level/assets/concrete_normal.png"
14 | dest_files=["res://.godot/imported/concrete_normal.png-7401993c99397c40a5361b845f96b498.ctex"]
15 |
16 | [params]
17 |
18 | compress/mode=0
19 | compress/high_quality=false
20 | compress/lossy_quality=0.7
21 | compress/hdr_compression=1
22 | compress/normal_map=1
23 | compress/channel_pack=0
24 | mipmaps/generate=true
25 | mipmaps/limit=-1
26 | roughness/mode=1
27 | roughness/src_normal="res://scenes/game/level/assets/concrete_normal.png"
28 | process/fix_alpha_border=true
29 | process/premult_alpha=false
30 | process/normal_map_invert_y=false
31 | process/hdr_as_srgb=false
32 | process/hdr_clamp_exposure=false
33 | process/size_limit=0
34 | detect_3d/compress_to=0
35 |
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/game/level/assets/concrete_tiles.tres:
--------------------------------------------------------------------------------
1 | [gd_resource type="StandardMaterial3D" load_steps=5 format=3 uid="uid://cwi4446xnjcgm"]
2 |
3 | [ext_resource type="Texture2D" uid="uid://c0v2xcpxunxhu" path="res://scenes/game/level/assets/concrete_tiles_albedo.png" id="1"]
4 | [ext_resource type="Texture2D" uid="uid://dr7jqiy321hf8" path="res://scenes/game/level/assets/concrete_tiles_orm.png" id="2"]
5 | [ext_resource type="Texture2D" uid="uid://bftdn8xm1wwhl" path="res://scenes/game/level/assets/concrete_tiles_normal.png" id="3"]
6 | [ext_resource type="Texture2D" uid="uid://bicnowlow2cf6" path="res://scenes/game/level/assets/concrete_tiles_heightmap.png" id="3_v8mr2"]
7 |
8 | [resource]
9 | albedo_texture = ExtResource("1")
10 | roughness_texture = ExtResource("2")
11 | roughness_texture_channel = 1
12 | normal_enabled = true
13 | normal_texture = ExtResource("3")
14 | ao_enabled = true
15 | ao_texture = ExtResource("2")
16 | heightmap_enabled = true
17 | heightmap_scale = 2.0
18 | heightmap_deep_parallax = true
19 | heightmap_min_layers = 8
20 | heightmap_max_layers = 32
21 | heightmap_texture = ExtResource("3_v8mr2")
22 | texture_filter = 4
23 |
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/game/level/assets/concrete_tiles_albedo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ReunMedia/gamedev-compass/4ace5b363ad175a37bf8ab0e5d38afd1b20a96c5/FPSInGodot4/scenes/game/level/assets/concrete_tiles_albedo.png
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/game/level/assets/concrete_tiles_albedo.png.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="CompressedTexture2D"
5 | uid="uid://c0v2xcpxunxhu"
6 | path="res://.godot/imported/concrete_tiles_albedo.png-3a078573d852915cd190d615e3ecd796.ctex"
7 | metadata={
8 | "vram_texture": false
9 | }
10 |
11 | [deps]
12 |
13 | source_file="res://scenes/game/level/assets/concrete_tiles_albedo.png"
14 | dest_files=["res://.godot/imported/concrete_tiles_albedo.png-3a078573d852915cd190d615e3ecd796.ctex"]
15 |
16 | [params]
17 |
18 | compress/mode=0
19 | compress/high_quality=false
20 | compress/lossy_quality=0.7
21 | compress/hdr_compression=1
22 | compress/normal_map=0
23 | compress/channel_pack=0
24 | mipmaps/generate=true
25 | mipmaps/limit=-1
26 | roughness/mode=0
27 | roughness/src_normal=""
28 | process/fix_alpha_border=true
29 | process/premult_alpha=false
30 | process/normal_map_invert_y=false
31 | process/hdr_as_srgb=false
32 | process/hdr_clamp_exposure=false
33 | process/size_limit=0
34 | detect_3d/compress_to=0
35 |
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/game/level/assets/concrete_tiles_heightmap.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ReunMedia/gamedev-compass/4ace5b363ad175a37bf8ab0e5d38afd1b20a96c5/FPSInGodot4/scenes/game/level/assets/concrete_tiles_heightmap.png
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/game/level/assets/concrete_tiles_heightmap.png.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="CompressedTexture2D"
5 | uid="uid://bicnowlow2cf6"
6 | path.s3tc="res://.godot/imported/concrete_tiles_heightmap.png-8d7c2b02d86de860a5038a807c6428e9.s3tc.ctex"
7 | metadata={
8 | "imported_formats": ["s3tc_bptc"],
9 | "vram_texture": true
10 | }
11 |
12 | [deps]
13 |
14 | source_file="res://scenes/game/level/assets/concrete_tiles_heightmap.png"
15 | dest_files=["res://.godot/imported/concrete_tiles_heightmap.png-8d7c2b02d86de860a5038a807c6428e9.s3tc.ctex"]
16 |
17 | [params]
18 |
19 | compress/mode=2
20 | compress/high_quality=false
21 | compress/lossy_quality=0.7
22 | compress/hdr_compression=1
23 | compress/normal_map=0
24 | compress/channel_pack=0
25 | mipmaps/generate=true
26 | mipmaps/limit=-1
27 | roughness/mode=0
28 | roughness/src_normal=""
29 | process/fix_alpha_border=true
30 | process/premult_alpha=false
31 | process/normal_map_invert_y=false
32 | process/hdr_as_srgb=false
33 | process/hdr_clamp_exposure=false
34 | process/size_limit=0
35 | detect_3d/compress_to=0
36 |
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/game/level/assets/concrete_tiles_normal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ReunMedia/gamedev-compass/4ace5b363ad175a37bf8ab0e5d38afd1b20a96c5/FPSInGodot4/scenes/game/level/assets/concrete_tiles_normal.png
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/game/level/assets/concrete_tiles_normal.png.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="CompressedTexture2D"
5 | uid="uid://bftdn8xm1wwhl"
6 | path="res://.godot/imported/concrete_tiles_normal.png-6c718a8a15cdeae1401d2fc9d3d21193.ctex"
7 | metadata={
8 | "vram_texture": false
9 | }
10 |
11 | [deps]
12 |
13 | source_file="res://scenes/game/level/assets/concrete_tiles_normal.png"
14 | dest_files=["res://.godot/imported/concrete_tiles_normal.png-6c718a8a15cdeae1401d2fc9d3d21193.ctex"]
15 |
16 | [params]
17 |
18 | compress/mode=0
19 | compress/high_quality=false
20 | compress/lossy_quality=0.7
21 | compress/hdr_compression=1
22 | compress/normal_map=1
23 | compress/channel_pack=0
24 | mipmaps/generate=true
25 | mipmaps/limit=-1
26 | roughness/mode=1
27 | roughness/src_normal="res://scenes/game/level/assets/concrete_tiles_normal.png"
28 | process/fix_alpha_border=true
29 | process/premult_alpha=false
30 | process/normal_map_invert_y=false
31 | process/hdr_as_srgb=false
32 | process/hdr_clamp_exposure=false
33 | process/size_limit=0
34 | detect_3d/compress_to=0
35 |
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/game/level/assets/concrete_tiles_orm.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ReunMedia/gamedev-compass/4ace5b363ad175a37bf8ab0e5d38afd1b20a96c5/FPSInGodot4/scenes/game/level/assets/concrete_tiles_orm.png
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/game/level/assets/concrete_tiles_orm.png.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="CompressedTexture2D"
5 | uid="uid://dr7jqiy321hf8"
6 | path="res://.godot/imported/concrete_tiles_orm.png-e3e87422a9062724133772af7a1781d3.ctex"
7 | metadata={
8 | "vram_texture": false
9 | }
10 |
11 | [deps]
12 |
13 | source_file="res://scenes/game/level/assets/concrete_tiles_orm.png"
14 | dest_files=["res://.godot/imported/concrete_tiles_orm.png-e3e87422a9062724133772af7a1781d3.ctex"]
15 |
16 | [params]
17 |
18 | compress/mode=0
19 | compress/high_quality=false
20 | compress/lossy_quality=0.7
21 | compress/hdr_compression=1
22 | compress/normal_map=0
23 | compress/channel_pack=0
24 | mipmaps/generate=true
25 | mipmaps/limit=-1
26 | roughness/mode=0
27 | roughness/src_normal=""
28 | process/fix_alpha_border=true
29 | process/premult_alpha=false
30 | process/normal_map_invert_y=false
31 | process/hdr_as_srgb=false
32 | process/hdr_clamp_exposure=false
33 | process/size_limit=0
34 | detect_3d/compress_to=0
35 |
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/game/level/assets/level.glb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ReunMedia/gamedev-compass/4ace5b363ad175a37bf8ab0e5d38afd1b20a96c5/FPSInGodot4/scenes/game/level/assets/level.glb
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/game/level/assets/level.glb.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="scene"
4 | importer_version=1
5 | type="PackedScene"
6 | uid="uid://d3uvc0yshrs6c"
7 | path="res://.godot/imported/level.glb-9341b8155a06012a1c7ac8eff89ddbe1.scn"
8 |
9 | [deps]
10 |
11 | source_file="res://scenes/game/level/assets/level.glb"
12 | dest_files=["res://.godot/imported/level.glb-9341b8155a06012a1c7ac8eff89ddbe1.scn"]
13 |
14 | [params]
15 |
16 | nodes/root_type="Node3D"
17 | nodes/root_name="Scene Root"
18 | nodes/apply_root_scale=true
19 | nodes/root_scale=1.0
20 | meshes/ensure_tangents=true
21 | meshes/generate_lods=true
22 | meshes/create_shadow_meshes=true
23 | meshes/light_baking=1
24 | meshes/lightmap_texel_size=0.2
25 | skins/use_named_skins=true
26 | animation/import=true
27 | animation/fps=30
28 | animation/trimming=false
29 | animation/remove_immutable_tracks=true
30 | import_script/path=""
31 | _subresources={
32 | "materials": {
33 | "@MATERIAL:0": {
34 | "use_external/path": "res://scenes/game/level/assets/concrete.tres"
35 | },
36 | "@MATERIAL:1": {
37 | "use_external/path": "res://scenes/game/level/assets/concrete_tiles.tres"
38 | },
39 | "@MATERIAL:2": {
40 | "use_external/path": "res://scenes/game/level/assets/metal_grate.tres"
41 | }
42 | },
43 | "meshes": {
44 | "level_Grate": {
45 | "generate/lightmap_uv": 1,
46 | "generate/lods": 0,
47 | "generate/shadow_meshes": 0,
48 | "lods/normal_merge_angle": 60.0,
49 | "lods/normal_split_angle": 25.0,
50 | "save_to_file/enabled": false,
51 | "save_to_file/make_streamable": "",
52 | "save_to_file/path": ""
53 | },
54 | "level_LevelBase": {
55 | "generate/lightmap_uv": 1,
56 | "generate/lods": 0,
57 | "generate/shadow_meshes": 1,
58 | "lods/normal_merge_angle": 60.0,
59 | "lods/normal_split_angle": 25.0,
60 | "save_to_file/enabled": false,
61 | "save_to_file/make_streamable": "",
62 | "save_to_file/path": ""
63 | }
64 | }
65 | }
66 | gltf/embedded_image_handling=1
67 |
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/game/level/assets/level.glb.unwrap_cache:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ReunMedia/gamedev-compass/4ace5b363ad175a37bf8ab0e5d38afd1b20a96c5/FPSInGodot4/scenes/game/level/assets/level.glb.unwrap_cache
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/game/level/assets/metal_grate.tres:
--------------------------------------------------------------------------------
1 | [gd_resource type="StandardMaterial3D" load_steps=5 format=3 uid="uid://f55wf3rj8b06"]
2 |
3 | [ext_resource type="Texture2D" uid="uid://cashgxqaeeqqc" path="res://scenes/game/level/assets/metal_grate_albedo.png" id="1"]
4 | [ext_resource type="Texture2D" uid="uid://bm5t45hg5o7kk" path="res://scenes/game/level/assets/metal_grate_orm.png" id="2"]
5 | [ext_resource type="Texture2D" uid="uid://bj0j0vupqwkxe" path="res://scenes/game/level/assets/metal_grate_normal.png" id="3"]
6 | [ext_resource type="Texture2D" uid="uid://dapdpyx4v7tcl" path="res://scenes/game/level/assets/metal_grate_heightmap.png" id="3_teexr"]
7 |
8 | [resource]
9 | transparency = 2
10 | alpha_scissor_threshold = 0.5
11 | alpha_antialiasing_mode = 0
12 | cull_mode = 2
13 | albedo_texture = ExtResource("1")
14 | metallic = 1.0
15 | roughness_texture = ExtResource("2")
16 | roughness_texture_channel = 1
17 | normal_enabled = true
18 | normal_texture = ExtResource("3")
19 | ao_enabled = true
20 | ao_texture = ExtResource("2")
21 | heightmap_enabled = true
22 | heightmap_scale = 2.0
23 | heightmap_deep_parallax = true
24 | heightmap_min_layers = 8
25 | heightmap_max_layers = 32
26 | heightmap_texture = ExtResource("3_teexr")
27 | texture_filter = 4
28 |
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/game/level/assets/metal_grate_albedo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ReunMedia/gamedev-compass/4ace5b363ad175a37bf8ab0e5d38afd1b20a96c5/FPSInGodot4/scenes/game/level/assets/metal_grate_albedo.png
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/game/level/assets/metal_grate_albedo.png.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="CompressedTexture2D"
5 | uid="uid://cashgxqaeeqqc"
6 | path="res://.godot/imported/metal_grate_albedo.png-20eb0b303fd68c0d9ec5b253bda905e8.ctex"
7 | metadata={
8 | "vram_texture": false
9 | }
10 |
11 | [deps]
12 |
13 | source_file="res://scenes/game/level/assets/metal_grate_albedo.png"
14 | dest_files=["res://.godot/imported/metal_grate_albedo.png-20eb0b303fd68c0d9ec5b253bda905e8.ctex"]
15 |
16 | [params]
17 |
18 | compress/mode=0
19 | compress/high_quality=false
20 | compress/lossy_quality=0.7
21 | compress/hdr_compression=1
22 | compress/normal_map=0
23 | compress/channel_pack=0
24 | mipmaps/generate=true
25 | mipmaps/limit=-1
26 | roughness/mode=0
27 | roughness/src_normal=""
28 | process/fix_alpha_border=true
29 | process/premult_alpha=false
30 | process/normal_map_invert_y=false
31 | process/hdr_as_srgb=false
32 | process/hdr_clamp_exposure=false
33 | process/size_limit=0
34 | detect_3d/compress_to=0
35 |
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/game/level/assets/metal_grate_heightmap.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ReunMedia/gamedev-compass/4ace5b363ad175a37bf8ab0e5d38afd1b20a96c5/FPSInGodot4/scenes/game/level/assets/metal_grate_heightmap.png
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/game/level/assets/metal_grate_heightmap.png.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="CompressedTexture2D"
5 | uid="uid://dapdpyx4v7tcl"
6 | path.s3tc="res://.godot/imported/metal_grate_heightmap.png-72cac30b336f072c5944068ef96a7791.s3tc.ctex"
7 | metadata={
8 | "imported_formats": ["s3tc_bptc"],
9 | "vram_texture": true
10 | }
11 |
12 | [deps]
13 |
14 | source_file="res://scenes/game/level/assets/metal_grate_heightmap.png"
15 | dest_files=["res://.godot/imported/metal_grate_heightmap.png-72cac30b336f072c5944068ef96a7791.s3tc.ctex"]
16 |
17 | [params]
18 |
19 | compress/mode=2
20 | compress/high_quality=false
21 | compress/lossy_quality=0.7
22 | compress/hdr_compression=1
23 | compress/normal_map=0
24 | compress/channel_pack=0
25 | mipmaps/generate=true
26 | mipmaps/limit=-1
27 | roughness/mode=0
28 | roughness/src_normal=""
29 | process/fix_alpha_border=true
30 | process/premult_alpha=false
31 | process/normal_map_invert_y=false
32 | process/hdr_as_srgb=false
33 | process/hdr_clamp_exposure=false
34 | process/size_limit=0
35 | detect_3d/compress_to=0
36 |
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/game/level/assets/metal_grate_normal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ReunMedia/gamedev-compass/4ace5b363ad175a37bf8ab0e5d38afd1b20a96c5/FPSInGodot4/scenes/game/level/assets/metal_grate_normal.png
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/game/level/assets/metal_grate_normal.png.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="CompressedTexture2D"
5 | uid="uid://bj0j0vupqwkxe"
6 | path="res://.godot/imported/metal_grate_normal.png-5bb7731c688b414f98e7455a2be1044f.ctex"
7 | metadata={
8 | "vram_texture": false
9 | }
10 |
11 | [deps]
12 |
13 | source_file="res://scenes/game/level/assets/metal_grate_normal.png"
14 | dest_files=["res://.godot/imported/metal_grate_normal.png-5bb7731c688b414f98e7455a2be1044f.ctex"]
15 |
16 | [params]
17 |
18 | compress/mode=0
19 | compress/high_quality=false
20 | compress/lossy_quality=0.7
21 | compress/hdr_compression=1
22 | compress/normal_map=1
23 | compress/channel_pack=0
24 | mipmaps/generate=true
25 | mipmaps/limit=-1
26 | roughness/mode=1
27 | roughness/src_normal="res://scenes/game/level/assets/metal_grate_normal.png"
28 | process/fix_alpha_border=true
29 | process/premult_alpha=false
30 | process/normal_map_invert_y=false
31 | process/hdr_as_srgb=false
32 | process/hdr_clamp_exposure=false
33 | process/size_limit=0
34 | detect_3d/compress_to=0
35 |
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/game/level/assets/metal_grate_orm.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ReunMedia/gamedev-compass/4ace5b363ad175a37bf8ab0e5d38afd1b20a96c5/FPSInGodot4/scenes/game/level/assets/metal_grate_orm.png
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/game/level/assets/metal_grate_orm.png.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="CompressedTexture2D"
5 | uid="uid://bm5t45hg5o7kk"
6 | path="res://.godot/imported/metal_grate_orm.png-0d672d13fa14d4fc9a21696a9c7253d0.ctex"
7 | metadata={
8 | "vram_texture": false
9 | }
10 |
11 | [deps]
12 |
13 | source_file="res://scenes/game/level/assets/metal_grate_orm.png"
14 | dest_files=["res://.godot/imported/metal_grate_orm.png-0d672d13fa14d4fc9a21696a9c7253d0.ctex"]
15 |
16 | [params]
17 |
18 | compress/mode=0
19 | compress/high_quality=false
20 | compress/lossy_quality=0.7
21 | compress/hdr_compression=1
22 | compress/normal_map=0
23 | compress/channel_pack=0
24 | mipmaps/generate=true
25 | mipmaps/limit=-1
26 | roughness/mode=0
27 | roughness/src_normal=""
28 | process/fix_alpha_border=true
29 | process/premult_alpha=false
30 | process/normal_map_invert_y=false
31 | process/hdr_as_srgb=false
32 | process/hdr_clamp_exposure=false
33 | process/size_limit=0
34 | detect_3d/compress_to=0
35 |
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/game/level/assets/sky.exr:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ReunMedia/gamedev-compass/4ace5b363ad175a37bf8ab0e5d38afd1b20a96c5/FPSInGodot4/scenes/game/level/assets/sky.exr
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/game/level/assets/sky.exr.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="CompressedTexture2D"
5 | uid="uid://sngnai57t42v"
6 | path.bptc="res://.godot/imported/sky.exr-c9c1d35911e5bf2af1a9acfe897517b3.bptc.ctex"
7 | metadata={
8 | "imported_formats": ["s3tc_bptc"],
9 | "vram_texture": true
10 | }
11 |
12 | [deps]
13 |
14 | source_file="res://scenes/game/level/assets/sky.exr"
15 | dest_files=["res://.godot/imported/sky.exr-c9c1d35911e5bf2af1a9acfe897517b3.bptc.ctex"]
16 |
17 | [params]
18 |
19 | compress/mode=2
20 | compress/high_quality=false
21 | compress/lossy_quality=0.7
22 | compress/hdr_compression=1
23 | compress/normal_map=0
24 | compress/channel_pack=0
25 | mipmaps/generate=true
26 | mipmaps/limit=-1
27 | roughness/mode=0
28 | roughness/src_normal=""
29 | process/fix_alpha_border=true
30 | process/premult_alpha=false
31 | process/normal_map_invert_y=false
32 | process/hdr_as_srgb=false
33 | process/hdr_clamp_exposure=false
34 | process/size_limit=0
35 | detect_3d/compress_to=0
36 |
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/game/level/level_geometry.tscn:
--------------------------------------------------------------------------------
1 | [gd_scene load_steps=6 format=3 uid="uid://bi8ewqjqhfvv0"]
2 |
3 | [ext_resource type="PackedScene" uid="uid://d3uvc0yshrs6c" path="res://scenes/game/level/assets/level.glb" id="1_gj5hy"]
4 | [ext_resource type="Material" uid="uid://c7m4dund6n2ph" path="res://scenes/game/level/assets/concrete.tres" id="2_c53vt"]
5 | [ext_resource type="Material" uid="uid://cwi4446xnjcgm" path="res://scenes/game/level/assets/concrete_tiles.tres" id="3_2sxnd"]
6 | [ext_resource type="Material" uid="uid://f55wf3rj8b06" path="res://scenes/game/level/assets/metal_grate.tres" id="4_ce81g"]
7 |
8 | [sub_resource type="StandardMaterial3D" id="StandardMaterial3D_uja0j"]
9 | cull_mode = 2
10 | shading_mode = 0
11 | albedo_color = Color(0, 0, 0, 1)
12 |
13 | [node name="LevelGeometry" instance=ExtResource("1_gj5hy")]
14 |
15 | [node name="LevelBase" parent="." index="0"]
16 | cast_shadow = 2
17 | surface_material_override/0 = ExtResource("2_c53vt")
18 | surface_material_override/1 = ExtResource("3_2sxnd")
19 |
20 | [node name="Grate" parent="." index="1"]
21 | cast_shadow = 2
22 | surface_material_override/0 = ExtResource("4_ce81g")
23 |
24 | [node name="ShadowMesh" parent="." index="2"]
25 | cast_shadow = 3
26 | surface_material_override/0 = SubResource("StandardMaterial3D_uja0j")
27 |
--------------------------------------------------------------------------------
/FPSInGodot4/scenes/main.tscn:
--------------------------------------------------------------------------------
1 | [gd_scene load_steps=2 format=3 uid="uid://qqp1hhfalmy4"]
2 |
3 | [ext_resource type="PackedScene" uid="uid://bk2qhlebimc7e" path="res://scenes/game/game.tscn" id="1_ylsla"]
4 |
5 | [node name="Main" type="Node"]
6 |
7 | [node name="Game" parent="." instance=ExtResource("1_ylsla")]
8 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2022 Reun Media Partnership
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/LightDetection/.gitattributes:
--------------------------------------------------------------------------------
1 | # Normalize EOL for all files that Git considers text files.
2 | * text=auto eol=lf
3 |
--------------------------------------------------------------------------------
/LightDetection/.gitignore:
--------------------------------------------------------------------------------
1 | # Godot 4+ specific ignores
2 | .godot/
3 |
--------------------------------------------------------------------------------
/LightDetection/README.md:
--------------------------------------------------------------------------------
1 | # Light Detection in Godot 4.0
2 |
3 |
4 |
5 | 
6 | Watch on YouTube
7 |
8 |
9 |
10 | This tutorial covers how to detect light levels in the Godot Engine as a part of a game's stealth system. As explained at the start, there are a few different ways of achieving this. The technique shown in this video is simple to setup in Godot and fairly flexible.
11 |
12 | Published on 2023-02-17.
13 |
14 | # Relevant files
15 | [player.gd](./scenes/player/player.gd)
16 |
--------------------------------------------------------------------------------
/LightDetection/icon.svg.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="CompressedTexture2D"
5 | uid="uid://c23lfle0lcpe3"
6 | path="res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"
7 | metadata={
8 | "vram_texture": false
9 | }
10 |
11 | [deps]
12 |
13 | source_file="res://icon.svg"
14 | dest_files=["res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"]
15 |
16 | [params]
17 |
18 | compress/mode=0
19 | compress/lossy_quality=0.7
20 | compress/hdr_compression=1
21 | compress/bptc_ldr=0
22 | compress/normal_map=0
23 | compress/channel_pack=0
24 | mipmaps/generate=false
25 | mipmaps/limit=-1
26 | roughness/mode=0
27 | roughness/src_normal=""
28 | process/fix_alpha_border=true
29 | process/premult_alpha=false
30 | process/normal_map_invert_y=false
31 | process/hdr_as_srgb=false
32 | process/hdr_clamp_exposure=false
33 | process/size_limit=0
34 | detect_3d/compress_to=1
35 | svg/scale=1.0
36 | editor/scale_with_editor_scale=false
37 | editor/convert_colors_with_editor_theme=false
38 |
--------------------------------------------------------------------------------
/LightDetection/project.godot:
--------------------------------------------------------------------------------
1 | ; Engine configuration file.
2 | ; It's best edited using the editor UI and not directly,
3 | ; since the parameters that go here are not all obvious.
4 | ;
5 | ; Format:
6 | ; [section] ; section goes between []
7 | ; param=value ; assign values to parameters
8 |
9 | config_version=5
10 |
11 | [application]
12 |
13 | config/name="LightDetection"
14 | run/main_scene="res://scenes/level/level.tscn"
15 | config/features=PackedStringArray("4.0", "Forward Plus")
16 | config/icon="res://icon.svg"
17 |
18 | [display]
19 |
20 | window/size/viewport_width=1920
21 | window/size/viewport_height=1080
22 |
23 | [input]
24 |
25 | forward={
26 | "deadzone": 0.5,
27 | "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)
28 | ]
29 | }
30 | back={
31 | "deadzone": 0.5,
32 | "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)
33 | ]
34 | }
35 | left={
36 | "deadzone": 0.5,
37 | "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)
38 | ]
39 | }
40 | right={
41 | "deadzone": 0.5,
42 | "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)
43 | ]
44 | }
45 | jump={
46 | "deadzone": 0.5,
47 | "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":32,"key_label":0,"unicode":0,"echo":false,"script":null)
48 | ]
49 | }
50 |
51 | [physics]
52 |
53 | common/physics_ticks_per_second=120
54 |
55 | [rendering]
56 |
57 | anti_aliasing/quality/use_taa=true
58 |
--------------------------------------------------------------------------------
/LightDetection/scenes/level/assets/brick_floor.tres:
--------------------------------------------------------------------------------
1 | [gd_resource type="ORMMaterial3D" load_steps=3 format=3 uid="uid://crhvshf0crdri"]
2 |
3 | [ext_resource type="Texture2D" uid="uid://pisanabn8k6y" path="res://scenes/level/assets/textures/brick_floor_albedo.png" id="1_oi50q"]
4 | [ext_resource type="Texture2D" uid="uid://bhrhnmdoketby" path="res://scenes/level/assets/textures/brick_floor_normal.png" id="2_yx8n0"]
5 |
6 | [resource]
7 | albedo_texture = ExtResource("1_oi50q")
8 | normal_enabled = true
9 | normal_texture = ExtResource("2_yx8n0")
10 | uv1_triplanar = true
11 | texture_filter = 0
12 |
--------------------------------------------------------------------------------
/LightDetection/scenes/level/assets/brick_wall.tres:
--------------------------------------------------------------------------------
1 | [gd_resource type="ORMMaterial3D" load_steps=3 format=3 uid="uid://c3vebfex8gqxv"]
2 |
3 | [ext_resource type="Texture2D" uid="uid://cdx83qwd8nqeh" path="res://scenes/level/assets/textures/brick_wall_albedo.png" id="1_f8j3l"]
4 | [ext_resource type="Texture2D" uid="uid://dpypg2fpffxtu" path="res://scenes/level/assets/textures/brick_wall_normal.png" id="2_mqrbo"]
5 |
6 | [resource]
7 | albedo_texture = ExtResource("1_f8j3l")
8 | normal_enabled = true
9 | normal_texture = ExtResource("2_mqrbo")
10 | uv1_triplanar = true
11 | texture_filter = 0
12 |
--------------------------------------------------------------------------------
/LightDetection/scenes/level/assets/metal.tres:
--------------------------------------------------------------------------------
1 | [gd_resource type="ORMMaterial3D" load_steps=6 format=3]
2 |
3 | [ext_resource type="Texture" path="textures/metal_albedo.png" id="1"]
4 | [ext_resource type="Texture" path="textures/metal_orm.png" id="2"]
5 | [ext_resource type="Texture" path="textures/metal_normal.png" id="3"]
6 | [resource]
7 | albedo_color = Color(1, 1, 1, 1)
8 | albedo_texture = ExtResource( 1 )
9 | orm_texture = ExtResource( 2 )
10 | normal_enabled = true
11 | normal_scale = 1
12 | normal_texture = ExtResource( 3 )
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/LightDetection/scenes/level/assets/textures/brick_floor_albedo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ReunMedia/gamedev-compass/4ace5b363ad175a37bf8ab0e5d38afd1b20a96c5/LightDetection/scenes/level/assets/textures/brick_floor_albedo.png
--------------------------------------------------------------------------------
/LightDetection/scenes/level/assets/textures/brick_floor_albedo.png.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="CompressedTexture2D"
5 | uid="uid://pisanabn8k6y"
6 | path.s3tc="res://.godot/imported/brick_floor_albedo.png-8a3cd995016dcc640d414aaaa5f1aa34.s3tc.ctex"
7 | metadata={
8 | "imported_formats": ["s3tc_bptc"],
9 | "vram_texture": true
10 | }
11 |
12 | [deps]
13 |
14 | source_file="res://scenes/level/assets/textures/brick_floor_albedo.png"
15 | dest_files=["res://.godot/imported/brick_floor_albedo.png-8a3cd995016dcc640d414aaaa5f1aa34.s3tc.ctex"]
16 |
17 | [params]
18 |
19 | compress/mode=2
20 | compress/high_quality=false
21 | compress/lossy_quality=0.7
22 | compress/hdr_compression=1
23 | compress/normal_map=0
24 | compress/channel_pack=0
25 | mipmaps/generate=true
26 | mipmaps/limit=-1
27 | roughness/mode=0
28 | roughness/src_normal=""
29 | process/fix_alpha_border=true
30 | process/premult_alpha=false
31 | process/normal_map_invert_y=false
32 | process/hdr_as_srgb=false
33 | process/hdr_clamp_exposure=false
34 | process/size_limit=0
35 | detect_3d/compress_to=0
36 |
--------------------------------------------------------------------------------
/LightDetection/scenes/level/assets/textures/brick_floor_normal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ReunMedia/gamedev-compass/4ace5b363ad175a37bf8ab0e5d38afd1b20a96c5/LightDetection/scenes/level/assets/textures/brick_floor_normal.png
--------------------------------------------------------------------------------
/LightDetection/scenes/level/assets/textures/brick_floor_normal.png.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="CompressedTexture2D"
5 | uid="uid://bhrhnmdoketby"
6 | path.s3tc="res://.godot/imported/brick_floor_normal.png-43c6864b170c9e2fc14de35e8f3fff9e.s3tc.ctex"
7 | metadata={
8 | "imported_formats": ["s3tc_bptc"],
9 | "vram_texture": true
10 | }
11 |
12 | [deps]
13 |
14 | source_file="res://scenes/level/assets/textures/brick_floor_normal.png"
15 | dest_files=["res://.godot/imported/brick_floor_normal.png-43c6864b170c9e2fc14de35e8f3fff9e.s3tc.ctex"]
16 |
17 | [params]
18 |
19 | compress/mode=2
20 | compress/high_quality=false
21 | compress/lossy_quality=0.7
22 | compress/hdr_compression=1
23 | compress/normal_map=1
24 | compress/channel_pack=0
25 | mipmaps/generate=true
26 | mipmaps/limit=-1
27 | roughness/mode=1
28 | roughness/src_normal="res://scenes/level/assets/brick_floor_normal.png"
29 | process/fix_alpha_border=true
30 | process/premult_alpha=false
31 | process/normal_map_invert_y=false
32 | process/hdr_as_srgb=false
33 | process/hdr_clamp_exposure=false
34 | process/size_limit=0
35 | detect_3d/compress_to=0
36 |
--------------------------------------------------------------------------------
/LightDetection/scenes/level/assets/textures/brick_floor_orm.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ReunMedia/gamedev-compass/4ace5b363ad175a37bf8ab0e5d38afd1b20a96c5/LightDetection/scenes/level/assets/textures/brick_floor_orm.png
--------------------------------------------------------------------------------
/LightDetection/scenes/level/assets/textures/brick_floor_orm.png.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="CompressedTexture2D"
5 | uid="uid://rtg1bcafnmod"
6 | path="res://.godot/imported/brick_floor_orm.png-c6113a603876fb5e7633d64e80314e92.ctex"
7 | metadata={
8 | "vram_texture": false
9 | }
10 |
11 | [deps]
12 |
13 | source_file="res://scenes/level/assets/textures/brick_floor_orm.png"
14 | dest_files=["res://.godot/imported/brick_floor_orm.png-c6113a603876fb5e7633d64e80314e92.ctex"]
15 |
16 | [params]
17 |
18 | compress/mode=0
19 | compress/lossy_quality=0.7
20 | compress/hdr_compression=1
21 | compress/bptc_ldr=0
22 | compress/normal_map=0
23 | compress/channel_pack=0
24 | mipmaps/generate=false
25 | mipmaps/limit=-1
26 | roughness/mode=0
27 | roughness/src_normal=""
28 | process/fix_alpha_border=true
29 | process/premult_alpha=false
30 | process/normal_map_invert_y=false
31 | process/hdr_as_srgb=false
32 | process/hdr_clamp_exposure=false
33 | process/size_limit=0
34 | detect_3d/compress_to=1
35 |
--------------------------------------------------------------------------------
/LightDetection/scenes/level/assets/textures/brick_wall_albedo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ReunMedia/gamedev-compass/4ace5b363ad175a37bf8ab0e5d38afd1b20a96c5/LightDetection/scenes/level/assets/textures/brick_wall_albedo.png
--------------------------------------------------------------------------------
/LightDetection/scenes/level/assets/textures/brick_wall_albedo.png.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="CompressedTexture2D"
5 | uid="uid://cdx83qwd8nqeh"
6 | path.s3tc="res://.godot/imported/brick_wall_albedo.png-26a73b14b1d902e6ddf502c793504abc.s3tc.ctex"
7 | metadata={
8 | "imported_formats": ["s3tc_bptc"],
9 | "vram_texture": true
10 | }
11 |
12 | [deps]
13 |
14 | source_file="res://scenes/level/assets/textures/brick_wall_albedo.png"
15 | dest_files=["res://.godot/imported/brick_wall_albedo.png-26a73b14b1d902e6ddf502c793504abc.s3tc.ctex"]
16 |
17 | [params]
18 |
19 | compress/mode=2
20 | compress/high_quality=false
21 | compress/lossy_quality=0.7
22 | compress/hdr_compression=1
23 | compress/normal_map=0
24 | compress/channel_pack=0
25 | mipmaps/generate=true
26 | mipmaps/limit=-1
27 | roughness/mode=0
28 | roughness/src_normal=""
29 | process/fix_alpha_border=true
30 | process/premult_alpha=false
31 | process/normal_map_invert_y=false
32 | process/hdr_as_srgb=false
33 | process/hdr_clamp_exposure=false
34 | process/size_limit=0
35 | detect_3d/compress_to=0
36 |
--------------------------------------------------------------------------------
/LightDetection/scenes/level/assets/textures/brick_wall_normal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ReunMedia/gamedev-compass/4ace5b363ad175a37bf8ab0e5d38afd1b20a96c5/LightDetection/scenes/level/assets/textures/brick_wall_normal.png
--------------------------------------------------------------------------------
/LightDetection/scenes/level/assets/textures/brick_wall_normal.png.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="CompressedTexture2D"
5 | uid="uid://dpypg2fpffxtu"
6 | path.s3tc="res://.godot/imported/brick_wall_normal.png-7c809e8174f03b66ab736082a00850bb.s3tc.ctex"
7 | metadata={
8 | "imported_formats": ["s3tc_bptc"],
9 | "vram_texture": true
10 | }
11 |
12 | [deps]
13 |
14 | source_file="res://scenes/level/assets/textures/brick_wall_normal.png"
15 | dest_files=["res://.godot/imported/brick_wall_normal.png-7c809e8174f03b66ab736082a00850bb.s3tc.ctex"]
16 |
17 | [params]
18 |
19 | compress/mode=2
20 | compress/high_quality=false
21 | compress/lossy_quality=0.7
22 | compress/hdr_compression=1
23 | compress/normal_map=1
24 | compress/channel_pack=0
25 | mipmaps/generate=true
26 | mipmaps/limit=-1
27 | roughness/mode=1
28 | roughness/src_normal="res://scenes/level/assets/brick_wall_normal.png"
29 | process/fix_alpha_border=true
30 | process/premult_alpha=false
31 | process/normal_map_invert_y=false
32 | process/hdr_as_srgb=false
33 | process/hdr_clamp_exposure=false
34 | process/size_limit=0
35 | detect_3d/compress_to=0
36 |
--------------------------------------------------------------------------------
/LightDetection/scenes/level/assets/textures/brick_wall_orm.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ReunMedia/gamedev-compass/4ace5b363ad175a37bf8ab0e5d38afd1b20a96c5/LightDetection/scenes/level/assets/textures/brick_wall_orm.png
--------------------------------------------------------------------------------
/LightDetection/scenes/level/assets/textures/brick_wall_orm.png.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="CompressedTexture2D"
5 | uid="uid://byppfmbxjl7mb"
6 | path="res://.godot/imported/brick_wall_orm.png-8ef0d3f4f3ee7545b8d7ea2c2f6913c4.ctex"
7 | metadata={
8 | "vram_texture": false
9 | }
10 |
11 | [deps]
12 |
13 | source_file="res://scenes/level/assets/textures/brick_wall_orm.png"
14 | dest_files=["res://.godot/imported/brick_wall_orm.png-8ef0d3f4f3ee7545b8d7ea2c2f6913c4.ctex"]
15 |
16 | [params]
17 |
18 | compress/mode=0
19 | compress/lossy_quality=0.7
20 | compress/hdr_compression=1
21 | compress/bptc_ldr=0
22 | compress/normal_map=0
23 | compress/channel_pack=0
24 | mipmaps/generate=false
25 | mipmaps/limit=-1
26 | roughness/mode=0
27 | roughness/src_normal=""
28 | process/fix_alpha_border=true
29 | process/premult_alpha=false
30 | process/normal_map_invert_y=false
31 | process/hdr_as_srgb=false
32 | process/hdr_clamp_exposure=false
33 | process/size_limit=0
34 | detect_3d/compress_to=1
35 |
--------------------------------------------------------------------------------
/LightDetection/scenes/level/assets/textures/metal_albedo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ReunMedia/gamedev-compass/4ace5b363ad175a37bf8ab0e5d38afd1b20a96c5/LightDetection/scenes/level/assets/textures/metal_albedo.png
--------------------------------------------------------------------------------
/LightDetection/scenes/level/assets/textures/metal_albedo.png.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="CompressedTexture2D"
5 | uid="uid://cd2h7xs2vnuab"
6 | path.s3tc="res://.godot/imported/metal_albedo.png-c27cb02371dfef73bd578b58855541cf.s3tc.ctex"
7 | metadata={
8 | "imported_formats": ["s3tc_bptc"],
9 | "vram_texture": true
10 | }
11 |
12 | [deps]
13 |
14 | source_file="res://scenes/level/assets/textures/metal_albedo.png"
15 | dest_files=["res://.godot/imported/metal_albedo.png-c27cb02371dfef73bd578b58855541cf.s3tc.ctex"]
16 |
17 | [params]
18 |
19 | compress/mode=2
20 | compress/high_quality=false
21 | compress/lossy_quality=0.7
22 | compress/hdr_compression=1
23 | compress/normal_map=0
24 | compress/channel_pack=0
25 | mipmaps/generate=true
26 | mipmaps/limit=-1
27 | roughness/mode=0
28 | roughness/src_normal=""
29 | process/fix_alpha_border=true
30 | process/premult_alpha=false
31 | process/normal_map_invert_y=false
32 | process/hdr_as_srgb=false
33 | process/hdr_clamp_exposure=false
34 | process/size_limit=0
35 | detect_3d/compress_to=0
36 |
--------------------------------------------------------------------------------
/LightDetection/scenes/level/assets/textures/metal_normal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ReunMedia/gamedev-compass/4ace5b363ad175a37bf8ab0e5d38afd1b20a96c5/LightDetection/scenes/level/assets/textures/metal_normal.png
--------------------------------------------------------------------------------
/LightDetection/scenes/level/assets/textures/metal_normal.png.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="CompressedTexture2D"
5 | uid="uid://bxa5ai5pei3vm"
6 | path.s3tc="res://.godot/imported/metal_normal.png-4947bdc4a3de2e4f75a200560a1e0599.s3tc.ctex"
7 | metadata={
8 | "imported_formats": ["s3tc_bptc"],
9 | "vram_texture": true
10 | }
11 |
12 | [deps]
13 |
14 | source_file="res://scenes/level/assets/textures/metal_normal.png"
15 | dest_files=["res://.godot/imported/metal_normal.png-4947bdc4a3de2e4f75a200560a1e0599.s3tc.ctex"]
16 |
17 | [params]
18 |
19 | compress/mode=2
20 | compress/high_quality=false
21 | compress/lossy_quality=0.7
22 | compress/hdr_compression=1
23 | compress/normal_map=1
24 | compress/channel_pack=0
25 | mipmaps/generate=true
26 | mipmaps/limit=-1
27 | roughness/mode=1
28 | roughness/src_normal="res://scenes/level/assets/textures/metal_normal.png"
29 | process/fix_alpha_border=true
30 | process/premult_alpha=false
31 | process/normal_map_invert_y=false
32 | process/hdr_as_srgb=false
33 | process/hdr_clamp_exposure=false
34 | process/size_limit=0
35 | detect_3d/compress_to=0
36 |
--------------------------------------------------------------------------------
/LightDetection/scenes/level/assets/textures/metal_orm.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ReunMedia/gamedev-compass/4ace5b363ad175a37bf8ab0e5d38afd1b20a96c5/LightDetection/scenes/level/assets/textures/metal_orm.png
--------------------------------------------------------------------------------
/LightDetection/scenes/level/assets/textures/metal_orm.png.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="CompressedTexture2D"
5 | uid="uid://desb07vv0dsk2"
6 | path.s3tc="res://.godot/imported/metal_orm.png-6ac262db74adfc62f14161891ce505a6.s3tc.ctex"
7 | metadata={
8 | "imported_formats": ["s3tc_bptc"],
9 | "vram_texture": true
10 | }
11 |
12 | [deps]
13 |
14 | source_file="res://scenes/level/assets/textures/metal_orm.png"
15 | dest_files=["res://.godot/imported/metal_orm.png-6ac262db74adfc62f14161891ce505a6.s3tc.ctex"]
16 |
17 | [params]
18 |
19 | compress/mode=2
20 | compress/high_quality=false
21 | compress/lossy_quality=0.7
22 | compress/hdr_compression=1
23 | compress/normal_map=0
24 | compress/channel_pack=0
25 | mipmaps/generate=true
26 | mipmaps/limit=-1
27 | roughness/mode=0
28 | roughness/src_normal=""
29 | process/fix_alpha_border=true
30 | process/premult_alpha=false
31 | process/normal_map_invert_y=false
32 | process/hdr_as_srgb=false
33 | process/hdr_clamp_exposure=false
34 | process/size_limit=0
35 | detect_3d/compress_to=0
36 |
--------------------------------------------------------------------------------
/LightDetection/scenes/level/assets/textures/wood_albedo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ReunMedia/gamedev-compass/4ace5b363ad175a37bf8ab0e5d38afd1b20a96c5/LightDetection/scenes/level/assets/textures/wood_albedo.png
--------------------------------------------------------------------------------
/LightDetection/scenes/level/assets/textures/wood_albedo.png.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="CompressedTexture2D"
5 | uid="uid://ck80lnrxyy20f"
6 | path.s3tc="res://.godot/imported/wood_albedo.png-c9cab2af6a381bd7f7ec1348fc2e5f63.s3tc.ctex"
7 | metadata={
8 | "imported_formats": ["s3tc_bptc"],
9 | "vram_texture": true
10 | }
11 |
12 | [deps]
13 |
14 | source_file="res://scenes/level/assets/textures/wood_albedo.png"
15 | dest_files=["res://.godot/imported/wood_albedo.png-c9cab2af6a381bd7f7ec1348fc2e5f63.s3tc.ctex"]
16 |
17 | [params]
18 |
19 | compress/mode=2
20 | compress/high_quality=false
21 | compress/lossy_quality=0.7
22 | compress/hdr_compression=1
23 | compress/normal_map=0
24 | compress/channel_pack=0
25 | mipmaps/generate=true
26 | mipmaps/limit=-1
27 | roughness/mode=0
28 | roughness/src_normal=""
29 | process/fix_alpha_border=true
30 | process/premult_alpha=false
31 | process/normal_map_invert_y=false
32 | process/hdr_as_srgb=false
33 | process/hdr_clamp_exposure=false
34 | process/size_limit=0
35 | detect_3d/compress_to=0
36 |
--------------------------------------------------------------------------------
/LightDetection/scenes/level/assets/textures/wood_normal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ReunMedia/gamedev-compass/4ace5b363ad175a37bf8ab0e5d38afd1b20a96c5/LightDetection/scenes/level/assets/textures/wood_normal.png
--------------------------------------------------------------------------------
/LightDetection/scenes/level/assets/textures/wood_normal.png.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="CompressedTexture2D"
5 | uid="uid://bkd2867otf0p7"
6 | path.s3tc="res://.godot/imported/wood_normal.png-fd425d933fdb1aebc878e72056a4ee8b.s3tc.ctex"
7 | metadata={
8 | "imported_formats": ["s3tc_bptc"],
9 | "vram_texture": true
10 | }
11 |
12 | [deps]
13 |
14 | source_file="res://scenes/level/assets/textures/wood_normal.png"
15 | dest_files=["res://.godot/imported/wood_normal.png-fd425d933fdb1aebc878e72056a4ee8b.s3tc.ctex"]
16 |
17 | [params]
18 |
19 | compress/mode=2
20 | compress/high_quality=false
21 | compress/lossy_quality=0.7
22 | compress/hdr_compression=1
23 | compress/normal_map=1
24 | compress/channel_pack=0
25 | mipmaps/generate=true
26 | mipmaps/limit=-1
27 | roughness/mode=1
28 | roughness/src_normal="res://scenes/level/assets/textures/wood_normal.png"
29 | process/fix_alpha_border=true
30 | process/premult_alpha=false
31 | process/normal_map_invert_y=false
32 | process/hdr_as_srgb=false
33 | process/hdr_clamp_exposure=false
34 | process/size_limit=0
35 | detect_3d/compress_to=0
36 |
--------------------------------------------------------------------------------
/LightDetection/scenes/level/assets/textures/wood_orm.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ReunMedia/gamedev-compass/4ace5b363ad175a37bf8ab0e5d38afd1b20a96c5/LightDetection/scenes/level/assets/textures/wood_orm.png
--------------------------------------------------------------------------------
/LightDetection/scenes/level/assets/textures/wood_orm.png.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="CompressedTexture2D"
5 | uid="uid://d2wb0r6so5a2a"
6 | path.s3tc="res://.godot/imported/wood_orm.png-bbdc8b9a895925e503425bb1cafd11a9.s3tc.ctex"
7 | metadata={
8 | "imported_formats": ["s3tc_bptc"],
9 | "vram_texture": true
10 | }
11 |
12 | [deps]
13 |
14 | source_file="res://scenes/level/assets/textures/wood_orm.png"
15 | dest_files=["res://.godot/imported/wood_orm.png-bbdc8b9a895925e503425bb1cafd11a9.s3tc.ctex"]
16 |
17 | [params]
18 |
19 | compress/mode=2
20 | compress/high_quality=false
21 | compress/lossy_quality=0.7
22 | compress/hdr_compression=1
23 | compress/normal_map=0
24 | compress/channel_pack=0
25 | mipmaps/generate=true
26 | mipmaps/limit=-1
27 | roughness/mode=0
28 | roughness/src_normal=""
29 | process/fix_alpha_border=true
30 | process/premult_alpha=false
31 | process/normal_map_invert_y=false
32 | process/hdr_as_srgb=false
33 | process/hdr_clamp_exposure=false
34 | process/size_limit=0
35 | detect_3d/compress_to=0
36 |
--------------------------------------------------------------------------------
/LightDetection/scenes/level/assets/wood.tres:
--------------------------------------------------------------------------------
1 | [gd_resource type="ORMMaterial3D" load_steps=6 format=3]
2 | [ext_resource path="wood_albedo.png" type="Texture" id=1]
3 | [ext_resource path="wood_orm.png" type="Texture" id=2]
4 | [ext_resource path="wood_normal.png" type="Texture" id=3]
5 | [resource]
6 | albedo_color = Color(1, 1, 1, 1)
7 | albedo_texture = ExtResource( 1 )
8 | normal_enabled = true
9 | normal_scale = 1
10 | normal_texture = ExtResource( 3 )
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/LightDetection/scenes/level/entity/torch/assets/metal.tres:
--------------------------------------------------------------------------------
1 | [gd_resource type="ORMMaterial3D" load_steps=4 format=3 uid="uid://c1o412knfb1cr"]
2 |
3 | [ext_resource type="Texture2D" uid="uid://cd2h7xs2vnuab" path="res://scenes/level/assets/textures/metal_albedo.png" id="1_dpha0"]
4 | [ext_resource type="Texture2D" uid="uid://bxa5ai5pei3vm" path="res://scenes/level/assets/textures/metal_normal.png" id="2_kqh0w"]
5 | [ext_resource type="Texture2D" uid="uid://desb07vv0dsk2" path="res://scenes/level/assets/textures/metal_orm.png" id="3_rk87e"]
6 |
7 | [resource]
8 | albedo_texture = ExtResource("1_dpha0")
9 | orm_texture = ExtResource("3_rk87e")
10 | normal_enabled = true
11 | normal_texture = ExtResource("2_kqh0w")
12 | uv1_triplanar = true
13 | texture_filter = 2
14 |
--------------------------------------------------------------------------------
/LightDetection/scenes/level/entity/torch/assets/particles_fire.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ReunMedia/gamedev-compass/4ace5b363ad175a37bf8ab0e5d38afd1b20a96c5/LightDetection/scenes/level/entity/torch/assets/particles_fire.png
--------------------------------------------------------------------------------
/LightDetection/scenes/level/entity/torch/assets/particles_fire.png.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="CompressedTexture2D"
5 | uid="uid://bnw4lbw6rsjb4"
6 | path.s3tc="res://.godot/imported/particles_fire.png-120b00ad3e9455c047f8c6c4c9766cac.s3tc.ctex"
7 | metadata={
8 | "imported_formats": ["s3tc_bptc"],
9 | "vram_texture": true
10 | }
11 |
12 | [deps]
13 |
14 | source_file="res://scenes/level/entity/torch/assets/particles_fire.png"
15 | dest_files=["res://.godot/imported/particles_fire.png-120b00ad3e9455c047f8c6c4c9766cac.s3tc.ctex"]
16 |
17 | [params]
18 |
19 | compress/mode=2
20 | compress/high_quality=false
21 | compress/lossy_quality=0.7
22 | compress/hdr_compression=1
23 | compress/normal_map=0
24 | compress/channel_pack=0
25 | mipmaps/generate=true
26 | mipmaps/limit=-1
27 | roughness/mode=0
28 | roughness/src_normal=""
29 | process/fix_alpha_border=true
30 | process/premult_alpha=false
31 | process/normal_map_invert_y=false
32 | process/hdr_as_srgb=false
33 | process/hdr_clamp_exposure=false
34 | process/size_limit=0
35 | detect_3d/compress_to=0
36 |
--------------------------------------------------------------------------------
/LightDetection/scenes/level/entity/torch/assets/wood.tres:
--------------------------------------------------------------------------------
1 | [gd_resource type="ORMMaterial3D" load_steps=4 format=3 uid="uid://b2np8pueivj6t"]
2 |
3 | [ext_resource type="Texture2D" uid="uid://ck80lnrxyy20f" path="res://scenes/level/assets/textures/wood_albedo.png" id="1_4durt"]
4 | [ext_resource type="Texture2D" uid="uid://bkd2867otf0p7" path="res://scenes/level/assets/textures/wood_normal.png" id="2_k1inu"]
5 | [ext_resource type="Texture2D" uid="uid://d2wb0r6so5a2a" path="res://scenes/level/assets/textures/wood_orm.png" id="3_hu4kj"]
6 |
7 | [resource]
8 | albedo_texture = ExtResource("1_4durt")
9 | orm_texture = ExtResource("3_hu4kj")
10 | normal_enabled = true
11 | normal_texture = ExtResource("2_k1inu")
12 | uv1_triplanar = true
13 | texture_filter = 2
14 |
--------------------------------------------------------------------------------
/LightDetection/scenes/player/assets/light_meter_ui.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
13 |
--------------------------------------------------------------------------------
/LightDetection/scenes/player/assets/light_meter_ui.svg.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="CompressedTexture2D"
5 | uid="uid://dairqkv1rcfbp"
6 | path="res://.godot/imported/light_meter_ui.svg-c6a12d6839294e85de1379a0377878d5.ctex"
7 | metadata={
8 | "vram_texture": false
9 | }
10 |
11 | [deps]
12 |
13 | source_file="res://scenes/player/assets/light_meter_ui.svg"
14 | dest_files=["res://.godot/imported/light_meter_ui.svg-c6a12d6839294e85de1379a0377878d5.ctex"]
15 |
16 | [params]
17 |
18 | compress/mode=0
19 | compress/lossy_quality=0.7
20 | compress/hdr_compression=1
21 | compress/bptc_ldr=0
22 | compress/normal_map=0
23 | compress/channel_pack=0
24 | mipmaps/generate=false
25 | mipmaps/limit=-1
26 | roughness/mode=0
27 | roughness/src_normal=""
28 | process/fix_alpha_border=true
29 | process/premult_alpha=false
30 | process/normal_map_invert_y=false
31 | process/hdr_as_srgb=false
32 | process/hdr_clamp_exposure=false
33 | process/size_limit=0
34 | detect_3d/compress_to=1
35 | svg/scale=1.0
36 | editor/scale_with_editor_scale=false
37 | editor/convert_colors_with_editor_theme=false
38 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | Game development tutorials and resources for Godot Engine and beyond.
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 | # 🧭 Welcome to GameDev Compass
19 | This repository contains accompanying source code and other files for [GameDev
20 | Compass video tutorials](https://www.youtube.com/@GameDevCompass/videos). Found
21 | a bug or have an idea? Feel free to [submit an issue](https://github.com/ReunMedia/gamedev-compass/issues)
22 | or [open a pull request](https://github.com/ReunMedia/gamedev-compass/pulls).
23 |
24 | ## Support us
25 | Currently the best way to support us is to [watch, like and share our videos](https://www.youtube.com/@GameDevCompass/videos).
26 | You can also [subscribe](https://www.youtube.com/@GameDevCompass?sub_confirmation=1) to GameDev Compass on YouTube and follow @GameDevCompass on [Mastodon](https://mastodon.gamedev.place/@GameDevCompass) and [X / Twitter](https://twitter.com/GameDevCompass).
27 |
--------------------------------------------------------------------------------
/SmoothMovement/.editorconfig:
--------------------------------------------------------------------------------
1 | #
2 | # Godot Game project EditorConfig
3 | #
4 | # @version 1.0.0
5 | #
6 |
7 | root = true
8 |
9 | [*]
10 | charset = utf-8
11 | end_of_line = lf
12 | indent_size = 2
13 | indent_style = space
14 | insert_final_newline = true
15 | trim_trailing_whitespace = true
16 |
17 | [*.md]
18 | trim_trailing_whitespace = false
19 |
20 | [*.gd]
21 | indent_style = tab
22 | indent_size = 4
23 | insert_final_newline = false
24 | trim_trailing_whitespace = false
25 |
26 | [*.cs]
27 | indent_size = 4
28 |
--------------------------------------------------------------------------------
/SmoothMovement/.gitignore:
--------------------------------------------------------------------------------
1 | ##########################
2 | # Generic project ignore #
3 | ##########################
4 | # Prefix your personal development files and directories with `_`
5 | /_*
6 | /.vscode/
7 | /*.log
8 | **/_temp/**
9 |
10 | #################
11 | # Godot ignores #
12 | #################
13 | # Based on https://github.com/github/gitignore/blob/master/Godot.gitignore
14 | # Godot-specific ignores
15 | .import/
16 | export.cfg
17 | export_presets.cfg
18 |
19 | # Imported translations (automatically generated from CSV files)
20 | *.translation
21 |
22 | # Mono-specific ignores
23 | .mono/
24 | data_*/
25 |
--------------------------------------------------------------------------------
/SmoothMovement/README.md:
--------------------------------------------------------------------------------
1 | # Smooth Player Movement – Godot 3.5 Tutorial
2 |
3 |
4 |
5 | 
6 | Watch on YouTube
7 |
8 |
9 |
10 | Learn to create a simple player movement in Godot 3.5 with acceleration.
11 | Includes 2D and 3D examples.
12 |
13 | Published on 2022-11-18.
14 |
15 | # Relevant files
16 | [player2D.gd](./scenes/player2D.gd)
17 |
18 | [player3D.gd](./scenes/player3D.gd)
19 |
--------------------------------------------------------------------------------
/SmoothMovement/assets/1024.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ReunMedia/gamedev-compass/4ace5b363ad175a37bf8ab0e5d38afd1b20a96c5/SmoothMovement/assets/1024.png
--------------------------------------------------------------------------------
/SmoothMovement/assets/1024.png.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="StreamTexture"
5 | path="res://.import/1024.png-140204064dfbfbcc03390b538035b994.stex"
6 | metadata={
7 | "vram_texture": false
8 | }
9 |
10 | [deps]
11 |
12 | source_file="res://assets/1024.png"
13 | dest_files=[ "res://.import/1024.png-140204064dfbfbcc03390b538035b994.stex" ]
14 |
15 | [params]
16 |
17 | compress/mode=0
18 | compress/lossy_quality=0.7
19 | compress/hdr_mode=0
20 | compress/bptc_ldr=0
21 | compress/normal_map=0
22 | flags/repeat=1
23 | flags/filter=true
24 | flags/mipmaps=true
25 | flags/anisotropic=true
26 | flags/srgb=1
27 | process/fix_alpha_border=false
28 | process/premult_alpha=false
29 | process/HDR_as_SRGB=false
30 | process/invert_color=false
31 | process/normal_map_invert_y=false
32 | stream=false
33 | size_limit=0
34 | detect_3d=false
35 | svg/scale=1.0
36 |
--------------------------------------------------------------------------------
/SmoothMovement/assets/BG256.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ReunMedia/gamedev-compass/4ace5b363ad175a37bf8ab0e5d38afd1b20a96c5/SmoothMovement/assets/BG256.png
--------------------------------------------------------------------------------
/SmoothMovement/assets/BG256.png.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="StreamTexture"
5 | path.s3tc="res://.import/BG256.png-e407760fdcdf3a122cd0f1764b3c72a1.s3tc.stex"
6 | path.etc2="res://.import/BG256.png-e407760fdcdf3a122cd0f1764b3c72a1.etc2.stex"
7 | metadata={
8 | "imported_formats": [ "s3tc", "etc2" ],
9 | "vram_texture": true
10 | }
11 |
12 | [deps]
13 |
14 | source_file="res://assets/BG256.png"
15 | dest_files=[ "res://.import/BG256.png-e407760fdcdf3a122cd0f1764b3c72a1.s3tc.stex", "res://.import/BG256.png-e407760fdcdf3a122cd0f1764b3c72a1.etc2.stex" ]
16 |
17 | [params]
18 |
19 | compress/mode=2
20 | compress/lossy_quality=0.7
21 | compress/hdr_mode=0
22 | compress/bptc_ldr=0
23 | compress/normal_map=0
24 | flags/repeat=true
25 | flags/filter=true
26 | flags/mipmaps=true
27 | flags/anisotropic=false
28 | flags/srgb=1
29 | process/fix_alpha_border=true
30 | process/premult_alpha=false
31 | process/HDR_as_SRGB=false
32 | process/invert_color=false
33 | process/normal_map_invert_y=false
34 | stream=false
35 | size_limit=0
36 | detect_3d=false
37 | svg/scale=1.0
38 |
--------------------------------------------------------------------------------
/SmoothMovement/assets/CapsulePlayer.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ReunMedia/gamedev-compass/4ace5b363ad175a37bf8ab0e5d38afd1b20a96c5/SmoothMovement/assets/CapsulePlayer.png
--------------------------------------------------------------------------------
/SmoothMovement/assets/CapsulePlayer.png.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="StreamTexture"
5 | path="res://.import/CapsulePlayer.png-8135285809a85ba4b493b4877a17e0f4.stex"
6 | metadata={
7 | "vram_texture": false
8 | }
9 |
10 | [deps]
11 |
12 | source_file="res://assets/CapsulePlayer.png"
13 | dest_files=[ "res://.import/CapsulePlayer.png-8135285809a85ba4b493b4877a17e0f4.stex" ]
14 |
15 | [params]
16 |
17 | compress/mode=0
18 | compress/lossy_quality=0.7
19 | compress/hdr_mode=0
20 | compress/bptc_ldr=0
21 | compress/normal_map=0
22 | flags/repeat=0
23 | flags/filter=true
24 | flags/mipmaps=false
25 | flags/anisotropic=false
26 | flags/srgb=2
27 | process/fix_alpha_border=true
28 | process/premult_alpha=false
29 | process/HDR_as_SRGB=false
30 | process/invert_color=false
31 | process/normal_map_invert_y=false
32 | stream=false
33 | size_limit=0
34 | detect_3d=true
35 | svg/scale=1.0
36 |
--------------------------------------------------------------------------------
/SmoothMovement/assets/GridTiles.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ReunMedia/gamedev-compass/4ace5b363ad175a37bf8ab0e5d38afd1b20a96c5/SmoothMovement/assets/GridTiles.png
--------------------------------------------------------------------------------
/SmoothMovement/assets/GridTiles.png.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="StreamTexture"
5 | path="res://.import/GridTiles.png-6c74ae07696adbabb60e64254b661f82.stex"
6 | metadata={
7 | "vram_texture": false
8 | }
9 |
10 | [deps]
11 |
12 | source_file="res://assets/GridTiles.png"
13 | dest_files=[ "res://.import/GridTiles.png-6c74ae07696adbabb60e64254b661f82.stex" ]
14 |
15 | [params]
16 |
17 | compress/mode=0
18 | compress/lossy_quality=0.7
19 | compress/hdr_mode=0
20 | compress/bptc_ldr=0
21 | compress/normal_map=0
22 | flags/repeat=0
23 | flags/filter=true
24 | flags/mipmaps=false
25 | flags/anisotropic=false
26 | flags/srgb=2
27 | process/fix_alpha_border=true
28 | process/premult_alpha=false
29 | process/HDR_as_SRGB=false
30 | process/invert_color=false
31 | process/normal_map_invert_y=false
32 | stream=false
33 | size_limit=0
34 | detect_3d=false
35 | svg/scale=1.0
36 |
--------------------------------------------------------------------------------
/SmoothMovement/default_env.tres:
--------------------------------------------------------------------------------
1 | [gd_resource type="Environment" load_steps=2 format=2]
2 |
3 | [sub_resource type="ProceduralSky" id=1]
4 |
5 | [resource]
6 | background_mode = 2
7 | background_sky = SubResource( 1 )
8 |
--------------------------------------------------------------------------------
/SmoothMovement/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ReunMedia/gamedev-compass/4ace5b363ad175a37bf8ab0e5d38afd1b20a96c5/SmoothMovement/icon.png
--------------------------------------------------------------------------------
/SmoothMovement/icon.png.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="StreamTexture"
5 | path="res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex"
6 | metadata={
7 | "vram_texture": false
8 | }
9 |
10 | [deps]
11 |
12 | source_file="res://icon.png"
13 | dest_files=[ "res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex" ]
14 |
15 | [params]
16 |
17 | compress/mode=0
18 | compress/lossy_quality=0.7
19 | compress/hdr_mode=0
20 | compress/bptc_ldr=0
21 | compress/normal_map=0
22 | flags/repeat=0
23 | flags/filter=true
24 | flags/mipmaps=false
25 | flags/anisotropic=false
26 | flags/srgb=2
27 | process/fix_alpha_border=true
28 | process/premult_alpha=false
29 | process/HDR_as_SRGB=false
30 | process/invert_color=false
31 | process/normal_map_invert_y=false
32 | stream=false
33 | size_limit=0
34 | detect_3d=true
35 | svg/scale=1.0
36 |
--------------------------------------------------------------------------------
/SmoothMovement/project.godot:
--------------------------------------------------------------------------------
1 | ; Engine configuration file.
2 | ; It's best edited using the editor UI and not directly,
3 | ; since the parameters that go here are not all obvious.
4 | ;
5 | ; Format:
6 | ; [section] ; section goes between []
7 | ; param=value ; assign values to parameters
8 |
9 | config_version=4
10 |
11 | [application]
12 |
13 | config/name="SmoothMovement"
14 | run/main_scene="res://scenes/smooth2D.tscn"
15 | config/icon="res://icon.png"
16 |
17 | [display]
18 |
19 | window/size/width=1920
20 | window/size/height=1080
21 |
22 | [gui]
23 |
24 | common/drop_mouse_on_gui_input_disabled=true
25 |
26 | [input]
27 |
28 | left={
29 | "deadzone": 0.5,
30 | "events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":65,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
31 | ]
32 | }
33 | right={
34 | "deadzone": 0.5,
35 | "events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":68,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
36 | ]
37 | }
38 | up={
39 | "deadzone": 0.5,
40 | "events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":87,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
41 | ]
42 | }
43 | down={
44 | "deadzone": 0.5,
45 | "events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":83,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
46 | ]
47 | }
48 | jump={
49 | "deadzone": 0.5,
50 | "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)
51 | ]
52 | }
53 |
54 | [physics]
55 |
56 | common/physics_fps=165
57 | common/enable_pause_aware_picking=true
58 | common/physics_interpolation=true
59 |
60 | [rendering]
61 |
62 | quality/filters/anisotropic_filter_level=16
63 | gles3/shaders/shader_compilation_mode=1
64 | quality/filters/msaa=3
65 | quality/filters/use_debanding=true
66 | environment/default_environment="res://default_env.tres"
67 |
--------------------------------------------------------------------------------
/SmoothMovement/scenes/player2D.gd:
--------------------------------------------------------------------------------
1 | extends KinematicBody2D
2 |
3 | export var speed := 1000.0
4 | export var gravity := 2000.0
5 | export var jump_power := 2000.0
6 | export var h_accel:= 5000.0
7 | export var v_accel := 5000.0
8 |
9 | var movement_vector := Vector2.ZERO
10 |
11 | func _physics_process(delta) -> void:
12 | # Horizontal movement
13 | var horizontal_input = Input.get_axis("left", "right")
14 | horizontal_input *= speed
15 | movement_vector.x = move_toward(movement_vector.x, horizontal_input, h_accel * delta)
16 | # Vertical movement
17 | movement_vector.y = move_toward(movement_vector.y, gravity, v_accel * delta)
18 | if Input.is_action_just_pressed("jump") and is_on_floor():
19 | movement_vector.y = -jump_power
20 | # Move
21 | movement_vector = move_and_slide(movement_vector, Vector2.UP)
22 |
--------------------------------------------------------------------------------
/SmoothMovement/scenes/player3D.gd:
--------------------------------------------------------------------------------
1 | extends KinematicBody
2 |
3 | export var speed := 7.0
4 | export var gravity := -20.0
5 | export var jump_power := 15.0
6 | export var h_accel := 35.0
7 | export var v_accel := 35.0
8 |
9 | var movement_vector := Vector3.ZERO
10 |
11 | func _physics_process(delta) -> void:
12 | # Horizontal movement
13 | var horizontal_input := Vector3.ZERO
14 | horizontal_input.x = Input.get_axis("down", "up")
15 | horizontal_input.z = Input.get_axis("left", "right")
16 | horizontal_input = horizontal_input.limit_length(1.0)
17 | horizontal_input *= speed
18 | horizontal_input.y = movement_vector.y
19 | movement_vector = movement_vector.move_toward(horizontal_input, h_accel * delta)
20 | # Vertical movement
21 | movement_vector.y = move_toward(movement_vector.y, gravity, v_accel * delta)
22 | if Input.is_action_just_pressed("jump") and is_on_floor():
23 | movement_vector.y = jump_power
24 | # Move
25 | movement_vector = move_and_slide(movement_vector, Vector3.UP)
26 |
--------------------------------------------------------------------------------
/TriggersInteraction/.editorconfig:
--------------------------------------------------------------------------------
1 | #
2 | # Godot Game project EditorConfig
3 | #
4 | # @version 1.0.0
5 | #
6 |
7 | root = true
8 |
9 | [*]
10 | charset = utf-8
11 | end_of_line = lf
12 | indent_size = 2
13 | indent_style = space
14 | insert_final_newline = true
15 | trim_trailing_whitespace = true
16 |
17 | [*.md]
18 | trim_trailing_whitespace = false
19 |
20 | [*.gd]
21 | indent_style = tab
22 | indent_size = 4
23 | insert_final_newline = false
24 | trim_trailing_whitespace = false
25 |
26 | [*.cs]
27 | indent_size = 4
28 |
--------------------------------------------------------------------------------
/TriggersInteraction/.gitignore:
--------------------------------------------------------------------------------
1 | ##########################
2 | # Generic project ignore #
3 | ##########################
4 | # Prefix your personal development files and directories with `_`
5 | /_*
6 | /.vscode/
7 | /*.log
8 | **/_temp/**
9 |
10 | #################
11 | # Godot ignores #
12 | #################
13 | # Based on https://github.com/github/gitignore/blob/master/Godot.gitignore
14 | # Godot-specific ignores
15 | .import/
16 | export.cfg
17 | export_presets.cfg
18 |
19 | # Imported translations (automatically generated from CSV files)
20 | *.translation
21 |
22 | # Mono-specific ignores
23 | .mono/
24 | data_*/
25 |
--------------------------------------------------------------------------------
/TriggersInteraction/README.md:
--------------------------------------------------------------------------------
1 | # Triggers and Interactable Objects – Godot 3.5 Tutorial
2 |
3 |
4 |
5 | 
6 | Watch on YouTube
7 |
8 |
9 |
10 | This tutorial shows you how to make triggers and objects that the player can interact with.
11 | The scripts and techniques shown here are reusable for all kinds of purposes in your games.
12 |
13 | The player script in this tutorial is based on the one from the Advanced Player Movement tutorial.
14 |
15 | The font used by the number display if from the DSEG font family, licensed under SIL Open Font License 1.1 and available here:
16 |
17 | Published on 2022-12-02.
18 |
19 | # Relevant files
20 | [advanced_player.gd](./scenes/entity/player/advanced_player.gd)
21 |
22 | [jump_pad.gd](./scenes/entity/jump_pad/jump_pad.gd)
23 |
24 | [player_trigger.gd](./scenes/entity/player_trigger/player_trigger.gd)
25 |
26 | [door.gd](./scenes/entity/door/door.gd)
27 |
28 | [player_interaction.gd](./scenes/entity/player_interaction/player_interaction.gd)
29 |
30 | [number_display.gd](./scenes/entity/number_display/number_display.gd)
31 |
--------------------------------------------------------------------------------
/TriggersInteraction/assets/1024.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ReunMedia/gamedev-compass/4ace5b363ad175a37bf8ab0e5d38afd1b20a96c5/TriggersInteraction/assets/1024.png
--------------------------------------------------------------------------------
/TriggersInteraction/assets/1024.png.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="StreamTexture"
5 | path="res://.import/1024.png-140204064dfbfbcc03390b538035b994.stex"
6 | metadata={
7 | "vram_texture": false
8 | }
9 |
10 | [deps]
11 |
12 | source_file="res://assets/1024.png"
13 | dest_files=[ "res://.import/1024.png-140204064dfbfbcc03390b538035b994.stex" ]
14 |
15 | [params]
16 |
17 | compress/mode=0
18 | compress/lossy_quality=0.7
19 | compress/hdr_mode=0
20 | compress/bptc_ldr=0
21 | compress/normal_map=0
22 | flags/repeat=1
23 | flags/filter=true
24 | flags/mipmaps=true
25 | flags/anisotropic=true
26 | flags/srgb=1
27 | process/fix_alpha_border=false
28 | process/premult_alpha=false
29 | process/HDR_as_SRGB=false
30 | process/invert_color=false
31 | process/normal_map_invert_y=false
32 | stream=false
33 | size_limit=0
34 | detect_3d=false
35 | svg/scale=1.0
36 |
--------------------------------------------------------------------------------
/TriggersInteraction/assets/BG256.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ReunMedia/gamedev-compass/4ace5b363ad175a37bf8ab0e5d38afd1b20a96c5/TriggersInteraction/assets/BG256.png
--------------------------------------------------------------------------------
/TriggersInteraction/assets/BG256.png.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="StreamTexture"
5 | path.s3tc="res://.import/BG256.png-e407760fdcdf3a122cd0f1764b3c72a1.s3tc.stex"
6 | path.etc2="res://.import/BG256.png-e407760fdcdf3a122cd0f1764b3c72a1.etc2.stex"
7 | metadata={
8 | "imported_formats": [ "s3tc", "etc2" ],
9 | "vram_texture": true
10 | }
11 |
12 | [deps]
13 |
14 | source_file="res://assets/BG256.png"
15 | dest_files=[ "res://.import/BG256.png-e407760fdcdf3a122cd0f1764b3c72a1.s3tc.stex", "res://.import/BG256.png-e407760fdcdf3a122cd0f1764b3c72a1.etc2.stex" ]
16 |
17 | [params]
18 |
19 | compress/mode=2
20 | compress/lossy_quality=0.7
21 | compress/hdr_mode=0
22 | compress/bptc_ldr=0
23 | compress/normal_map=0
24 | flags/repeat=true
25 | flags/filter=true
26 | flags/mipmaps=true
27 | flags/anisotropic=false
28 | flags/srgb=1
29 | process/fix_alpha_border=true
30 | process/premult_alpha=false
31 | process/HDR_as_SRGB=false
32 | process/invert_color=false
33 | process/normal_map_invert_y=false
34 | stream=false
35 | size_limit=0
36 | detect_3d=false
37 | svg/scale=1.0
38 |
--------------------------------------------------------------------------------
/TriggersInteraction/assets/CapsulePlayer.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ReunMedia/gamedev-compass/4ace5b363ad175a37bf8ab0e5d38afd1b20a96c5/TriggersInteraction/assets/CapsulePlayer.png
--------------------------------------------------------------------------------
/TriggersInteraction/assets/CapsulePlayer.png.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="StreamTexture"
5 | path="res://.import/CapsulePlayer.png-8135285809a85ba4b493b4877a17e0f4.stex"
6 | metadata={
7 | "vram_texture": false
8 | }
9 |
10 | [deps]
11 |
12 | source_file="res://assets/CapsulePlayer.png"
13 | dest_files=[ "res://.import/CapsulePlayer.png-8135285809a85ba4b493b4877a17e0f4.stex" ]
14 |
15 | [params]
16 |
17 | compress/mode=0
18 | compress/lossy_quality=0.7
19 | compress/hdr_mode=0
20 | compress/bptc_ldr=0
21 | compress/normal_map=0
22 | flags/repeat=0
23 | flags/filter=true
24 | flags/mipmaps=false
25 | flags/anisotropic=false
26 | flags/srgb=2
27 | process/fix_alpha_border=true
28 | process/premult_alpha=false
29 | process/HDR_as_SRGB=false
30 | process/invert_color=false
31 | process/normal_map_invert_y=false
32 | stream=false
33 | size_limit=0
34 | detect_3d=true
35 | svg/scale=1.0
36 |
--------------------------------------------------------------------------------
/TriggersInteraction/assets/DSEG14Classic-Regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ReunMedia/gamedev-compass/4ace5b363ad175a37bf8ab0e5d38afd1b20a96c5/TriggersInteraction/assets/DSEG14Classic-Regular.ttf
--------------------------------------------------------------------------------
/TriggersInteraction/assets/GridTiles.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ReunMedia/gamedev-compass/4ace5b363ad175a37bf8ab0e5d38afd1b20a96c5/TriggersInteraction/assets/GridTiles.png
--------------------------------------------------------------------------------
/TriggersInteraction/assets/GridTiles.png.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="StreamTexture"
5 | path="res://.import/GridTiles.png-6c74ae07696adbabb60e64254b661f82.stex"
6 | metadata={
7 | "vram_texture": false
8 | }
9 |
10 | [deps]
11 |
12 | source_file="res://assets/GridTiles.png"
13 | dest_files=[ "res://.import/GridTiles.png-6c74ae07696adbabb60e64254b661f82.stex" ]
14 |
15 | [params]
16 |
17 | compress/mode=0
18 | compress/lossy_quality=0.7
19 | compress/hdr_mode=0
20 | compress/bptc_ldr=0
21 | compress/normal_map=0
22 | flags/repeat=0
23 | flags/filter=true
24 | flags/mipmaps=false
25 | flags/anisotropic=false
26 | flags/srgb=2
27 | process/fix_alpha_border=true
28 | process/premult_alpha=false
29 | process/HDR_as_SRGB=false
30 | process/invert_color=false
31 | process/normal_map_invert_y=false
32 | stream=false
33 | size_limit=0
34 | detect_3d=false
35 | svg/scale=1.0
36 |
--------------------------------------------------------------------------------
/TriggersInteraction/default_env.tres:
--------------------------------------------------------------------------------
1 | [gd_resource type="Environment" load_steps=2 format=2]
2 |
3 | [sub_resource type="ProceduralSky" id=1]
4 |
5 | [resource]
6 | background_mode = 2
7 | background_sky = SubResource( 1 )
8 |
--------------------------------------------------------------------------------
/TriggersInteraction/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ReunMedia/gamedev-compass/4ace5b363ad175a37bf8ab0e5d38afd1b20a96c5/TriggersInteraction/icon.png
--------------------------------------------------------------------------------
/TriggersInteraction/icon.png.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="StreamTexture"
5 | path="res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex"
6 | metadata={
7 | "vram_texture": false
8 | }
9 |
10 | [deps]
11 |
12 | source_file="res://icon.png"
13 | dest_files=[ "res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex" ]
14 |
15 | [params]
16 |
17 | compress/mode=0
18 | compress/lossy_quality=0.7
19 | compress/hdr_mode=0
20 | compress/bptc_ldr=0
21 | compress/normal_map=0
22 | flags/repeat=0
23 | flags/filter=true
24 | flags/mipmaps=false
25 | flags/anisotropic=false
26 | flags/srgb=2
27 | process/fix_alpha_border=true
28 | process/premult_alpha=false
29 | process/HDR_as_SRGB=false
30 | process/invert_color=false
31 | process/normal_map_invert_y=false
32 | stream=false
33 | size_limit=0
34 | detect_3d=true
35 | svg/scale=1.0
36 |
--------------------------------------------------------------------------------
/TriggersInteraction/scenes/entity/door/door.gd:
--------------------------------------------------------------------------------
1 | extends Spatial
2 |
3 | func open():
4 | $AnimationPlayer.play("open")
5 |
6 | func close():
7 | $AnimationPlayer.play_backwards("open")
8 |
--------------------------------------------------------------------------------
/TriggersInteraction/scenes/entity/jump_pad/jump_pad.gd:
--------------------------------------------------------------------------------
1 | extends Area
2 |
3 | export var power_vector : Vector3
4 |
5 | func _ready():
6 | $Particles.process_material.direction = power_vector.limit_length(2.0)
7 |
8 |
9 | func _on_body_entered(body):
10 | if body is Player:
11 | body.movement_vector = power_vector
12 | $AnimationPlayer.play("jump")
13 |
--------------------------------------------------------------------------------
/TriggersInteraction/scenes/entity/number_display/number_display.gd:
--------------------------------------------------------------------------------
1 | extends Spatial
2 |
3 | onready var text := $Label3D
4 |
5 | var value := 0
6 |
7 | func refresh_display():
8 | value = int(clamp(value, -99, 999))
9 | text.text = "N: " + "%03d" % value
10 |
11 | func add():
12 | value += 1
13 | refresh_display()
14 |
15 | func subtract():
16 | value -= 1
17 | refresh_display()
18 |
--------------------------------------------------------------------------------
/TriggersInteraction/scenes/entity/number_display/number_display.tscn:
--------------------------------------------------------------------------------
1 | [gd_scene load_steps=6 format=2]
2 |
3 | [ext_resource path="res://assets/DSEG14Classic-Regular.ttf" type="DynamicFontData" id=1]
4 | [ext_resource path="res://scenes/entity/number_display/number_display.gd" type="Script" id=2]
5 |
6 | [sub_resource type="CubeMesh" id=15]
7 | size = Vector3( 0.1, 2, 4 )
8 |
9 | [sub_resource type="SpatialMaterial" id=16]
10 | albedo_color = Color( 0.0509804, 0.0509804, 0.0509804, 1 )
11 | roughness = 0.25
12 |
13 | [sub_resource type="DynamicFont" id=17]
14 | size = 144
15 | use_filter = true
16 | font_data = ExtResource( 1 )
17 |
18 | [node name="NumberDisplay" type="Spatial"]
19 | transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 25, 3, -18 )
20 | script = ExtResource( 2 )
21 |
22 | [node name="MeshInstance" type="MeshInstance" parent="."]
23 | mesh = SubResource( 15 )
24 | skeleton = NodePath("../..")
25 | material/0 = SubResource( 16 )
26 |
27 | [node name="Label3D" type="Label3D" parent="."]
28 | transform = Transform( -4.37114e-08, 0, -1, 0, 1, 0, 1, 0, -4.37114e-08, -0.06, 0, 0 )
29 | pixel_size = 0.005
30 | shaded = true
31 | text = "N: 000"
32 | font = SubResource( 17 )
33 |
--------------------------------------------------------------------------------
/TriggersInteraction/scenes/entity/player/advanced_player.gd:
--------------------------------------------------------------------------------
1 | class_name Player
2 | extends KinematicBody
3 |
4 | export var speed := 7.0
5 | export var run_speed := 10.0
6 | export var gravity := -20.0
7 | export var jump_power := 15.0
8 | export var h_accel := 35.0
9 | export var v_accel := 35.0
10 | export var jump_delay := 0.5
11 | export var max_jumps := 2
12 | export var water_multiplier := 0.5
13 |
14 | var horizontal_input := Vector3.ZERO
15 | var movement_vector := Vector3.ZERO
16 | var movement_multiplier := 1.0
17 | var jump_amount := max_jumps
18 | var jump_timer := Timer.new()
19 | var in_water := false
20 | var interactables : Array
21 | var closest_interactable
22 |
23 | func _ready():
24 | add_child(jump_timer)
25 | jump_timer.one_shot = true
26 | # warning-ignore:return_value_discarded
27 | jump_timer.connect("timeout", self, "jump_timer_timeout")
28 |
29 | func _physics_process(delta) -> void:
30 | # Modifier
31 | var modifier := 1.0
32 | if in_water:
33 | modifier *= water_multiplier
34 | # Horizontal movement
35 | horizontal_input = Vector3.ZERO
36 | horizontal_input.x = Input.get_axis("down", "up")
37 | horizontal_input.z = Input.get_axis("left", "right")
38 | horizontal_input = horizontal_input.limit_length(1.0)
39 | # Running
40 | horizontal_input *= speed if !Input.is_action_pressed("run") else run_speed
41 | horizontal_input.y = movement_vector.y
42 | movement_vector = movement_vector.move_toward(horizontal_input, h_accel * delta)
43 | # Vertical movement
44 | movement_vector.y = move_toward(movement_vector.y, gravity, v_accel * delta)
45 | if is_on_floor():
46 | jump_amount = max_jumps
47 | jump_timer.stop()
48 | elif jump_timer.is_stopped() and jump_amount == max_jumps:
49 | # If not on floor, timer not running and haven't jumped yet, start timer
50 | jump_timer.start(jump_delay)
51 | if Input.is_action_just_pressed("jump") and jump_amount > 0:
52 | # Once you jump, timer is not needed
53 | jump_timer.stop()
54 | movement_vector.y = jump_power
55 | jump_amount -= 1
56 | # Move
57 | movement_vector = move_and_slide(movement_vector * modifier, Vector3.UP)
58 | movement_vector /= modifier
59 | # Interaction
60 | closest_interactable = find_closest_interactable()
61 | if Input.is_action_just_pressed("interact") and closest_interactable != null:
62 | closest_interactable.interact()
63 |
64 | func find_closest_interactable():
65 | if interactables.size() < 1:
66 | return null
67 | elif interactables.size() > 1:
68 | var distance = INF
69 | var closest = interactables[0]
70 | for n in interactables:
71 | var new_distance = n.global_translation.distance_to(global_translation)
72 | if new_distance < distance:
73 | distance = new_distance
74 | closest = n
75 | return closest
76 | else:
77 | return interactables[0]
78 |
79 | func jump_timer_timeout():
80 | jump_amount -= 1
81 |
--------------------------------------------------------------------------------
/TriggersInteraction/scenes/entity/player/player.tscn:
--------------------------------------------------------------------------------
1 | [gd_scene load_steps=5 format=2]
2 |
3 | [ext_resource path="res://scenes/entity/player/advanced_player.gd" type="Script" id=1]
4 |
5 | [sub_resource type="CapsuleMesh" id=3]
6 | radius = 0.5
7 |
8 | [sub_resource type="SpatialMaterial" id=4]
9 | albedo_color = Color( 1, 0.504167, 0.15, 1 )
10 |
11 | [sub_resource type="CapsuleShape" id=5]
12 | radius = 0.5
13 |
14 | [node name="Player" type="KinematicBody"]
15 | script = ExtResource( 1 )
16 | speed = null
17 | run_speed = null
18 | gravity = null
19 | jump_power = null
20 | h_accel = null
21 | v_accel = null
22 | jump_delay = 0.1
23 | max_jumps = 1
24 | water_multiplier = null
25 |
26 | [node name="MeshInstance" type="MeshInstance" parent="."]
27 | transform = Transform( 1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0, 1, 0 )
28 | mesh = SubResource( 3 )
29 | material/0 = SubResource( 4 )
30 |
31 | [node name="CollisionShape" type="CollisionShape" parent="."]
32 | transform = Transform( 1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0, 1, 0 )
33 | shape = SubResource( 5 )
34 |
35 | [node name="Camera" type="Camera" parent="."]
36 | transform = Transform( -3.09086e-08, 0.707107, -0.707107, 3.09086e-08, 0.707107, 0.707107, 1, 0, -4.37114e-08, -10, 11, 0 )
37 | fov = 40.0
38 |
--------------------------------------------------------------------------------
/TriggersInteraction/scenes/entity/player_interaction/player_interaction.gd:
--------------------------------------------------------------------------------
1 | extends Area
2 |
3 | export(NodePath) var node_path
4 | export(String) var call_method
5 |
6 | func _on_body_entered(body):
7 | if body is Player:
8 | body.interactables.append(self)
9 |
10 | func _on_body_exited(body):
11 | if body is Player:
12 | body.interactables.erase(self)
13 |
14 | func interact():
15 | if get_node_or_null(node_path) != null:
16 | if get_node(node_path).has_method(call_method):
17 | get_node(node_path).call(call_method)
18 |
--------------------------------------------------------------------------------
/TriggersInteraction/scenes/entity/player_interaction/player_interaction.tscn:
--------------------------------------------------------------------------------
1 | [gd_scene load_steps=3 format=2]
2 |
3 | [ext_resource path="res://scenes/entity/player_interaction/player_interaction.gd" type="Script" id=1]
4 |
5 | [sub_resource type="SphereShape" id=1]
6 | radius = 1.5
7 |
8 | [node name="PlayerInteraction" type="Area"]
9 | script = ExtResource( 1 )
10 |
11 | [node name="CollisionShape" type="CollisionShape" parent="."]
12 | shape = SubResource( 1 )
13 |
14 | [connection signal="body_entered" from="." to="." method="_on_body_entered"]
15 | [connection signal="body_exited" from="." to="." method="_on_body_exited"]
16 |
--------------------------------------------------------------------------------
/TriggersInteraction/scenes/entity/player_trigger/player_trigger.gd:
--------------------------------------------------------------------------------
1 | extends Area
2 |
3 | export(NodePath) var node_path
4 | export(String) var enter_method
5 | export(String) var exit_method
6 |
7 | func _on_body_entered(body):
8 | if body is Player:
9 | if node_path:
10 | if get_node_or_null(node_path) != null:
11 | if get_node(node_path).has_method(enter_method):
12 | get_node(node_path).call(enter_method)
13 | else:
14 | printerr("Trigger node missing method")
15 | else:
16 | printerr("Trigger couldn't get node")
17 | else:
18 | printerr("Trigger node path empty")
19 |
20 |
21 | func _on_body_exited(body):
22 | if body is Player:
23 | if node_path:
24 | if get_node_or_null(node_path) != null:
25 | if get_node(node_path).has_method(exit_method):
26 | get_node(node_path).call(exit_method)
27 | else:
28 | printerr("Trigger node missing method")
29 | else:
30 | printerr("Trigger couldn't get node")
31 | else:
32 | printerr("Trigger node path empty")
33 |
--------------------------------------------------------------------------------
/TriggersInteraction/scenes/entity/player_trigger/player_trigger.tscn:
--------------------------------------------------------------------------------
1 | [gd_scene load_steps=3 format=2]
2 |
3 | [ext_resource path="res://scenes/entity/player_trigger/player_trigger.gd" type="Script" id=1]
4 |
5 | [sub_resource type="BoxShape" id=15]
6 | resource_local_to_scene = true
7 | extents = Vector3( 4, 2, 4 )
8 |
9 | [node name="PlayerTrigger" type="Area"]
10 | transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 10.5, 2, -18 )
11 | script = ExtResource( 1 )
12 |
13 | [node name="CollisionShape" type="CollisionShape" parent="."]
14 | shape = SubResource( 15 )
15 |
16 | [connection signal="body_entered" from="." to="." method="_on_body_entered"]
17 | [connection signal="body_exited" from="." to="." method="_on_body_exited"]
18 |
--------------------------------------------------------------------------------
/TriggersInteraction/scenes/water_area.gd:
--------------------------------------------------------------------------------
1 | extends Area
2 |
3 | func _body_entered(body):
4 | if body.get("in_water") != null:
5 | body.in_water = true
6 |
7 |
8 | func _body_exited(body):
9 | if body.get("in_water") != null:
10 | body.in_water = false
11 |
--------------------------------------------------------------------------------