Spawn 2 different actor

I have 2 different actor, blue and red actor that want spawn on the screen.

For example, only blue-red or red-blue. I don't want red-red or blue-blue actor on screen. Anyone can guide me? Thanks for it.

Comments

  • SocksSocks London, UK.Member Posts: 12,822
    edited May 2016

    A mysterious question !? :)

    If you want to spawn two different actors you can simply spawn them as normal ?

    Like this:

    Spawn red actor
    Spawn blue actor

    Or is there something else to the question ?

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

    A thought . . . .

    Maybe you want to spawn them in a random order ? The Blue first, and the Red second . . . or the Red first and the Blue second ?

    If this is what you want . . .

    Change X to random (1,2)

    Rule
    When X=1
    --Spawn Red
    Otherwise
    --Spawn Blue

    Then in the Red and Blue actors place a spawn behaviour to spawn the other colour (so Red spawns Blue, and Blue spawns Red).

  • wolala123wolala123 Member Posts: 249

    @Socks Oh, sorry. i miss out some information on it.

    For example, one unknown actor after collide one of these actor. These 2 actor change random 2 color actor. But these 2 actor must be different color. Blue-red or re-blue , not red-red. Hope can help me this simple thing.

  • IceboxIcebox Member Posts: 1,485

    @wolala123 said:
    For example, one unknown actor after collide one of these actor. These 2 actor change random 2 color actor. But these 2 actor must be different color. Blue-red or re-blue , not red-red. Hope can help me this simple thing.

    i'm not sure if this is what you want , there are 2 different methods in the attached demo hope it helps.

  • wolala123wolala123 Member Posts: 249

    @Icebox that i want it on my game...thanks for help.

  • wolala123wolala123 Member Posts: 249

    @Icebox sorry for disturbing.....what if i don't want change from blue-red to red-blue actor...

    For example, current is A-B after shoot or collide it may possible remain the same A-B not B-A, such as random arrangement. Can you help me ? Thanks.

  • IceboxIcebox Member Posts: 1,485
    edited May 2016

    @wolala123 said:
    For example, current is A-B after shoot or collide it may possible remain the same A-B not B-A, such as random arrangement. Can you help me ? Thanks.

    Go to the switch actor create an integer self attribute call it random

    Place a timer every 2 seconds or 1 second (what ever you prefer)
    change attribute self.random to random(1,2)

    Now in this rule if actor overlaps or collides with Bullet change game.red to not(game.red)
    change it and make it like this

    Now every 2 seconds if you hit it , it will either be the same , or it will change Red to blue or blue to red

  • IceboxIcebox Member Posts: 1,485

    I don't think you need to put change game.red to game.red , just keep it empty and try sorry about that

  • wolala123wolala123 Member Posts: 249

    oh i see...what if i use image as actor, is it same? thanks

  • IceboxIcebox Member Posts: 1,485

    @wolala123 said:
    oh i see...what if i use image as actor, is it same? thanks

    I just read this now, sorry for the late reply :) I'm not sure what you mean , but I'll guess you want to change the image from A to B or B to A , use the same method , but instead of this

    " if red is true
    change attribute self.color.green to
    change attribute self.color blue to
    "

    change it to

    if red is true
    change attribute self.image to Red(The name of your png image)
    otherwise
    change attribute self.image to Blue(The name of your png image)

Sign In or Register to comment.