Logic questions? is this possible with game salad!
Hipster_Owl_Studios
Member, PRO Posts: 214
Hello I wanted to know if it were possible to have an actor that is half circle (like the image below) rotating and have a rule where if my rocket actor collides with the outer wall of the circle it gets destroyed. but h if the rocket actor is able to hit the circles inner walls thats is when the half circle is destroyed. is something like this possible? thanks a lot guys in advance for your input.
Comments
@Socks can do it. Math is awesome like that.
Mathtap.com (Android) | Fridgemanager.com (Android) | Breakoutofspace.com (Android)
You can do it. You'll need to use an expression with an offset. Do a forum seach but check this out http://forums.gamesalad.com/discussion/76882/off-centre-pivot-point
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
I'd probably just throw a bunch of small rectangles into a semicircle and have them rotate around a common centre - your artwork would be a separate element, the detectors would be invisible and only used to detect collisions - I think this would the most flexible approach ? I'll make a quick demo . . . .
Quick demo attached:
@Socks wow! thanks a lot i didn't think this was possible! Math rocks!
Glad it works for you, you can obviously adjust it to what you need for your project.
The spawner is doing something simple, despite what appears to be dozens of behaviours - it's just . . .
Spawn a chunk of the inner detector at angle X
Spawn a chunk of the outer detector at angle X
Advance angle X on by 10°
. . . then I've grabbed these three behaviours and cut and pasted them 18 times (18 * 10° = 180° for a semicircle), so if you want to adjust stuff (like the radius) just grab these first three behaviours in the spawner, delete the rest, adjust these first three and then cut and paste them 18 times (or however many times you need).
P.S the rule that these spawn behaviours are wrapped in (if angle is < 270) is no longer needed, you can dump that rule and just move the spawners outside of it.
Can't this be done with a few rules:
I also thought that kind of thing would be the best approach at first, but there would be lots of small issues - like 'distance is 100' would only really work for circular actors (rather than a tall/thin rocket), or the fact that we are dealing with a semicircle - that would need to be factored in, none of these issues are insurmountable but I just thought the brute force approach might be the most straightforward.
Ahh... right you are! The simple approach will only work (well) for circular and squarish actors.