Speed of behaviors
tutyses
Member Posts: 134
Hello everyone!
I m having a problem with the speed of execution of behaviors ( At least i think so :P)
Basically i have enemies coming from the left side of the screen, when 2 enemies are close to each other and i shoot them, the bullet hit the first enemy AND ALSO the other one (Both of them get their HP reduced because of this)
The bullet has the behavior to destroy itself when it contacts an enemy.
I have seen that the problem is the delay time that the bullet has. It contacts the enemy and after 0.1 it destroys. I dont know why it take so much time
The only behaviors in the bullet it's the destroy when overlaps with the enemy and the behavior that make the bullet move
In the image you can see the bullet inside the enemy, it shouldnt be inside them, never. I hope someone have solved this because it s pretty common to have an enemy and a bullet :P
Thanks for helping me
I m having a problem with the speed of execution of behaviors ( At least i think so :P)
Basically i have enemies coming from the left side of the screen, when 2 enemies are close to each other and i shoot them, the bullet hit the first enemy AND ALSO the other one (Both of them get their HP reduced because of this)
The bullet has the behavior to destroy itself when it contacts an enemy.
I have seen that the problem is the delay time that the bullet has. It contacts the enemy and after 0.1 it destroys. I dont know why it take so much time
The only behaviors in the bullet it's the destroy when overlaps with the enemy and the behavior that make the bullet move
In the image you can see the bullet inside the enemy, it shouldnt be inside them, never. I hope someone have solved this because it s pretty common to have an enemy and a bullet :P
Thanks for helping me
Comments
"If overlaps or collide with enemy" - change attribute.self.color.alpha to 0 - It might visually help you out
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Here i uploaded a Example project
Play around about 5 minutes and you will see that sometimes you hit more than one enemy!
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
I understand why it works but it s kind of weird
Gamesalad doesnt detect the collision with the precision i need, but this workaround works well.
I dont normally post a problem on the forum but when i do, you always help me
I would invite you a cup of coffe if i werent 14000 kilometers away
And I accept the offer for coffee. Let me just book my flight.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Position X and Y are Real variables so, actor positions ARE not the same, at least in this case.
One of the positions would be something like x =103,4 and the other one 103,8 of course to the eye they would look in the same place
If colissions were detected by checking if the actor is between X1 and X2 and between Y1 and Y2, the detection would be almost perfect
Ok remember i live in fireland i will wait you with your coffe and some muffins :P
At x=103 & 104, the time is different by 0.017 seconds at speed 100. At speed 150, the one pixel difference is not enough and both actors detect the collision.
Here's the file I was playing with.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
It s interesting how much the colission detection can be affected
thanks for the tests you earned an extra piece of cake :P