First of all - hello everybody, it's my first post here and I hope it won't be the last 😉
I'm currently developing the Pinball game in C++ using the awesome Box2D v2.1.2. I've got the playfield, realistic ball movement, great spring for shooting the ball with different speeds, cool flippers and special objects. Everything was fine until I've decided to create some fields that should be lit when the ball is over them or to switch them on and off every time the ball passes over them. Also the case of adding a certain amount of score after hitting a specific object is troubling me.
What I need are the sensors probably. I need to recieve somehow the information telling me if the ball passed through a certain shape or not. There will be two situations to solve:
1) Ball passed over the non-colliding shape and something appeared on the map plus score is increased (I will be needing to know if the ball already left the shape or just entered or is currently over the shape).
2) Ball collided with an object and I need to add some points to the score (probably a sensor of a shape of an object is needed, just a bit bigger).
In both cases the ball won't be affected by shapes, just the score and some other static bodies or parts of the code. I browsed through the manual, testbed, this forum's search engine and I just can't understand how to apply sensors at all. Can you help me with that or maybe you can present me a simpler solution? I would really appreciete if someone could present me some kind of a mini tutorial on the sensors implementation (I'm playing with Box2D for only few days so I don't get everything well yet so a beginner-like tutorial with a very simple example would be best). If sensors can solve my case of course.
Hope you can help me up,
h3
I'm currently developing the Pinball game in C++ using the awesome Box2D v2.1.2. I've got the playfield, realistic ball movement, great spring for shooting the ball with different speeds, cool flippers and special objects. Everything was fine until I've decided to create some fields that should be lit when the ball is over them or to switch them on and off every time the ball passes over them. Also the case of adding a certain amount of score after hitting a specific object is troubling me.
What I need are the sensors probably. I need to recieve somehow the information telling me if the ball passed through a certain shape or not. There will be two situations to solve:
1) Ball passed over the non-colliding shape and something appeared on the map plus score is increased (I will be needing to know if the ball already left the shape or just entered or is currently over the shape).
2) Ball collided with an object and I need to add some points to the score (probably a sensor of a shape of an object is needed, just a bit bigger).
In both cases the ball won't be affected by shapes, just the score and some other static bodies or parts of the code. I browsed through the manual, testbed, this forum's search engine and I just can't understand how to apply sensors at all. Can you help me with that or maybe you can present me a simpler solution? I would really appreciete if someone could present me some kind of a mini tutorial on the sensors implementation (I'm playing with Box2D for only few days so I don't get everything well yet so a beginner-like tutorial with a very simple example would be best). If sensors can solve my case of course.
Hope you can help me up,
h3