Display this but not by Each enemy

0 favourites
  • 14 posts
From the Asset Store
Give Sound to the enemies that are part of your game! :)
  • Hey guys

    I wanna show speach cloud for some random enemies (pathfinders) but my system doesn't work. I don't won't to show 2 or more clouds in the same time. I need one.

    I made this and doesn't work.

    thanks

  • Not sure I understood you question correctly..

    So you need to select a random enemy and then display a speech cloud above that enemy?

    For Enemy Type<=1 there is one kind of animation, for Enemy Type=2 there is another kind of animation, is this correct?

    I would do something like this:

  • Not sure I understood you question correctly..

    thanks much I'm checking now, but how you make this "or" in first event?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Select whole event with the mouse, then right click and choose "Make OR block".

  • dop2000

    Ok, but when I made Enemies.Hited>0.6 then more than one enemies showing cloud. So first event doesn't work(sad cloud is not visible)

    You know... all fun with that "hited" is for showing this speach cloud randomly, mean somethimes. Maybe there is simplest way to show cloud for every 10 sec for one of pathfinders? I tried many things, but usually all enemies having this cloud

  • Look at my example.

    First pick event (Pick Enemies by Evaluating) picks a group enemies that qualify the conditions.

    The next pick event (Pick Random Enemies Instance) should select only one Enemy from that group.

    So whatever you do to the Enemies object after that should only apply to one random instance.

    If your speech bubble is displayed for multiple enemies, then you are doing something wrong.

    Also, I forgot one thing - after 3 seconds you should add "Sad Unpin" event.

    Or, better yet, instead of making the bubble visible/invisible, pinning/unpinning it, just spawn a new bubble and destroy it after fading out.

  • dop2000

    please check:

  • I made a working CAPX file, have a look:

    https://www.dropbox.com/s/4tj54fq84j5veka/test5.capx?dl=0

    (Re-download it as I made some changes)

  • dop2000

    thanks!

    You know, I don't know.. I'm testing, but and it looks ok. But how system knows how long cloud should be displayed?

    Also hited is set for >=0.6. One shot gives them random value and all enemies got hited>6 but this cloud is showing very rarely. I need much often. Bit your script gives hope

  • In my example the cloud is displayed the amount of time specified in Fade behavior (fade in time + wait time + fade out time). Then it gets destroyed.

  • dop2000

    Maybe better will be to show cloud for third enemy, then for seven etc. But problem is when third enemy is spawned, all first 3 enemies showing cloud in same time.

    Can you hel? how show this cloud for third enemy not for 3 enemies.

  • It's hard to help you without seeing your game. Could you share the CAPX?

    How many Sad sprites do you have on your layout? Did you put Sad and Enemies in the same container?

    If you did and you have many instances of Sad sprite (for example 3 enemies and 3 Sad clouds), then you may have this problem - the cloud will be showing for all 3 enemies at the same time.

    I suggest you keep just 1 instance of Sad sprite, invisible by default. And not part of any container!

    Then you move it and pin it from one enemy to another (as in my first screenshot).

    Another way is to create a new instance of Sad sprite when you need to show it and then destroy it after it fades out.

    This is how it's done in my CAPX example, and this is probably the best way to do it.

  • dop2000

    So are you convinced to your capx file. I'll made it again.

    How many Sad sprites do you have on your layout?

    30-40

    Did you put Sad and Enemies in the same container?

    Yes

    I suggest you keep just 1 instance of Sad sprite, invisible by default. And not part of any container!

    What means" "keep just 1 instance" I'm not sure what "instance" is .

    thanks!

  • So you have 30-40 instances of Sad object.

    That's why you are having this problem. It's difficult to keep track of them - determine which ones are visible, which ones are fading etc.

    That's why I suggest removing Sad from the container. And only create one instance (one "copy" of Sad object) when you need to display it, as it's done in my CAPX.

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