How i do setup platform wars game?

Get help using Construct 2

Post » Mon Jul 01, 2013 6:10 pm

Hello friends,
Now i try to make platform wars game, like Cat War 2

I got the problem when player and enemy had collide or overlap,

I dont have an idea for implementing their attack animation with number of damage and number of attack speed (aspd)

And there are no idea for implementing if more than 1 player sprite and more than 1 enemy sprite had collide or overlap.

i want all player attack one enemy and all enemy attack one player

here is my simple algorithm :
1. if player collide or overlap with enemy, player and enemy are stop.
2. player do "Attack" animation, with delay per animation
3. enemy do "Attack" animation, with delay per animation
4. if player "Attack" animation is finished, player attack set to 1 and do "Walk" animation
5. if enemy "Attack" animation is finished, enemy attack set to 1 and do "Walk" animation
6. subs player HP with enemy attack
7. subs enemy HP with player attack

here is C2 simple algorithm :
=== General Event ===
System: Every tick ->
For each: player ->
For each: enemy ->
   Player: collide with enemy -> Player: set speed 0
      --- or ---              -> Enemy: set speed 0
   Player: overlap with enemy -> Player: substract Enemy.Attack from HP
                             -> Enemy: substract Player.Attack from HP
    Every 3 second -> Player: set animation "Attack" (beginning)
    Every 3 second -> Enemy: set animation "Attack" (beginning)

=== Player Event ===
System: Every tick ->
Player: is "Walk" animation playing -> Player: set attack to 0
Player: is "Attack" animation finished -> Player: set attack to 1
                                        -> Player: set animation "Walk"

=== Enemy Event ===
System: Every tick ->
Enemy: is "Walk" animation playing -> Enemy: set attack to 0
Enemy: is "Attack" animation finished -> Enemy: set attack to 1
                                       -> Enemy: set animation "Walk"

here is my troubles :
1. When 1 player collide or overlap with 2 enemy, 1 player attack to 2 enemy (should be attack to 1 enemy)
2. When 1 player collide or overlap with 1 enemy, player attack delay (attack speed) is faster than enemy attack delay (attack speed) whereas the attack delay for them are same

here is my simple .capx :
Collision Test.capx

Give me an idea or sample code please
Thank you.

Regards,
YosuaLByosualb2013-07-02 11:42:33
B
16
S
2
Posts: 39
Reputation: 717

Post » Mon Jul 01, 2013 8:21 pm

Read the frist tutorial!
B
10
S
2
G
2
Posts: 81
Reputation: 1,757

Post » Mon Jul 01, 2013 11:32 pm

[QUOTE=pablolink23] Read the frist tutorial![/QUOTE]
thanks for replying,
i already read the tutorial,
but the tutorial in only for 1 on 1 player and enemy with simple case

please check the updated post
B
16
S
2
Posts: 39
Reputation: 717

Post » Tue Jul 02, 2013 3:50 am

someone help me please
B
16
S
2
Posts: 39
Reputation: 717

Post » Tue Jul 02, 2013 7:36 am

I've never made a platform game yet, so I don't have specifics.

Would "Picking" the top most enemy when more than one are overlapped, work?

Add the condition "Pick top/bottom" (under the sprite's z-order) to the overlap event to filter it down to just one.

You might get more help if you made up a test Capx for people to add suggestions to. What your asking is a lot of work, try to make it easy to give you an answer.
B
226
S
60
G
33
Posts: 902
Reputation: 39,989

Post » Tue Jul 02, 2013 8:54 am

@Paradox, thank you for replying
i dont have an idea for implementing like your suggestions,
i think i must use an array for player and an array for enemy,

here is my simple .capx
https://dl.dropboxusercontent.com/u/69456864/Collision%20Test.capx
B
16
S
2
Posts: 39
Reputation: 717

Post » Tue Jul 02, 2013 9:09 am

After reading your code, here is my first thought : a simple "state" value one the player/enemy object could help you a lot (could take "fighting" and "walking" as values). You can then divide your program in 2 parts :
1/ collision detection, checking if all the "fighting" objects are still overlapping with some enemy (go "walking" if not), and checking if the "walking" objects are still not overlapping (go "fighting" if not)
2/ functions
- a first one "change state" that stops/restart the bullet behavior, depending on the new state. This function is called in the 1/ every time something changes state.
- a second one "deal damage", that will be called in the "change state" function, and that will check that the objects it is called for are in the "fighting" state. This function will first deal the damage wanted, then wait for your "cooldown", and lastly call itself. The "fighting state check" at first in this function will ensure that this function ends.
B
17
S
8
G
4
Posts: 461
Reputation: 6,137

Post » Tue Jul 02, 2013 10:59 am

@Guizmus, hello thanks for replying
your alogorithm is almost same with my algorithm.
but still have a problem,
at System: Wait 10-Player.ASPD, it doesn't function because the player and the enemy still attack without delay
and
if there is many player and one enemy, enemy attack like splash attack because the player is die simultaneously
any code idea please?
B
16
S
2
Posts: 39
Reputation: 717

Post » Tue Jul 02, 2013 11:06 am

@yosualb
well, what should the system do in the end ?
Let's say there are 3 enemies and 2 players. What should hit what ? Does every player hit all enemies ? Does each player target their own enemy ? Does all player target the same enemy ?
B
17
S
8
G
4
Posts: 461
Reputation: 6,137

Post » Tue Jul 02, 2013 11:14 am

@Guizmus, thank you for replying
yeah i want to all player target the same enemy, just same as for the enemy to the player
B
16
S
2
Posts: 39
Reputation: 717

Next

Return to How do I....?

Who is online

Users browsing this forum: Cha0tiXGamer, MaujDeveloper and 11 guests