Enemies with more than one Detector

Get help using Construct 2

Post » Sun Jan 08, 2012 5:18 am

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?

Vercingetorix2012-01-08 05:20:57
B
5
S
1
G
1
Posts: 52
Reputation: 1,222

Post » Sun Jan 08, 2012 5:59 am

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
B
2
Posts: 3
Reputation: 331

Post » Sun Jan 08, 2012 6:06 am

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"!alspal2012-01-08 06:06:53
B
134
S
65
G
16
Posts: 1,766
Reputation: 19,190

Post » Sun Jan 08, 2012 6:12 am

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.
ImageImage
B
73
S
16
G
6
Posts: 1,039
Reputation: 10,480

Post » Sun Jan 08, 2012 6:24 am

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?
B
2
Posts: 3
Reputation: 331

Post » Sun Jan 08, 2012 6:42 am

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 :)GenkiGenga2012-01-08 06:43:59
ImageImage
B
73
S
16
G
6
Posts: 1,039
Reputation: 10,480

Post » Sun Jan 08, 2012 6:47 am

Last edited by Yann on Sun Sep 14, 2014 10:15 pm, edited 1 time in total.
B
60
S
22
G
14
Posts: 1,479
Reputation: 16,346

Post » Sun Jan 08, 2012 7:32 am

Thanks for posting a capx Yann but Construct keeps crashing whenever I try openning itVercingetorix2012-01-08 07:35:23
B
5
S
1
G
1
Posts: 52
Reputation: 1,222

Post » Sun Jan 08, 2012 10:56 am

@Vercingetorix: what kind of crash ? Does it display a window with a message ? What does the message say ?
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 6,999
Reputation: 57,793

Post » Sun Jan 08, 2012 11:29 am

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



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.Vercingetorix2012-01-08 11:34:11
B
5
S
1
G
1
Posts: 52
Reputation: 1,222

Next

Return to How do I....?

Who is online

Users browsing this forum: austinblackbelt, mallorcaredes, Yahoo [Bot] and 3 guests