- Edited
Hi,
I'd like to try and convert a step-by-step 2D platformer tutorial from Unity C# to GDScript (link at bottom). Basically trying to brute-force my way through it, which may not be the best way to go for a beginner :open_mouth: But hopefully I can learn something from it at least.
I'm hitting a snag with the current piece of code, namely in the UpdateRaycastOrigins() function. I'd like to get the outer left/right, top/down coordinates of this node but apparently I can't just use self.min.x etc.
extends CollisionShape2D
const skinWidth = 0.15
var RaycastOrigins = {
topLeft = Vector2(0,0),
bottomLeft = Vector2(0,0),
topRight = Vector2(0,0),
bottomRight = Vector2(0,0)
}
func _ready():
# Called every time the node is added to the scene.
# Initialization here
set_process(true)
func _process(delta):
UpdateRaycastOrigins()
func UpdateRaycastOrigins():
RaycastOrigins.bottomLeft = Vector2(self.min.x, self.max.y)
RaycastOrigins.bottomRight = Vector2(self.max.x, self.max.y)
RaycastOrigins.topLeft = Vector2(self.min.x, self.min.y)
RaycastOrigins.topRight = Vector2(self.max.x, self.min.y)
Original Unity C# script version:
There are other problems too. There doesn't seem to be a Bounds equivalent in Godot, or maybe I'm just missing something. Any help much appreciated :smile:
Here's the tutorial link for those interested: