Enemies with more than one Detector

  • Hi

    For the enemies in my platform game I need several objects to act as detectors for determining when the player receives damage or deals damage to an enemy, so I was just wondering how I go about assigning detectors to sprites, & destroying them all when they are defeated and that sort of thing?

  • I am trying to figure this out as well. Seems like the most basic of all platforming tropes, you jump on an enemies head and it dies, it bumps into you, you die. How do we achieve this?

    Thanks for any help. I am new to construct, I like it so far. I look forward to tinkering around with it more and seeing what it can do

  • I presume Ashley will eventually add "containers" (what they were called in Construct Classic) which are especially useful for situations like this, and save a lot of hassle. Just hope they come after "families"!

  • If you have a look at each of the examples in the c2 examples folder in detail - as well as the tuts and faq. I think it would give you a good basis to achieve the things you want in most games.

    Each sprite has any number of "image points" (the number is up to you). Double click on your sprite and add image points. Then add your detectors. Finally you need to add the code for what happens when the enemy touches a paticular image point.

    Hope this helps.

  • The only work around I have figured out is making a separate pair of sprites for each "enemy" one for the enemy itself, and another invisible trigger just above his head. This works ok, but It would be nice to how link the two on a variable level instead of having heaps of separate sprites (and events! totally inefficient).

    Is there anyway to connect two sprites, not just on a physical level like "pin" but to share variables (i.e. health, etc)?

    someone has to have made a game where you jump on enemies heads by now, right?

  • Ah ok, maybe i misunderstood. I agree that its inefficient as it stands (Ashley is currently working on families right now). Its probably not as bad as you think though.

    The first project i was working on was a td style of game. You can get away cloning your enemies if they have simple mechanics like target x and move in - attack when at x distance. Also - say i set that enemies life at 100 - All of my cloned enemies have 100 life (they dont share life). If you did want to share life you could make it a global variable - and deduct points from that each time one of your enemies is hit.

    Look up the mod Kyatric and click on his sig (i wonder if his ears are burning again). I know i was pleasantly surprised the first time i did :)

  • Thanks for posting a capx Yann but Construct keeps crashing whenever I try openning it

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Vercingetorix: what kind of crash ? Does it display a window with a message ? What does the message say ?

  • At first the file appears to work for like a second and then these windows pop up

    <img src="http://i260.photobucket.com/albums/ii35/Overking1/Construct-2-Problem.png" border="0" />

    and it only ever happens with that file every other capx I've opened works fine, maybe I should try downloading it again and see if it works then.

  • Indeed maybe a corruption on download. Strange though.

    I've just downloaded the file, it opens and previews in r74.

  • I downloaded it again and checked that I've got the latest version of Construct 2 installed as well, it still isn't working the same message pops up and it closes.

  • I'll try something

  • Vercingetorix

    Is it better?

  • Works for me, Yann.

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