How to differentiate between touching actor or background
thegwill
Member Posts: 31
Here's my problem:
I have a simple actors moving around over a background.
I have a rule on the actor to change color when touched.
I have a rule on the background to change color when touched.
If I touch the background it works as expected.
If I touch the actor then the actor changes color AND the background changes color.
Any suggestions? - I'm sure it's something simple!
I have a simple actors moving around over a background.
I have a rule on the actor to change color when touched.
I have a rule on the background to change color when touched.
If I touch the background it works as expected.
If I touch the actor then the actor changes color AND the background changes color.
Any suggestions? - I'm sure it's something simple!
Comments
But that didn't work. I tried using the mouse events instead of "touch" and the rule for the background actor is still firing.
Maybe if I explain a bit better:
The background actor occupies the whole screen.
The moving actor is about 25x25 and moves around on top of the background. There can be lots of these.
When I touch the screen, either:
1. I missed the moving actor and touched the background. This works fine.
2. I touched the moving actor. I do get this event BUT I also get a background touched event too. I've tried the mouse events and the touch events - both same problem.
Any ideas?
Does anyone out there have a simple demo for how to do this? It sounds so simple... ;o)
Identifying actor and background (demo)
I have three actors: player, background, and detector.
When player is pressed, it changes colour.
When background is pressed, it spawns detector.
If detector overlaps or collides with player, it destroys itself. If, after 0.05 seconds, it still exists it changes a global attribute called changeBackground to 0 (if it was 1) or 1 (if it was 0), and then it self-destructs.
I've constrained self.Color.Red of the background actor to the value of changeBackground.
I don't know how well this will work with moving actors but you can try for yourself to see.
Cheers!