“Get out more” goal for March achieved. ✅
Joined a bushwalking club and went for a hike in Warandyte.
Rendezvousing with a group that published a Melway location with the address. Really miss when people did that. Miss just flipping through the Melways for no reason other than it’s cool looking at maps. Maybe I should buy a Melways.
The one good thing I get from hearing podcasters talk about Formula One is that they provide a good reminder for when the local race is on, so I can remember which dates I should stay the heck away from the city. 👎
Adventures In Godot: Respawning A Falling Platform
My taste of going through a Godot tutorial last week has got me wanting more, so I’ve set about building a game with it. Thanks to my limited art skills, I’m using the same asset pack that was used in the video, although I am planning to add a bit of my own here and there.
But it’s the new mechanics I enjoy working on, such as adding falling platforms. If you’ve played any platformer, you know what these look like: platforms that are suspended in air, until the player lands on them, at which point gravity takes a hold and they start falling, usually into a pit killing the player in the process:
The platforms are built as a CharacterBody2D
with an Area2D
that will detect when a player enters the collision shape. When they do, a script will run which will have the platform “slipping” for a second, before the gravity is turned on and the platform falls under it’s own weight. The whole thing is bundled as a reusable scene which I could drag into the level I’m working on.

I got the basics of this working reasonably quickly, yet today, I had a devil of a time going beyond that. The issue was that I wanted the platform to respawn after it fell off the map, so that the player wouldn’t get soft-locked at at an area where the platform was needed to escape. After a false-start trying to reposition the platform at it’s starting point after it fell, I figured it was just easier to respawn the platform when the old one was removed. To do this I had to solve two problems:
- How do I get the platform starting point?
- How can I actually respawn the platform?
Getting The Starting Point
A Node2D
object has the property global_position, which returns the position of the object based on the world coordinates. However, it seems like this position is not correct when the _init function of the attached script is called. I suspect this is because this function is called before the platform is added to the scene tree, when the final world coordinates are known.
Fortunately, there exists the _ready
notification, which is invoked when the node is added to the scene tree. After some experimentation, I managed to confirm that global_position
properly was correct. So tracking the starting point is a simple as storing that value in a variable:
var init_global_position = null
func _ready():
init_global_position = global_position
Another option is to use the _enter_tree()
notification. From the documentation, it looks like either would probably work here, with the only difference being the order in which this notification is invoked on parents and children (_enter_tree
is called by the parent first, whereas _ready
is called by the children first).
Respawning The Platform
The next trick was finding out how to respawn the platform. The usual technique for doing so, based on the results of my web searching, is to load the platform scene, instantiate a new instance of it, and added it to the scene tree.
@onready var FallingPlatform = preload("res://scenes/falling_platform.tscn")
func respawn():
var dup = FallingPlatform.instantiate()
add_child(dup)
Many of the examples I’ve seen online added the new scene node as a child of the current node. This wouldn’t work for me as I wanted to free the current node at the same time, and doing so would free the newly instantiated child. The fix for this was easy enough: I just added the new node as a child of the current scene.
@onready var FallingPlatform = preload("res://scenes/falling_platform.tscn")
func respawn():
var dup = FallingPlatform.instantiate()
get_tree().current_scene.add_child(dup)
queue_free()
I still had to reposition the new node to the spawn point. Fortunately the global_position
property is also settable, so it was simply a matter of setting that property before adding it to the tree (this is so that it’s correct when the newly instantiated node receives the _ready
notification).
@onready var FallingPlatform = preload("res://scenes/falling_platform.tscn")
func respawn():
var dup = FallingPlatform.instantiate()
dup.global_position = init_global_position
get_tree().current_scene.add_child(dup)
queue_free()
This spawned the platform at the desired positioned, but there was a huge problem: when the player jumped on the newly spawn platform, it wouldn’t fall. The Area2D
connection was not invoking the script to turn on the gravity:
It took me a while to figured out what was going on, but I came to the conclusion that the packed scene was loading properly, but without the script attached. Turns out a Script is a resource separate from the scene, and can be loaded and attached to an object via the set_script method:
@onready var FallingPlatform = preload("res://scenes/falling_platform.tscn")
@onready var FallingPlatformScript = preload("res://scripts/falling_platform.gd")
func respawn():
var dup = FallingPlatform.instantiate()
dup.set_script(FallingPlatformScript)
dup.global_position = init_global_position
get_tree().current_scene.add_child(dup)
queue_free()
Finally, after figuring all this out, I was able to spawn a new falling platform, have it positioned at the starting position of the old platform, and react to the player standing on it.
The time it took to work this out is actually a little surprising. I was expecting others to run into the same problem I was facing, where they were trying to instantiate a scene only to have the scripts not do anything. Yet it took me 45 minutes of web searching through Stack Overflow and forum posts that didn’t solve my problem. It was only after a bit of experimentation and print-debugging on my own that I realised that I actually had to attached the script after instantiating the node.
To be fair, I will attribute some of this to not understanding the problem at first: I actually thought the Area2D
wasn’t actually being instantiated at all. Yet not one of the Stack Overflow answers or forum post floated the possibility that the script wasn’t being loaded alongside the scene. This does suggest to me that my approach may not be optimal. There does exist a “Local to Scene” switch in the script inspector that could help, although turning it on doesn’t seem to do much. But surely there must be some way to instantiate the script alongside the scene.
Anyway, that’s for later. For now, I’m happy that I’ve got something that works.
Ooh, you know you have a situation on your hands when you see three glass trucks in convoy.
I can’t see voice assistants ever getting better than very basic human understanding. I heard someone mention that they asked their cylinder to “brighten the lights in the room and make it warmer.” The assistant bumped up the heater, but if it was me, I would’ve adjusted the light temperature.
The next “touch grass” event, plus my “get out more” goal for March, has been booked for this upcoming long weekend.
It’s amusing to see a farewell card get passed around the office like a hot potato. A hot potato that everyone has to touch at least one, without letting the recipient know that such a potato even exists.
When do you reach the diminishing returns of adding defensive code to handle outcomes that are “unlikely?”. It’s probably worth it if the chances are 1:10,000, but what about when they’re 1:10,000,000? Is it worth adding this extra complexity if you believe it could happen, despite not being sure?
Idea for a game show: you’re given some out-of-context messages from a Slack thread, and a vague description of who the participants are and where they work, and you have to guess what they’re trying to communicate to each other.
Lot of web developers I’m seeing online are going all in on cross-document view transitions. Chalk me up as someone who doesn’t like fun (a fair assessment) but I really can’t see myself using this anytime soon. It just doesn’t feel… genuine. I can’t really describe it any better than this. It’s as if the site is trying to be something that it’s not (a native app, verses a website).
The immediate transition to a new page may seem like a bad user experience, but I don’t think it is. The transitions don’t hide a page load, so you’re still waiting for that, and I’ve come to expect that the page will be shown to me when it’s ready. Making me wait while a transition is playing, no matter how short it is, just makes it feel like you’re wasting my time.
Anyway, that’s the feeling at the moment. Maybe I’ll come around.
In the meantime, it would be nice if browsers have a preference of turning these off. Having it controlled via the global accessibilities settings is insufficient, as transitions in native apps are occasionally helpful.
Go really should consider adding enum types. There are many useful things that can come from doing so, like the ability to specify a zero value, to detecting when a switch or map is non-exhaustive. I encountered both cases in the last 10 minutes where such features would’ve been helpful.
I received an email yesterday in response to my “iOS Mail Is Shite” post and the email started with “Kev - I cannot agree with you more.”
But Apple “Intelligence” summarised the email as “Disagrees with Kev; uses Mutt for blog email.”
Maybe Apple Intelligence is smart enough to know when it’s being criticised. 😄
Jokes aside, I find it pretty useless too. The priority message for the last couple of weeks is a notice for someone to move their car. I open all sorts of mail but nothing like that. Would’ve thought that be signal in their model.
So, uh, Stripe; which is it? You can’t change the currency of a customer, or you can? Because I was under the impression that you were unable to change the currency once it was set. So you could imagine my surprise when I was able change the currency of a customer this morning.


It’s crazy to think how little you have to pay to put up a website nowadays. For what you get for your money when using a service like Netlify, such as a CDN and edge computing, it feels like an absolute steal.
The problem with “best tool for the job” thinking is that it takes a myopic view of the words “best” and “job.” Your job is keeping the company in business, god damn it. And the “best” tool is the one that occupies the “least worst” position for as many of your problems as possible.
I’ve grown beyond the phase of wanting to look for the new and shiny for a particular problem at work. I just want something simple that will get the job done. Amazing how good of a teacher fatigue is when one’s been burnt adding new tech to an existing stack multiple times.
Via: Allen Pike
It lives!
Working through the Godot tutorial I posted yesterday, while at the same time trying to ignore my ego saying “Pff! I can do this already.” If that was the case, then the work would speak for itself. And on that topic, let me show you exhibit A. So yeah, maybe let’s go through the tutorial first.
Love a good opening theme, and the one used for Challenger: The Final Flight is a great one. Not sure I can listen to an extended version that goes for 8:43, but I can listen to the first 50 seconds of this all day.