Home Artists Posts Import Register

Content

So... many... holidays... Here's what I got done this week:

  • Made the heroes recognize the obstacle waypoints
  • Ensured that the heroes don't try to get waypoints from deleted obstacles
  • Made the heroes check the distance of each waypoint upon recognizing/defining them and pick out the one with the shortest distance
  • Made the obstacle waypoint temporarily override the hero waypoint if it's on screen and above them
  • Made Enlightened and Sloth characters ignore obstacles

These all add up to finishing the hero navigation around obstacles. I wanted to get more done this week, but this week was not having it. Two of my five work days were spent at my parent's house due to high tornado chances (they have a storm shelter). If that wasn't enough, this week had like... seventeen different holidays! Like, what the heck?! Anyways, time for less complaining and more explaining!

So as anticipated, getting the heroes to recognize the obstacle waypoints was one of the biggest hurdles here. The solution I ran with was using the obstacle spawner as a middleman between the obstacle waypoints and the heroes. As soon as an obstacle is spawned, the spawner looks through its children (objects within it in the hierarchy) and finds the group of waypoints. It sends that information to the heroes, who flip through the group and compare their distance to each waypoint. From there (can you tell this is complicated yet?), compare each distance and pick out the one that's smallest, make the respective waypoint the one to move to, and move towards it.

So that was about half the battle. The other half came from the heroes just insisting on giving me error after error trying to stay attached to the previous obstacle's waypoints even after it's been deleted. After lots of trial and error, I finally came across a line of code I hadn't known about previously: is_instance_valid(node). Basically, this is a Godot-specific way of checking if an object has been destroyed. Before that, I'd been using "if node != null", which would work fine in Unity but not in Godot, as I learned.

Once I installed the shiny new code, it didn't take me long to notice another Godot-ism. The function "queue_free()", which deletes objects (in this case, the obstacles), happens at the end of the frame, after all the other code looking for waypoints happens. This was the explanation I was looking for; this was why the heroes kept looking at the previous obstacle's waypoints. To remedy the issue, I used the function "remove_child()" (which works during the frame) just before queue_free() and sure enough: it worked! Now it gets the children of the obstacle that was just spawned without seeing the old obstacle's waypoints! :D

With everything in place, I was ready for the first official test!

Everything was working, but... it didn't really feel good. Every time an obstacle appeared on screen, the heroes started buzzing around the screen like bees on drugs. They were rushing to the waypoints as quickly as they could without a second thought.

Fortunately, I kept a little something in my back pocket just in case: the detection zones! You know, those things I mentioned in the last progress report? Don't tell me you weren't paying attention!

Anyways, I moved some code around, toggled a few buttons, booped some noses, and I got the zones implemented no problem! Now to test how it feels:

I'd say that's a large improvement, wouldn't you? There's still lots to do to make this feel good to play, but this is an excellent starting point!

At least, that's what I said about 15 minutes ago when I posted this report. After posting, I changed around the formula a bit and made the heroes only move towards the waypoints horizontally while sticking with the hero vertically. Here's what that looks like:

I personally think that this one feels the best so far. I figure the less the heroes move around without player involvement, the less confusing gameplay will be.

Now that everything was working as intended, I made Enlightened and Sloth ignore the entire process of detecting obstacles since Enlightened floats over everything and Sloth... doesn't really avoid. He just kinda exists.

So that was my week. But enough about me, how was your week? I hope you enjoyed your holidays! Your many, many holidays... I'm gonna eat some Taco Bell and sit in a dark room for a while. In the meantime, go tell your mothers you love them! I'll see you guys again next week!

Comments

Bombur

I'm not dead I promise! Update looks 👍 That was a lot of words but the pictures looked progressively more playable so I agree with whatever you said! Now, I'ma go fall face first into a bed.