How do i Achieve this?

http://imgur.com/a/Amvja

i have a spawner that spawn balls downwards...
i want to make it so that the only the balls in the same color and a near to each other will be destroyed when you touch them..
in other words when you touch for example a red ball it will eliminate it and all the red balls that are 5 pixels near it or each other

Comments

  • SocksSocks London, UK.Member Posts: 12,822

    Have the actor that you touch spawn a larger circular actor.

    If this actor collides or overlaps with the relevant balls then destroy them.

    . . . . . .

    For example

    If you touch a green ball (illegal in some parts of Europe) then have that ball spawn an actor called 'green detector', this will basically be a larger version of the green ball (but you won't see it as it will be invisible) . . . the green balls will have a rule saying when they collide or overlap with 'green detector' then destroy.

  • @Socks said:
    Have the actor that you touch spawn a larger circular actor.

    If this actor collides or overlaps with the relevant balls then destroy them.

    . . . . . .

    For example

    If you touch a green ball (illegal in some parts of Europe) then have that ball spawn an actor called 'green detector', this will basically be a larger version of the green ball (but you won't see it as it will be invisible) . . . the green balls will have a rule saying when they collide or overlap with 'green detector' then destroy.

    i will try that, thanks

  • talavital2010@gmail.comtalavital2010@gmail.com Member Posts: 9
    edited April 2017

    the problem is that the collider because its bigger doesnt move like the ball ... how do i make it follow the red ball exactly?

    basically whati want to do is that the RedChecker will always follow the moment of the red ball

    i want the redball checker to be ancohred to the redballs movment

  • imjustmikeimjustmike Member Posts: 450
    edited April 2017

    Add two global real attributes, call them red_x and red_y - we'll use these to track the position of the red ball.

    In your red ball actor, set up two constrain behaviours, constraining the x and the y to self.position x and self.position y. _This will allow the game to know the position of the ball. _

    In your the checker actor, do the reverse, constrain the self position x and y to the new global attributes. This will force the checker actor to follow the red ball exactly.

Sign In or Register to comment.