upsonp / godot_series Goto Github PK
View Code? Open in Web Editor NEWCode for the Godot 4 series
License: GNU General Public License v3.0
Code for the Godot 4 series
License: GNU General Public License v3.0
Looking at the get_valid_cell(Vector2, z_index) function in the IsoPlayer script I have var valid_cell: Vector3i = map.get_valid_cell(new_cell, z_index + 1)
. Was wondering why this needs to be z_index + 1 and looked at the function in IsoMap. It looks like my default is "get_layers_count()" which is fine, but then I have for layer in range(max_layer-1, -1, -1):
If my function signature subtraced 1 from the default get_layers_count()
, which is what I want to do anyway, then I wouldn't have to add one to the call in the IsoPlayer Script.
Make:
func get_valid_cell(cell_index: Vector2i, max_layer: int = get_layers_count()) -> Vector3i:
for layer in range(max_layer-1, -1, -1):
var cell_test: Vector2i = cell_index + (layer_offset * layer)
if get_cell_source_id(layer, cell_test) != -1:
return Vector3i(cell_index.x, cell_index.y, layer)
return Vector3i(cell_index.x, cell_index.y, -1)
To
func get_valid_cell(cell_index: Vector2i, max_layer: int = get_layers_count()-1) -> Vector3i:
for layer in range(max_layer, -1, -1):
var cell_test: Vector2i = cell_index + (layer_offset * layer)
if get_cell_source_id(layer, cell_test) != -1:
return Vector3i(cell_index.x, cell_index.y, layer)
return Vector3i(cell_index.x, cell_index.y, -1)
then fix the IsoPlayer script to just use var valid_cell: Vector3i = map.get_valid_cell(new_cell, z_index)
I think get valid cell would be more descriptive if it was named get_cell_below_layer(). The method returns a cell regardless of if the cell is valid or not, but it's primary function is to find a cell below a given layer (or max layer if a layer is specified) then to translate the cell being looked for based on the layer offset.
Currently when the player is initialized it's using get_parent() to find the IsoMap, but I think it would be better that Player had an init() function that took an IsoMap object. That way the player doesn't have to be a child node of the IsoMap.
In the ChunkManager.noise_chunk() function there's a double for loop where y should be for y in range(len(_chunk_data[x])):
Add a get_valid_cell() method to the IsoMap to check if a cell we want to move to is a valid move. Return Vector3i with the cell coordinates and z value representing either if the move is invalid -1 or the height of the move.
I'm not loving how the AnimatedBody2d and Player are coupled. I'd like to figure out how to better utilize state machines as described by 'The Shaggy Dev' https://www.youtube.com/watch?v=Bm3sRxDb3js&t=305s
The IsoPlayer class should be describing the state and the body does the animation implements the animation for the state if it's been described.
I think IsoMap._on_move_complete() should be renamed to "update_chunk_request()" as that's more descriptive of what the function is doing. The player emits a "move_completed" signal, which the map is listening for and the map then makes a chunk update if it's required.
Demonstrate layer highlighting using Layer Modulate to show the layer the character is currently standing on.
Allow making and drawing chunks around the main chunk.
Allow the character to move from one layer to another by using the 'ui_jump' macro.
The functionality should allow the character to walk up to a wall and upon pressing the space bar in the direction of the wall the character will change layers and move to the tile in the direction of the jump.
A character should not be able to jump off a chunk or into an invalid cell. The character should only be able to jump one layer in either direction
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.