GabrielBalas's Forum Posts

  • Thank you so much.

  • I'm not sure how you want the fireball to work if it shouldn't be a guided missile.

    If you simply want to spawn a fireball with the needed angle of motion, you can do this:

    • Pick the correct enemy with the condition Pick by UID, use the Turret expression TargetUID for this
    • Under that condition, create the fireball on the position of the dragon
    • Set the fireball's angle of motion to the system expression angle(Dragon.X,Dragon.Y,Enemy.X,Enemy.Y)

    Don't know whether this is what you want though..

    I have already done the part off the fireball's angle. But now I'D like to solve the pictures' problem. Can you help me?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I have a dragon that flies in the air above the enemies.

    When some enemy enter the radius range of 280 of the dragon, it stops moving (set bullet speed 0) and starts the attack animation. In the attack animation the dragon spawns a fireball that have 300 of range and 1000 of rotate speed. But i don't want the fireball to act like a guided missile. I want the ball to be spawned with the necessary angle of motion to hit the target in the dragon range without using turret behavior in the fireball.

    After this i want the dragon to choose another target when the enemy is 90º under him or pass to behind the dragon. Just like in the images below.

    Shooting the first one.

    First one get on off the "realistic view" then choose another

    Nobody in the "realistic view" then keep flying in the way.

    How can I make it?

  • drive.google.com/open did a quick mock up of what I think you are trying to do .capx is downloadable, hope this helps.

    Hey bro, I made everything that is on the capx but even this way my fireball don't change its intial angle. What may be the problem?

    I want my dragon to spawn the firebbal in the frame "7" and shoot it on the nearest enemy (on the ground or in the air).

  • I want my fireball, when created, to take the necessary angle to the nearest enemy, that makes part of the "bad" family.

    How do I do it?

  • I did it. Thank you so much for the attention and the help.

  • I thought it worked but don't worked.

    I've made this way but the arrow and the badsoldier are killing every instance that they collide.

  • Should I place all 4 subtract actions together?

    Like this?

  • Here it is . Sorry for the language, i hope you can understand.

  • yes, but when i make the action "Subtract 25 from vida" i can't especify to subtract only of the "instance 0" picked in the condition and then the damage go for all clones of the object type

  • But I want the bad soldier to hurt only one enemy at time, even when they're overlapped. For this he needs to choose on of the overlapped object types first and then choose one of the clones of this object type.

    The enemy soldier already can choose one of the overlapped clones but he can't choose just one of the overlapped object types. In a "good" group made of archers and soldiers, all overlapped, the enemy soldier hurts only one of the overlapped soldiers but he hurts at same time one of the overlapped archers. I want him to choose only archers or only soldiers and then one single of the choosed group.

  • I'm having problems when I wnat my enemies to hurt only one enemy at time . They already choose only one clone of a object type to attack, but they hurt one clone of each object type of the family.

    For example: When a "bad soldier" hits a "good soldiers" group it only hurt one of the soldier in the group, but at same time hurts a "good archer" that isn't in it's attack range just because the good archer make part of the same family that the good soldier.

    My code is:

    When "bad soldier" is overlapping "Good" family

    >System pick "Good" instance 0.

    >System pick "GoodSoldier" instance 0.

    -Make damage

    >System pick "GoodArcher" instance 0.

    -Make damage

    So how can I make the "bad soldier" hurt only the object type "good soldier" or "good archer" (the closest one) per time?

  • You mention that your enemies are "clones" of each other, which is fine. Is each "clone" though, just a SINGLE enemy as the sprite or do you have like 2 or 3 enemies per sprite that act as one object?

    If each enemy is it's own individual "clone" then you simply need to use object picking nearest/furthest as mentioned by celstrider. He basically explained in a shorter way what I was talking about in my post before. Just pick the enemy that's closest to your defender, and apply the damage to that enemy only (because you picked it specifically based on it's distance to the defending player).

    I think the reason that it's damaging ALL units right now, if because it hasn't been told to pick ONE unit specifically.

    ----------------------------------

    If overlapping ENEMY

    -> deal damage to enemy

    This will cause ALL enemies to be damaged when only ONE enemy is being overlapped.

    ----------------------------------

    If overlapping enemy & distance to enemy is less than 10

    -> deal damage to enemy

    This will cause only enemies that are within 10 pixels of you to take damage.

    ----------------------------------

    If overlapping enemy

    -> pick enemy closest to player

    ---> deal damage to enemy

    This will cause only the enemy that's closest to the player/defender/arrow to take damage.

    ----------------------------------

    The key is to make sure the game knows WHICH enemy you want it to pick, otherwise it will simply pick them ALL whenever there is overlapping.

    Hopefully this helps a bit more

    ~Sol

    IT WORKED!

    Thank you so much! You're awesome!

  • You can do this in a few ways... I'm guessing that your enemy units are all individual sprites, and not one sprite that represents a whole group of enemies?

    If they're all separate, you can set the target to the projectile when the projectile is being created (on shoot). You could make some instance variables for the arrow, or the soldier, and call them something like TargetX and TargetY. Then you can pick the enemy that's closest to your defending unit, and set the instance variables TargetX and TargetY to be the coordinates of the enemy.

    You can then use the coordinates (pick by comparison) to tell your soldier or arrow which unit to apply damage (and also to trigger to destroy your arrow sprite). Simply compare the TargetX and TargetY values to the coordinate position of the enemy. I would recommend setting a comparison RANGE of say, 3-5 pixels or more (depending on the size of your graphics).

    Hopefully this hint helps. If you still have problems just let me know here and I will see if I can make a quick example.

    ~Sol

    Hi, thanks for the atention.

    The sprites aren't individual sprites, they are all clones made by the system to defend the "CPU's" castle.

    My event sheet of the soldier being attacked by another soldier is:

    EnemySoldier is overlapping Soldier

    Is "Attack" animation playing.

    Animation frame="4"> Soldier subtract 25*EnemySoldier.PickedCount from life.

    The event for the arrow is:

    Soldier On collision with Arrow > Subtract 15 from vida.

    And then i'd like to maintain this codes and add the necessary to make sprites choose just one enemy at time to fight, and the arrows hurt just one enemy even when they are overlapped.

    A great exemple of what I'm talking is the game EpicWar 1 and 2. Even when the troops are all overlapped, they aim at only one sprite at time.

  • I'm making a project where you have your castle and need to defend him by sending troops that will fight the enemy troops and attack the enemy castle.

    When the troops begins to fight each other, they hurt all enemies that are being overlapped by them. A soldier dies with 4 hits of another soldier, this way, a single soldier can kill 3 overlapping enemy soldiers with 4 hits, a single arrow hurts 10 overlapping enemy soldiers, etc.

    I would like to fix this and make a soldier fights and hurts only one of the overlapping enemies in its front, make an arrow hits only one of the overlapping targets.

    How can I do it?