Duels with multiple sprites

  • Hello everyone,

    I galley for a moment to know how to solve my problem.

    Description:

    I have knights and monsters on the same line.

    The knights move to the right and the monsters move to the left.

    When they meet, they fight.

    What I have today:

    There are several monsters that fight several knights at the same time (superimposed sprites).

    And the more time goes by, the more monsters and knights stack up in the same place, against each other.

    What I would like to have:

    When a knight meets a monster, he throws a "duel". The other knights or monsters who encounter this duel pass by and provoke another duel if he meets another entity.

    When an entity wins its duel, it advances to meet another enemy and causes a new duel.

    I do not know if it's really clear and sorry for my bad english.

    Thank you in advance for your help !

  • Hiya, gameplay like this is always a little tricky but you can take duelling objects out of the equation by using instance variables. You can say if a knight overlaps a monster, start a duel, this could be a function or just an event. You set an instance variable on the knight and monster to true (boolean), or to some value to show that it has been picked and is duelling i.e. changing a 0 to a 1.

    Then you use the following logic in general, knight is overlapping monster and monster has not been picked (variable is not set) then start a duel. Therefore if the monster is picked then the knight will walk past it and look for another one.

  • Hi plinkie !

    Thx for your answer. I will try this tonight :)

    I'll tell you if it worked

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hi,

    I tried that.

    However, I still block.

    I identified variable 1 as a duel and variable 0 (initial) out of combat.

    Then I said:

    - when overlapping between a knight and a monster, the variable goes to 1. I also indicate that the knight and the monster must be in state 0 for this event to occur.

    - variable 1 activates, I say that the two entities must stop and attack.

    It works in part.

    However, the victors of the fights do not return the state 0 and therefore no longer move, it remains frozen.

    I can not resume the loop, even indicating that in state 0 and each tick, it must resume movement.

    Another small thing, the entities that participated in a duel, no longer participates in any other duel (as it did not return to state 0 to resume the loop).

    I do not think it has to be complicated, but I tear my head off.

    Thanks for your help.

  • Hiya, that depends on your conditions for ending the duel, which you didn't mention above, this was only the start of the duel. What did you use for ending the duel? You have to be careful with 'picking' when you use this type of logic. It will be easy to set a knight back to 0, just about finding the right one :)

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