0 Favourites

...control multiple (pinned) entities of same type

  • Hello Guys,

    I have problems controlling composite entities. What I need is an object consisting of multiple sprites. The reason for that is that each sprite should start its animation in parallel. Example: Enemy consists of leg sprite and torso sprite. When the player gets near it should start walking in the direction of the player turning on movement animations of leg and torso sprites.

    Here is an example project that doesn't do what it should. For each torso (redSprite) I create a leg (greenSprite) and pin the torso to the leg.

    dl.dropbox.com/u/40417570/Tests/MultiSpriteProblem.capx

    Movement animation is symboled with the flashing behaviour.

    Problems:

    • multiple legs are spawned for each single torso (!?)
    • torso doesn't move with legs
    • torso doesn't start its animation

    The main problem arises with the need of multiple enemies of the same type. I got everyting working with only a player and one enemy.

    The examples I've seen that use multiple enemies only do basic stuff (moving a single sprite, no animation).

    I would appreciate any help!

    Michael

  • See if this is what you want : http://dl.dropbox.com/u/2472278/Files/MultiSpritePossibleSolution.capx

    Basically you had some problems with loop arrangement , use of trigger once etc, and mainly you had to save the torso UID on their legs to refer to them later. I also changed the movement with Bullet, to a move at angle calculating the angle between the player and the enemies.

  • Thanks alot Kiyoshi, it works pretty well, even though there are still some issues but the big question about how you can reference items from other items is answered (using the UIDs). That will help me alot.

    (Btw. the link refers to something else, but using the address I could download the project.)

  • Glad that i was of help. Well the link problem must be a forum bug since i used the Insert Hiperlink button.

  • Sorry to come up with this again. But I'm facing a problem that seems to be a bug to me. I updated the solution given before to stop animation (blinking effect in sample) if the player leaves the field of sight. It works well with the given 100 pxl but when changing the range say to 200 things become ugly. Now often the animation is not triggered but the enemy moves towards the player (which in fact should never happen). I added a global variable "Range" to easily updatate the value. How can the distance between the player and the enemy have such a strong effect?

    Thanks for any help.

    Ps: What is the best approach for something like an else case. So far I just copy the previous condition and invert the statement but this seems very inefficent to me (code duplication).

  • After playing around with a single sprite version (having the same problems) I found out that the System->TriggerOnceWhileTrue condition doesn't do what it should (trigger animation only once .. for each sprite)

    I changed it to set a bool on each sprite (flashing) which basically should be the same, however here it works.

    http://dl.dropbox.com/u/40417570/Tests/SingleSpriteWeirdBehavior.capx

    I did the same for the multisprite project with some more astonishing results. All sprites except one (the first created?) work ?!

    http://dl.dropbox.com/u/40417570/Tests/MultiSpriteWeirdBehavior2.capx

    I really like this toolkit, but it gets rather fast frustrating to work with.

  • Fixed

    It was just a matter of reorganizing the events. (I fixed the very last version you proposed "MultiSpriteWeirdBehavior2")

    And there is a big range, making all of the ennemies in range from the beginning.

    You don't need to have billions of "for each" loops.

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • Wow, that was quick. Thanks a million. So it was the dummy object that one needs to create outside for using dynamic objects. Good for pointing out the loop overhead, I feel abit stupid now though :-(

    I still don't know the use case of system->trigger once but I'll try to avoid it now...

    Michael

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread hot topic
135 14,291
melaniko's avatar
melaniko
Unread hot topic
102 26,807
HERBERT HEINZ's avatar
HERBERT HEINZ
Unread hot topic
0 Favourites
Isometric multiple floors
74 9,716
eleanorawesome's avatar
eleanorawesome