Logic questions? is this possible with game salad!

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

  • SummationSummation Member, PRO Posts: 476

    @Hipster_Owl_Studios said:
    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.

    @Socks can do it. Math is awesome like that.

  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922

    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

  • SocksSocks London, UK.Member Posts: 12,822
    edited April 2015

    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 . . . .

  • SocksSocks London, UK.Member Posts: 12,822
    edited April 2015

    Quick demo attached:

  • Hipster_Owl_StudiosHipster_Owl_Studios Member, PRO Posts: 214

    @Socks wow! thanks a lot i didn't think this was possible! Math rocks!

  • SocksSocks London, UK.Member Posts: 12,822
    edited April 2015

    @Hipster_Owl_Studios said:
    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.

  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,879

    Can't this be done with a few rules:

    When overlaps or collides
        When distance is 100
            Destroy rocket
    
        When distance is 90
            Destroy senicricle
    
  • SocksSocks London, UK.Member Posts: 12,822
    edited April 2015

    @RThurman said:
    Can't this be done with a few rules:

    When overlaps or collides
        When distance is 100
            Destroy rocket
    
        When distance is 90
            Destroy senicricle
    

    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.

  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,879

    Ahh... right you are! The simple approach will only work (well) for circular and squarish actors.

Sign In or Register to comment.