00:00
00:00
Newgrounds Background Image Theme

Someone gifted MetalSlayer69 supporter status!

We need you on the team, too.

Support Newgrounds and get tons of perks for just $2.99!

Create a Free Account and then..

Become a Supporter!

Logic error in Godot 3.5 with the code order going out of whack

331 Views | 2 Replies
New Topic Respond to this Topic

How it works is that you attack first. A sprite of a dice plays an animation and a value between 1 and 4 is selected. The value dictates how much damage the enemy deals. Then the enemy attacks starting with when the function is called, then a similar thing happens there. The problem is that after the enemy attacks, both keep looping the script at random points and keep taking damage and I'm not too sure why. I've put print messages in and the order has gotten all over the place. I've linked a video to show what I mean. https://youtu.be/2xcQURrhdlk


BBS Signature

It sure seems like something's making it call functions you aren't intending to call. But I'm not sure if I can give any helpful advice on debugging without seeing the code, and possibly the scene's structure if you have subtle bugs among a bunch of code in different nodes that aren't interacting how you want.


The bad part about Godot and any object-oriented structured language is that, depending on how you set things up, it can get hard to keep track of code and how it's interacting with things if it's spread out in a bunch of nooks and crannies among parent, child, sibling, half step uncle twice removed, and autoload nodes and I'm not aware of a good way to trace things.


My newsfeed has random GameDev tips & tricks


At 7/27/23 09:30 PM, 3p0ch wrote: It sure seems like something's making it call functions you aren't intending to call. But I'm not sure if I can give any helpful advice on debugging without seeing the code, and possibly the scene's structure if you have subtle bugs among a bunch of code in different nodes that aren't interacting how you want.

The bad part about Godot and any object-oriented structured language is that, depending on how you set things up, it can get hard to keep track of code and how it's interacting with things if it's spread out in a bunch of nooks and crannies among parent, child, sibling, half step uncle twice removed, and autoload nodes and I'm not aware of a good way to trace things.


It's okay, I figured it out.


BBS Signature