Another day, another troubleshooting session, this time focussing on the Hotbar and then (when I lost my mind) the Monster’s behaviour when chasing the player.
The Hotbar implementation broke me; I spent hours… hours trying different versions of rules and expressions to make the specific instance variables move from one instance object to the selector. Nothing was working. I’ve been fighting with GDevelop for so long I got really frustrated with it. There are ways that you can target specific instances of the same object (according to forums) but certain functions in GDevelop don’t seem to take this into account.
Take this screenshot as an example:
I’m trying to tell GDevelop that If slotNumber = 1, check whether the selector is inside (in collision with) the HotbarSlot.
That SPECIFIC HotbarSlot as there are 10 instances of them. But what GDevelop does is run through all of these tasks and settles on the conclusion that slotNumber actually equals 10.
Even if you use the expression Pick a Random Instance, and then narrow it down by saying if slotNumber = 1 OR if you Pick ALL instances and then ask whether the selector is in collision with one, it doesn’t work as it’s not looking for that specific instance. Because it IS in collision with one, the rule triggers and provides the incorrect result. So in the end I gave up and posted on the forums in the hopes that some genius can help me out.
For the Monster behaviour, I initially had the chase mechanics working quite nicely but the Animations weren’t working due to Pathfinding. When an object is following a path it doesn’t behave in the same manner as a TopDownMovement object and therefore asking things like when an object is moving or if it’s turned towards a specific direction, these don’t work. Therefore I need to find another way of setting the animation depending on where the sprite is facing.
I’m still optimistic on this one though… surely there is a solution. 🤔