Behaviors not functioning
richardlordthesecond
Member Posts: 19
Ok. So, I have these rules, and behaviors in them. But, they do not work. I've had a debug state log whenever the action is supposed to happen, and the statement is printed, but the actions do not happen. Any ideas? Or is it just a bug?
Comments
It's definitely a bug.
Ok, thanks. Hope they will fix it soon. It only started happening since the 13. versions came out.
When you post a question, you need to supply as much detail as possible. Just stating that something doesn't work gives no insight into how you set it up or what might be wrong.
http://forums.gamesalad.com/discussion/66768/forum-faq#posting
A screenshot of your rules is especially helpful. You can upload it to a file-sharing service and then embed or post the link here.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Ok, sorry. I should have done that.
https://caughron.com/patrick//Screen1
https://caughron.com/patrick//Screen
Are you using a Display Text behavior to watch the value of self.health? If so, does it change? If not, did you type in self.health in the expression editor or select it from the Attribute Browser (it has to be selected)?
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
...
No I am not, but I have a health bar that works impeccably.
...then you might want to try it.
What about my other question?
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
I wasn't being serious when I said 'It's definitely a bug' ! How on earth would I know, all you've said is that you have some rules and they are not working.
Then what is the problem you are having ?
So far all we know is that you are having some sort of issue (quite what it is still remains a mystery ), the code you posted looks fine and your health bar works impeccably . . . so are you able to say what the actual problem is ?
Well. Let me try to be specific as I can.
I have a rule in my ship object, "When actor overlaps or collides with blah" "self.hp = self.hp - 5" This works for bullet one. I have the exact same rule for bullets two and three, but they do not set the health down. They are definitely colliding, because when they collide with the ship, they get destroyed like they are supposed to. However, they do not set the health down. I have the ship log a statement "hit" and am printing the hp with "print text" when it collides with them, and it does log it, meaning the event is firing, but the text showing the hp does not change, and the health bar does not decrease.
If the bullets are different actors you need to make the HP Attribute a Game Level Attribute and not an Actor Attribute for more than one actor to access it.
http://jamie-cross.net/posts/ ✮ Udemy: Introduction to Mobile Games Development ✮ Learn Mobile Game Development in One Day Using Gamesalad ✮ My Patreon Page
You don't understand. I have the code, for setting the hp down, in the SHIP actor, NOT the BULLETS actor. So when the SHIP collides, in the SHIP actor, there is the behavior for getting damaged. And like I said, one of them works, the others don't.
Try putting the Destroy Actor behavior in the bullet inside of an after 0.1 seconds timer:
When actor collides with ship actor
Timer after 0.1 seconds
Destroy Actor
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Ok, I'll try that. Let you know if it works.