Enemy movements; multiple characters; and for each

0 favourites
From the Asset Store
Be quick and choose the right answer for the shown equation.
  • Hi!

    I made a thread before about a grid game; thought of putting this in that thread but I have progress a lot so I feel appropriate to post some questions in a new thread.

    dropbox.com/s/4wb280i50dyyk8x/Galah%20Panjang.capx

    Above is my current .capx file. I just finished doing the core structure of the game with just one level for now.

    So far, I managed to make the enemy's movement to worked, although still very glitchy. Sometimes it keeps going to the left at the start of the screen or when it killed my character sprite.

    Speaking of which, do I need to use the For Each to apply the same conditions and events to multiple characters and enemies? Or do I have to do it individually?

  • You should edit the groups "enemy has target" and "enemy no target" and set them to not active on start. That takes care of the problems at start.

  • I see.

    Thanks!!

    Any idea what I should do for multiple character sprites and enemies?

  • Ok, I got kinda lost: how should I edit the "enemy no target" and "enemy has target"??

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Right click on the group name, choose edit, remove the thingie from the checkbox active on start.

  • *facepalm*

    I didn't see that...

    Thanks dude!!

  • So I've been organizing the events:

    <img src="http://i220.photobucket.com/albums/dd69/RedBrick17/Construct%202%20final%20year%20project/Enemymovement-1.png" border="0" />

    <img src="http://i220.photobucket.com/albums/dd69/RedBrick17/Construct%202%20final%20year%20project/Enemymovement2-1.png" border="0" />

    The second enemy (blue) reacted when the character (cyan) is close to enemy 1 (yellow). I kept the enemies inside the Enemy Family so that I don't end up having to make the same events for each enemies. Is there a way to make enemy 2 react only when my character is near it rather than being near enemy 1?

    Also, I plan to make the third enemy to move in the direction of those red lines. How to apply different events for the enemies while still retain them in the family folder?

    Here's my current .capx file:

    dropbox.com/s/4wb280i50dyyk8x/Galah%20Panjang.capx

  • You can still reference your objects by their own name even though they are in a family.

    So you could have events that are the same for all family members and events that are just for enemy 1, or enemy2, or enemy3 sprites.

  • I see. Thanks!

  • But in this case I think adding a for each family condition to the two target detection events would work.

    Oh, on second thought, adding a condition to the has target events is necessary. Add a condition has target to those two events and the above mentioned for each shouldn't be necessary..

    The has target events now affect all family members when the group is activated.

  • You mean like this?

    <img src="http://i220.photobucket.com/albums/dd69/RedBrick17/Construct%202%20final%20year%20project/ForEachhastarget.png" border="0" />

  • No, that's not it, That's an event without any actions attached, so essentially useless for it doesn't do anything.

    Right click on the x<charavters.x and add another condition enemy boolean has target and do the same for the x>characters.x

    That should help with having only having the enemies with target set to true follow the player.

  • Also you probably shouldn't deactivate the group has no target, for there are still enemies that don't have target, right?

  • Wow!! It finally worked like the way I wanted!! Thank you so much!

    I tested with the not deactivating group has no target but somehow no difference. I'll test that again tomorrow. Calling it a night. :)

  • Is it possible to make the third enemy to move in the directions of those red lines using pathfinding? (At the same time, I don't want to complicate myself with so many Behaviors... :P )

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