Search
How to apply a shader to a sprite without it becoming a rectangle?
I have been looking for a 2D reflective water shader for some time and was delighted to see that this tutorial was posted on YouTube to create just that:
https://www.youtube.com/watch?v=wPr5PvSgxFo
I've had a go at implementing it and have got the reflective water rendering. It's very "Kingdom: Two Crowns" like when spread across the full width of the scene.
However, as you can see from the image above, I've drawn a pond (as a separate Sprite2D) and I've applied the water shader to the pond. It's done that, but draws the water as a rectangle.
Is there a way to apply this shader to the Sprite2D, but conform to the actual sprite (only the light blue), rather than as a rectangle?
Loading ab buffer using Threads
I want to implement a threaded loading component into my game. I am currently saving all my settings and other level files as bytes externally (meaning not in the res:// folders), as I want to be able to export files and send them to others, so they can use them as well. There is the ResourceLoader.load_threaded_request() method, but that only returns Resources and not PackedByteArrays. As far as I can tell, there is only the FileAccess.get_file_as_bytes() method for importing byte files, which has to run in the main thread (and thus blocking it until the load is complete). Does someone know if I am missing some method here?
EDIT: I have put my fix for this into the comments
Fixed projectiles get stuck in one direction while holding back movement
Solution: I removed the else statement from the integrated_forces process and left the two lines from the condition within the process and it fixed it :) Before:
undefined
func _integrate_forces(state): if Input.is_action_pressed("move_up"): state.apply_force(thrust.rotated(rotation)) if Input.is_action_pressed("strafe_left"): state.apply_force(thrust.rotated(rotation + 4.712)) if Input.is_action_pressed("strafe_right"): state.apply_force(thrust.rotated(rotation + 1.5708)) if Input.is_action_pressed("move_down"): state.apply_force((thrust.rotated(rotation) * -1)) else: state.apply_force(Vector2()) Globals.player_rotation = rotation
After:
undefined
func _integrate_forces(state): if Input.is_action_pressed("move_up"): state.apply_force(thrust.rotated(rotation)) if Input.is_action_pressed("strafe_left"): state.apply_force(thrust.rotated(rotation + 4.712)) if Input.is_action_pressed("strafe_right"): state.apply_force(thrust.rotated(rotation + 1.5708)) if Input.is_action