How can spawn actor in delimited area?

Hi!

I have this scene: http://s2.subirimagenes.com/imagen/previo/thump_869277220131111-19.png

I want that in the black area use spawn behavior for make an actor every 2 second. How can I do this?

Thanks in advance!!

Comments

  • SocksSocks London, UK.Member Posts: 12,822
    In your spawn behaviour you can define where the spawned actor appears, type in whatever values you want.
  • aitor010aitor010 Member Posts: 282
    I have three actors: blue, red, principal actor and will make a spawn actor or the spawn behavior insert in "principal actor"? How can define the area?
  • SocksSocks London, UK.Member Posts: 12,822
    edited November 2013
    I have three actors: blue, red, principal actor . . .
    Ok, you have 3 actors.
    . . . and will make a spawn actor or the spawn behavior insert in "principal actor"?
    You can place the spawn behaviour wherever you want.
    How can define the area?
    In your spawn behaviour you can define where the spawned actor appears, type in whatever values you want.

    If you want the spawned actor to appear at X200 Y300 then type in X=200 and Y=300.
  • jamie_cjamie_c ImagineLabs.rocks Member, PRO Posts: 5,772
    Assuming the Black area is an Actor, do this:

    Timer: Every 2 seconds

    In the Timer add a Spawn Actor to spawn whatever actor you want

    This new actor will spawn from the center of the Black actor, if you want it to spawn anywhere within the bounds of only the Black Actor, add this to the Spawn Actor Behavior:

    Position X: Random(-[1/2 Horizontal size of your actor],[1/2 Horizontal size of your actor])
    Position Y: Random(-[1/2 Vertical of your actor],[1/2 Vertical size of your actor])

    so if you're actor is 100 pixels wide you'd do:

    Position X: Random(-50,50)
  • SocksSocks London, UK.Member Posts: 12,822
    . . . if you want it to spawn anywhere within the bounds of only the Black Actor . . .
    Ah ! Yes, you are probably right, he most likely wants the actors to spawn randomly within that area ?
  • jamie_cjamie_c ImagineLabs.rocks Member, PRO Posts: 5,772
    @Socks, that was my guess... we'll see. :)
  • aitor010aitor010 Member Posts: 282
    Assuming the Black area is an Actor, do this:

    Timer: Every 2 seconds

    In the Timer add a Spawn Actor to spawn whatever actor you want

    This new actor will spawn from the center of the Black actor, if you want it to spawn anywhere within the bounds of only the Black Actor, add this to the Spawn Actor Behavior:

    Position X: Random(-[1/2 Horizontal size of your actor],[1/2 Horizontal size of your actor])
    Position Y: Random(-[1/2 Vertical of your actor],[1/2 Vertical size of your actor])

    so if you're actor is 100 pixels wide you'd do:

    Position X: Random(-50,50)

    I take a photo of my screen http://s2.subirimagenes.com/imagen/previo/thump_869280920131111-20.png

    This: "Position X: Random(-[1/2 Horizontal size of your actor],[1/2 Horizontal size of your actor])" How translate? The size is 25x25. I test and not run. Thanks in advance!

    @Socks I want will be random and move random in black screen.
  • SocksSocks London, UK.Member Posts: 12,822
    edited November 2013
    @Socks I want will be random and move random in black screen.
    I see ! Yes, take a look at the post by @jamie_c - he shows how it's done.

    Like I said in the other thread, the more info you give the better answers you'll get :)>- and faster too, so maybe take a little time to include some basic details in your post, if you'd said you want the actors to appear randomly within that area your questions would be less subject to (wrong*) interpretation.

    *by me :\">
    This: "Position X: Random(-[1/2 Horizontal size of your actor],[1/2 Horizontal size of your actor])" How translate? The size is 25x25.

    What is half of 25 ?
  • jamie_cjamie_c ImagineLabs.rocks Member, PRO Posts: 5,772
    Here is a sample, the little green dots will spawn only in the white area.
  • aitor010aitor010 Member Posts: 282
    thank you @jamie_c and if I want make random in actor 2 (in your example) only add the random move to behavior not?
  • jamie_cjamie_c ImagineLabs.rocks Member, PRO Posts: 5,772
    I'm not sure I fully understand your question. But if you want the spawned green actor to move, yes you would add your movement rules to that actor. After it's spawned, it will do whatever you're rules/behaviors tell it to.
  • aitor010aitor010 Member Posts: 282
    hi @jamie_c Ok! I understand! Problem solved!!! Thank you so much!
  • jamie_cjamie_c ImagineLabs.rocks Member, PRO Posts: 5,772
    Great! you're welcome. :)
Sign In or Register to comment.