Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(1 edit) (+2)

I would assume (based on my experience with Python, which GDScript is similar to) that the first example does not work because the order of execution is different. In that example, when "take_damage(amount)" is called, "amount" is first subtracted from "health", then it checks if health is lower than 0, then it checks the level and changes the "amount" after the original "amount" has already been subtracted. I hope that makes sense.

(+2)

To clarify: Assuming it works like in Python, functions are generally processed from top to bottom.

(+1)

this makes sense to me. it sounds like an order of operations problem. thanks for the response!

(+1)

Always happy to help!

I checked the app to see when/if it mentions this, it looks like in lesson 4 it's kinda mentioned in passing but it's easy not to remember ten lessons later, haha.