How do I make 2 monster run and combat with each others

Just started using Construct 2? Post your questions here

Post » Mon May 18, 2015 2:01 pm

uhm :)
sorry about my bad english!

I created 3 monsters (in team A) in line combat with 1 monsters in team B. But A team come near by and hit each others. I control monster by using variable: team.

my condition:
monsters => collision with any monsters | monsters play "atk" animation.

My wish: monster => collision with monster in different team | monsters play "atk" to monster in different team.

how can i solve this problem?
nothing
B
14
S
5
G
2
Posts: 20
Reputation: 1,576

Post » Wed May 20, 2015 11:34 am

To help solve the problem you should provide your capx alongside your post.
Posting your capx will make it easier to see what the issue might be. Provide it in a online hosting file service like dropbox or google drive, whatever suits you best.
New to Construct ? Where to start

Image Image

Image Image

Please attach a capx to any help request or bug report !
Moderator
B
294
S
117
G
96
Posts: 7,313
Reputation: 71,094

Post » Wed May 20, 2015 3:29 pm

Message: bomt is not yet permitted to post plain text URLS (300 rep required). 1 URLS removed. Why?
ok Kyatric,

this 's my file,Thanks you :)
nothing
B
14
S
5
G
2
Posts: 20
Reputation: 1,576

Post » Wed May 20, 2015 3:30 pm

Here you are !
https://www.dropbox.com/s/ao363ggmwtau4xt/ChinhChien.capx?dl=0
nothing
B
14
S
5
G
2
Posts: 20
Reputation: 1,576

Post » Thu May 21, 2015 4:35 am

@bomt

You can do like this,

1. give each monster an instance variable by right click at the object > instance variable > add > Name it "Team" and give Initial value to either text or number; text as A/B or number as 1/2

2. On the event, Object(monsterA) on collision with another object(monsterB)

3. Add another condition to the event | object(monsterB) compare instance variable (team variable) = to B or 2

4. give action to the event | monster play "atk" animation

*meaning if monster from team A hit something and that thing has instance variable of B, it will atk, else it won't
* and you have to give the same concept to monster of team B also to see if it collide with monster team A.


This should solve your problem.

Cheers!
B
9
S
2
G
1
Posts: 13
Reputation: 669

Post » Sat May 23, 2015 6:48 am

thanks for your help :)
nothing
B
14
S
5
G
2
Posts: 20
Reputation: 1,576

Post » Sat May 23, 2015 6:51 am

My requirement is:
- Player A has 5 type armies eg: A, B, C, D E
- Player B has 5 type armies eg: A, C, F, G, H.

1) becasue there armies has same behaviours => i put it in 1 families call Army (Now A, B, C,D,E,F,G,H in 1 family). is it ok?
2) i check collision by army to army? is this ok?!
nothing
B
14
S
5
G
2
Posts: 20
Reputation: 1,576

Post » Sat May 30, 2015 10:42 pm

@bomt,

Add the Pathfinding behavior to all of the monsters, and in your eventsheet, add the following code:

System >> On start of layout <Add another condition> System >> Pick random MosterB instance | MonsterA >> Pathfinding >> Find path to MonsterB
MonsterA >> On path found | MonsterA >> Move along path

MonsterA >> On collision with MonsterB | MonsterA >> Stop moving along path <Add another action> MonsterA >> Set animation to "atk" (play from beginning)

Now make the same events again, but switch all of the MonsterA references with MonsterB and all MonsterB references with MonsterA.

Does that help?

theman3446~
Life is good. Have another piece of chocolate.
B
15
S
3
G
1
Posts: 28
Reputation: 1,133

Post » Sat May 30, 2015 10:45 pm

oh whoops it was already solved by chanchino... :oops:
Life is good. Have another piece of chocolate.
B
15
S
3
G
1
Posts: 28
Reputation: 1,133

Previous

Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 1 guest