Attributes reset when two types of actor touch???
Guardian
Member Posts: 54
I have a strange bug...
I have two types of actor;
-The player actor which moves towards the mouse when the button is held down.
-The enemy actors which spawn into a random position on the screen with random colour, size and movement speed. They then move to random positions (then to another when reached, then repeat, etc).
When the two types of actors touch the enemy actors size and colour gets set to red and the smallest size BUT I haven't set up any collision logic yet... so how is this possible???
Kind regards,
Guardian
I have two types of actor;
-The player actor which moves towards the mouse when the button is held down.
-The enemy actors which spawn into a random position on the screen with random colour, size and movement speed. They then move to random positions (then to another when reached, then repeat, etc).
When the two types of actors touch the enemy actors size and colour gets set to red and the smallest size BUT I haven't set up any collision logic yet... so how is this possible???
Kind regards,
Guardian
Comments
Hey there @Guardian - We need a wee bit more information. Can you post up screenshots of your rules in both actors? Actually, just the actor that gets changed for no reason, but both set of rules would help, if we could see them.
***LINK REMOVED***
The actors in question are Player and Bug. You can test the issue in the 'Game' scene.
In bug I check to see the distance between the bugs and player position is below a value. I then reuse the Random attribute which i set to 0 or 1. If I turn that change attribute off then the problem goes away... but how does that make sense???
I know I'm reusing that attribute in the setup section, but that rule is off at this stage.
I'll have to look at it more in depth to see why they do that especially with no collide rules. Right now I'm thinking it has something to do with your random color and size change. But they all seem to default to red when colliding with the main character, regardless.
This could be a bug with how your rules are set up (no pun intended)
What do you want the little bugs to do when you run over them?
If you want them to destroy, that works, because I put a collide/destroy rule in the little bug, and it destroys when colliding with the main character.
You're probably thinking "No duh, Einstein...Of course it doesn't turn red or change sizes when you turn off the red rule, and change size rules." But what that tells me, is it's somewhere in those 2 sets of rules, and any other attributes that reference those sets of rules could be involved.
And the reason I think it may be a bug is because there are absolutely no collide rules whatsoever in your project so far, which makes no sense, because these changes are happening when they collide with each other.
One more thing. I don't see another rule, or otherwise statement for When-Attribute self.setup is "true"...Just the conditions for false. If turn that to true, all the bugs are big and red, and don't move. Come to think of it, that may be part of the issue with change color and change size as well.
So sounds like you came to the same conclusion as me. It looks like when those actors collide all the attributes get set to 0.
And it's not fixing the original problem, but when you use a collide rule with a destroy for the bugs, which is eventually going to be your final objective, it works fine because it's not getting a chance to run through the program bug/unwanted script. But like I said, it's not fixing the original problem, and if the problem is a program bug and not just unwanted scripting, that could leave the door open for a crash or freeze, possibly.
There doesn't need to be a collide rule if you use magnitude to change attributes at a certain distance. There's no program bug as far as this is concerned. I apologize.
I could have saved us both a lot of time if I was paying more attention :P