Hi guys,
I have a big problem and I don't understand how is it possible to happen!
I'm trying to code the AI for the enemies of my game and I noticed this problem.
writing the following code...
+ Collision between Player and Enemy
+ Enemy ID = 1
= Then sub 1 to Player's HP
isnt' the same thing as writing the following?
+ Enemy ID = 1
+ Collision between Player and Enemy
= Then sub 1 to Player's HP
I mean... I always tought tha switching the condition's order does not change a thing. Am I wrong?
Because in the first example, nothing happens... while with the second example the PLayer's HP are correctly decreased.
So what could be the problem? Maybe a bug?
Somebody did experienced the same problem?
Order of events are very important. I'm sure many many bugs that have stumped people and caused projects to not be finished could have been solved by order of events and conditions. They are both important.
As the saying goes, if it fails, heads is tails. Switch around the events and conditions and see what happens.
I Knew that "collisions" condition should be put first when you check for conditions.
I also know that the order of actions is very important, but how can the conditions order be so important?
I mean...
If I have 2 apples
If I have 2 strawberries
Then I have 4 fruits
If I begin to check my strawberries first, then it would be
If I have 2 strawberries
If I have 2 apples
It does not change the fact that I still have 4 fruits.
Conditions order could be important for other reasons, but it must not make difference if I put a condition before or after another.
Am I wrong?
I think the first one would be right because that is the action that causes the entire event to happen. The other way around starts with one of the conditions of the total event.