How do I get the logics to work for this game?

Just started using Construct 2? Post your questions here

Post » Sat Jun 07, 2014 6:07 pm

Hey everyone,

I am currently trying to design a game where units get spawned on both sides of the map. The AI spawns units from the right and the player spawns units from the left. Units will walk over the battlefield, once they collide they fight.

The problem I am having is I can't get them to fight correctly. When I get the units to collide they start the "attack" animation and every collision they -1 from the respective HP. When the units stack up they keep a constant collision resulting in the damage not registering and neither unit losing HP.

I have tried:
- Every Collision -1 HP
- Every X Seconds on overlap -1 HP but when they stack they don't drop HP fast enough.

Is this game type not possible with construct ?

http://www.sendspace.com/file/84whm0 this is the .capx file.
B
7
S
1
Posts: 25
Reputation: 477

Post » Fri Jun 13, 2014 7:03 am

your capx is broken.

Beside collison, add another condition that only - hp when the attack animation reach certain frame.
Like frame 4 is the sword going down so can minus hp at that moment.
B
6
Posts: 10
Reputation: 300

Post » Sun Jun 15, 2014 2:34 pm

@solado

I'd check not on the "On collision" event, because it "fires" just once.
I'd use the overlapping event or every x second I'd check if the distance between the two sprites is less than x
I'm not a insane, my mother had me tested

I'm an engineer. To save time, just assume I'm never wrong
B
30
S
13
G
4
Posts: 141
Reputation: 4,832

Post » Mon Jun 16, 2014 9:21 pm

It wouldn't work as the sprites seem to sync up over time.

I have switched to unity as actually hard coding seems alot easier to work with for games of this nature.
B
7
S
1
Posts: 25
Reputation: 477

Post » Sat Jun 21, 2014 10:35 pm

i would have done something like,
on collision set variable to collided uid,
collided uid exists - play attack animation
on attack animation finished subtract dmg from enemy with collided uid
B
6
S
1
Posts: 51
Reputation: 502


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 1 guest