How do I assign a Sprite's animations at the start of the game?

Not favoritedFavorited Favorited 0 favourites
  • 3 posts
From the Asset Store
HTML5 Game Bundle (7 Games) – Created with Construct 3
  • Hi all,

    N00b here, trying to understand what seems like a pretty trivial problem...

    I want to base a Sprite on one of a number of other Sprites at the start of a level. Here's some pseudo-code that hopefully explains:

    Start of level

    Generate random number (1 or 2)

    If number is 1, Enemy_Sprite should be a zombie

    If number is 2, Enemy_Sprite should be a werewolf

    What I've tried to do is have Sprites for the 2 possibilties in the layout (along with thheir animations and other props), then assign one of them (as an object instance) to Enemy_Sprite. It's Enemy_Sprite that I refer to in the Event sheet.

    Hope this explains. Happy to give further info if you need it - and thanks in anticipation. :)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hi. You're new to the community and I want to be polite and prompt you with a reply so you have a good first impression of the community. But this is a very basic question and it's better to get some training or study examples and tutorials to understand it yourself.

    Answer.

    Here on the screenshot are two variations of how you can create the desired sprite, and if necessary we can combine these sprites into families to then apply group methods to them.

  • OK, thanks. My problem wasn’t really with the instantiation of new objects but how I’d be able to reference them from an Event sheet. I had tried a Family before but, after your suggestion, I had another go and obviously I got it right this time because it’s now doing what I wanted.

    I’ve been going through tutorials but, even though they’re very good, they don’t cover every aspect.

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