-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New demo : Platform level generation godot 4 #936
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
New demo : Platform level generation godot 4 #936
Conversation
0409c3d to
af6437b
Compare
|
This is a good start 🙂 I've made a branch based on your fork with further improvements to better match the existing visual style and code style: https://github.com/Calinou/godot-demo-projects/tree/platform_level_generation_godot_4 |
|
These visual improvements are much more intuitive. Can I help with any enhancements? |
I can take it from here, but I won't be able to submit a PR soon as I'm busy with other tasks. |
aaronfranke
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why so many fonts? Ideally, we shouldn't use any fonts, and just use the default font from the engine.
| var camera_speed = 2 # the speed of the camera movement | ||
| var player | ||
| var target_pos | ||
| func _ready(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please follow the GDScript style guide.
Please use static typing in the demos.
Please use snake_case for all file and folder names.
| extends Camera2D | ||
|
|
||
|
|
||
| var camera_speed = 2 # the speed of the camera movement |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| var camera_speed = 2 # the speed of the camera movement | |
| var camera_speed = 2 # The speed of the camera movement. |
Per the comment style.
| target_pos = Vector2(player.position.x+400, 200) | ||
|
|
||
| func _physics_process(delta): | ||
| # get the target position of the camera based on the player position and the offset |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| # get the target position of the camera based on the player position and the offset | |
| # Get the target position of the camera based on the player position and the offset. |
| # get the target position of the camera based on the player position and the offset | ||
| if player!=null: | ||
| target_pos = Vector2(player.position.x+400, 200) | ||
| # lerp the current position of the camera to the target position with a smoothing factor |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| # lerp the current position of the camera to the target position with a smoothing factor | |
| # Lerp the current position of the camera to the target position with a smoothing factor. |
| var camera_speed = 2 # the speed of the camera movement | ||
| var player | ||
| var target_pos | ||
| func _ready(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| func _ready(): | |
| func _ready(): |
| extends TextureRect | ||
|
|
||
| var player | ||
| # Called when the node enters the scene tree for the first time. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| # Called when the node enters the scene tree for the first time. | |
| # Called when the node enters the scene tree for the first time. |
Two spaces before methods, as per the style guide
|
|
||
| func generate_tiles(): | ||
| while next_tile_position.x < (playerPosition.x + screenWidth): | ||
| var value = randi_range(1,5) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| var value = randi_range(1,5) | |
| var value = randi_range(1, 5) |
| for i in range(value): | ||
| set_cell(0, local_to_map(next_tile_position), LineTileIndex, Vector2i(0,0)) | ||
| next_tile_position.x += tile_size.x | ||
| set_cell(0, local_to_map(next_tile_position), PlateTileIndex, Vector2i(0,0)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| set_cell(0, local_to_map(next_tile_position), PlateTileIndex, Vector2i(0,0)) | |
| set_cell(0, local_to_map(next_tile_position), PlateTileIndex, Vector2i(0, 0)) |
| while next_tile_position.x < (playerPosition.x + screenWidth): | ||
| var value = randi_range(1,5) | ||
| for i in range(value): | ||
| set_cell(0, local_to_map(next_tile_position), LineTileIndex, Vector2i(0,0)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| set_cell(0, local_to_map(next_tile_position), LineTileIndex, Vector2i(0,0)) | |
| set_cell(0, local_to_map(next_tile_position), LineTileIndex, Vector2i(0, 0)) |
| # Obstacle indexed 1 tile | ||
| $"../Hit_sound".play() | ||
| set_cell(0, playerCellPos, -1) | ||
| emit_signal("score") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| emit_signal("score") | |
| score.emit() |
| # Line indexed 0 tile | ||
| if not game_over_signal: | ||
| game_over_signal = true | ||
| emit_signal("game_over") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| emit_signal("game_over") | |
| game_over.emit() |

This pull request adds a new demo project, showcasing dynamic level generation and endless arcade gameplay. The project is designed to demonstrate the use of procedural-level generation.
Demo made for
v4.xPull request includes
procedural_platform_level_generatorunder the "2d" directory.Testing
Screenshots / GIFs