How do I get access to specified object

0 favourites
From the Asset Store
Welcome! I-Spy (Hidden objects) is an educational puzzle that is more than just seek-and-find activities.
  • Hello!

    I have a problem. I'm trying to make game with combat system without collisions.

    Imagine a layer with 3 sprites: player, enemy, enemy. Enemies is from one sprite.

    What I want:

    Player hits an enemy, 1 enemy is destroyed.

    What I have:

    Player hits an enemy, all enemies are destroyed.

    I think that I need somehow specify object, but I don't know how.

    Can someone help me?

  • Hi NeronSparda!

    I assume you are new to Construct? You should read some beginners tutorials, and keep the manual in your bookmarks, it really helps to solve most of basic problems.

    Your problem is about picking the right instance of an object. An instance is pick when it fills a condition. From what you described, your event should look like this :

    Player - On collision with Enemy

    Player - Animation "punch" is playing

    -> Enemy destroyed.

  • Sorry, but your advice doesn't fit my problem.

    As I said before:

    I'm trying to make a game with combat system without collisions

  • You need to post your capx or at least a screenshot of your event sheet.

  • Is there anything in this capx that might help you

    drive.google.com/open

    or this

    drive.google.com/open

  • I thought you don't want to use collision checks? "Is Overlapping" condition in your first capx still uses them. And those events #2 and #6 from the second capx make absolutely no sense.

    If you don't want to use "On collision" or "Is overlapping" events, you can use "Pick nearest enemy to player", and/or compare distance between player and enemy and pick enemy instance within some short distance.

    Keyboard on Space pressed
     Enemy pick nearest to player.x, player.y
     distance(enemy.x, enemy.y, player.x, player.y)<20 : enemy destroy
    

    Still don't understand your problem, as in both your capx only one enemy instance is destroyed at a time.

  • Dop2000, a different poster totally, they are not his capx files, just some experiments that were on my drive.

  • Sorry, but your advice doesn't fit my problem.

    As I said before:

    >I'm trying to make a game with combat system without collisions

    I have to ask. Why no collisions ?

  • Sorry, but your advice doesn't fit my problem.

    As I said before:

    >I'm trying to make a game with combat system without collisions

    Whoops, sorry, I missed that. However, then, how the player is supposed to hit the enemy?

  • Dop2000, a different poster totally, they are not his capx files

    Oops, my apologies! This whole topic is quite confusing.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • > Sorry, but your advice doesn't fit my problem.

    > As I said before:

    > >I'm trying to make a game with combat system without collisions

    I have to ask. Why no collisions ?

    Because player and enemy will fight with some distance between them.

    It's a game with grid-movement system.

  • If you don't want to use "On collision" or "Is overlapping" events, you can use "Pick nearest enemy to player", and/or compare distance between player and enemy and pick enemy instance within some short distance

    It won't work, because it's possible to have more than 1 enemy at the same distance.

    Example:

    androidapplications.ru/uploads/posts/2016-03/1458729930_the-greedy-cave-3.jpg

  • Because player and enemy will fight with some distance between them.

    It's a game with grid-movement system.

    Well... Isn't there any collisions event at distance? In any case, you could create invisible projectiles to determine easily which enemy is hit. If you don't want to, you'll have to be more specific on what you did and what you want to achieve.

  • It's all about picking. You can first pick enemies by distance. If your event picked multiple enemies at that distance, then you pick one enemy from them by some other criteria - for example, the enemy with lowest health, or simply random. And then fight that enemy.

    RadYan is right - you have to be more specific.

  • Do I understand right: there is no possibility in Construct 2 to pick enemy by ID or something?

    I know, that I can create an empty sprite and use it to hit enemies. Just wanted to make it more clear.

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