How do I create an object with a particular animation?

  • Hi guys!

    Context: there's a white ball, if you click it, it becomes a black ball (change its animation). Black balls can't touch white balls. I want black balls to spawn little black ball that travels in a random direction.

    Do you know how can i command something to create an object but with a different animation instead of its initial animation?

    I just want to know if this is possible!

    Thanks

  • Simply attach an action to the event where you create the object:

    event with conditions

    create object ball

    ball set animation

  • That doesn't work, perhaps i didn't explain the context well but doing that will make the black ball touch a white ball in t=0 which makes you lose the game. Any other suggestions? :s

  • I don't understand..

    You want the black ball to spawn little black balls, where did the white one come from?

  • LittleStain you only get a black ball this way: "there's a white ball, if you click it, it becomes a black ball (change its animation)". You can't just create it, you have first to create the white one

  • If you change the animation in the creation event (so before the event is called to destroy when overlapping/colliding) there shouldn't be an issue..

    But I might still not understand?

  • Nevermind, but thanks for trying to help me once again littlestain

  • Nevermind, but thanks for trying to help me once again littlestain

    If you could share a capx to show your issue, it would be much easier to help..

    Could be you are misunderstanding my answer, could be I'm misunderstanding your question, could be you are asking the wrong question, I'm not sure..

  • I figured how to solve my problem! I decided to make a whie ball and a black ball two different objects and it worked fine!

    To answer my question, as far as I'm concerned: No, it is not possible to make an object spawn with animation Y at t=0 (moment of spawn) if animation X is set as the initial animation. Hoewever in most cases what LittleStain said works just fine!

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Sorry that I still don't understand, but if you couldn't set animation at t=0, the sprites in this example would be destroyed, right?

    t=0 example

    As far as I know only the "on created" event, which is called before anything can affect the sprite (which is why it's called on created), can affect a sprite earlier..

  • No my case was a little bit more complex but thanks!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)