behavior of the enemy

Get help using Construct 2

Post » Mon Oct 03, 2011 4:30 pm

Hello there,

this is my .capx file :

link

i would like to know what is the best way to move the enemy and make them attack my player.

Any advice ? i'm new in C2 and this is my first project, sorry.

Regards,

mr sponkie
B
12
S
3
G
5
Posts: 174
Reputation: 4,018

Post » Mon Oct 03, 2011 8:44 pm

anyone can help me?
B
12
S
3
G
5
Posts: 174
Reputation: 4,018

Post » Mon Oct 03, 2011 9:25 pm

I'd suggest you to check this topic which is pretty much the solution I'd recommend to you, making all the "hitboxes" invisible.

Edit: Nice art by the way.Kyatric2011-10-03 21:35:34
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 » Tue Oct 04, 2011 6:51 pm

please kyatric,

i need your help again :((

i still don't understand why my enemy don't turn right when he collide with "tornaindietro" object.

I think that all should works fine but it not works properly.

linkmrsponkie2011-10-04 18:52:38
B
12
S
3
G
5
Posts: 174
Reputation: 4,018

Post » Tue Oct 04, 2011 11:10 pm

It has to do with the positioning of the origin point.
I tried to move the origin point in "camminadestra" animations to position it on the shield in each frame, and the movement work as intended.

If you don't want to change the origin point, instead of using two instances of "tornaindietro", make one object for the left boundary, one for the right (with different names) and on collision with either the first or the second object, set the boolean (don't just toggle it) to either "true" or "false".
This way you'll have a defined direction, and it doesn't matter how many times the ennemy sprite collides with the "detector" it will set it to one and only one direction.

I hope I'm being clear, let me know if not.
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 » Tue Oct 04, 2011 11:30 pm

ok now it works thank you !!! :)))



linkmrsponkie2011-10-04 23:32:04
B
12
S
3
G
5
Posts: 174
Reputation: 4,018

Post » Thu Oct 06, 2011 7:02 pm

Dear Kyatric,

so maybe i didn't choose a simple game as my first project with C2, but anyway i want to go ahead and make what i've in mind.
For now i made a simple player that can jump and destroy one enemy, the problem is when i add another enemy and i want to destroy him, bot enemies die. How can i fix this ?

linkmrsponkie2011-10-06 19:03:29
B
12
S
3
G
5
Posts: 174
Reputation: 4,018

Post » Thu Oct 06, 2011 7:54 pm

It is so because at the moment you have a global variable acting as the "health counter".
Once this health counter is null (0) you destroy all the instances "nemicosinistra" (not a peculiar one).

To solve this, your health counter should be an instance variable of "nemicosinistra".
When you test if the instance variable "health" of the object type "nemicosinistra" is equal to 0, then C2 will pick the instances which "health" variable is equal to 0.

For this you can check back the beginner's tutorial which clearly demonstrate this principle in page 6.
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


Return to How do I....?

Who is online

Users browsing this forum: heliogame, WhosWho, Yahoo [Bot] and 20 guests