enemy stop moving even though attribute is still true
emoji
Member, BASIC Posts: 66
Hi, I have this problem where my enemy the green is moving but stop even though the attribute is still true. right now the enemy can only move left. can someone explain why it stops and idle? all attribute is declared in the game. for my setup right now the enemy should move past the player then stop. also how come the vectorToAngle is 358 when it should be 0. The enemy and player have a default collision so I do not know why the enemy falls lower than the player. I hope with this file someone would point out some of my mistakes. thanks
Comments
I'm not sure but one thing I noticed is that if you add a timer to the player actor and have it log self.position.Y, it returns some strange values right about when the vectorToAngle value changes from 359 to 358:
Log(Actor: player): 62.700520788807
Log(Actor: player): -435
Log(Actor: player): -496
Log(Actor: player): 62.700520788807
Log(Actor: player): -495
Log(Actor: player): 62.700520788807
Log(Actor: player): 62.700520788807
Log(Actor: player): 62.700520788807
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Also, the player actor is 2 pixels higher than the enemy player when the enemy player stops. Is that intentional?
Self.Position.Y values in white:
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
no, the player and enemy should be the same size. I must have resized when I was frustrated with vectorToAngle. I'm gonna replace this image with a different one and see what happen.
update, I think the problem might be a collision shape. reading more about a custom collision.
Ok, I figure out why the vectorToAngle is not 0 like it should because the player and enemy were not the same sizes. Tatiang points it out. and because of this, the enemy can move toward the player but one little minor issue is the attribute enemyCanWalkLeft is suppose to turn false if the distance is 30. it a few numbers off like 1 or 2 or 3. I think this can be due to the move. if anyone has any thought please let me know. thanks
You can use a Log Debugging Statement to determine when (where) the enemy stops. It turns out that it stops at game.distancePlayerEnemy=29. Since that attribute is returning whole numbers, that's where I would expect it to stop.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
I know how to display game.distancePlayerEnemy but what do you mean by Log debugging. I'm kind of new to gamesalad.
There is a behavior called Log Debugging Statement. It allows you to display any expression (e.g. an attribute, a text string, etc.) within a rule. You view the Debugger Window and then watch as the value(s) appear.
More info here https://gamesalad.com/2012/02/03/question-of-the-week-using-the-debugger/
and here https://forums.gamesalad.com/discussion/58300/new-tutorial-how-to-use-log-debug-statement-video
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
this log debugging statement does not work for me. im using version 12.25.88
Im trying to see if the move right is true or flase but nothing appear to pop up
Make sure you have the Debugger window open before you preview your project.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
this debug tool is way better than the display text. thanks again for everything.
Agreed, it's very useful. You're welcome.
Just FYI -- I sometimes use Log Debugging to figure out when something is/isn't occuring by placing numbered Log Debugging Statements throughout a set of rules.
Then if I see something like this:
1
2
4
5
6
I know that the rule I expected to fire that has a Log Debugging Statement numbered 3 never fired. Or if I see something like 1, 3, 2, 4, 5, 6, then I know things aren't happening in the order I expected/intended.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User