How i do setup platform wars game?

Get help using Construct 2

Post » Tue Jul 02, 2013 12:34 pm

@yosualb
Ok, so, I looked more into your problem.
The state changing was a good solution, I tried it, it worked.
I commented my code a lot, so you can understand why I did what I did. If any question rises, just ask :)
.capx
B
17
S
8
G
4
Posts: 461
Reputation: 6,107

Post » Tue Jul 02, 2013 1:16 pm

@Guizmus, thank you for replying
your .capx for r136
maybe i must download it first
btw, thank you
B
16
S
2
Posts: 39
Reputation: 717

Post » Tue Jul 02, 2013 1:18 pm

Yep, sorry, keeping up to date with the beta releases :)
I use the "timer" behavior, you'll need r136 to read it anyway :/
B
17
S
8
G
4
Posts: 461
Reputation: 6,107

Post » Tue Jul 02, 2013 2:24 pm

@Guizmus, thank you for replying
i just wanna ask about Player.UID,
does Player.UID cover the one player or all player?
maybe we can use Player.IID for cover the one player only (CMIIW)
so if the 3 Player and 2 Enemy with same HP, atkpow, and atkspeed and the winner is player with 2 Player left.

here is the simulation :
Player with 5 HP, 1 atkpow, 1 atkspeed
Enemy with 5 HP, 1 atkpow, 1 atkspeed

1st atk -> 2 Player (full HP) 1 Player (3 HP) and 1 Enemy (full HP) 1 Enemy (2 HP)
2nd atk -> 2 Player (full HP) 1 Player (1 HP) and 1 Enemy (full HP)
3rd atk -> 2 Player (full HP) and 1 Enemy (3 HP)
4th atk -> 1 Player (full HP) 1 Player (4 HP) and 1 Enemy (1 HP)
5th atk -> 1 Player (full HP) 1 Player (3 HP)
B
16
S
2
Posts: 39
Reputation: 717

Post » Tue Jul 02, 2013 2:43 pm

@yosualb
Player.UID is the UID of the selected player. For ensuring every player selected/every enemy selected has events 3 - 6 applied to them, you can just add a sub-event in each, cycling through the selected player/enemy. Using player.IID instead wouldn't help at all. on the contrary, the function "changeState" couldn't find the correct character.
If I'm not mistaking though, using a foreach should be useless. In the current state, the function should be called one time per player meeting the condition. (I could be mistaking though, better way to know is to use a debugger, here is mine)

But to debug and test as precisely as you want, you should put up some textDisplay per enemy/player, it's hard to know for now the real state of every characters. Using a container seems to be the way to do it, as there will never be a character with no life. And later you could replace it with a life bar if you prefer.

I moved the variables you used on player/enemy on their common family, character too, try to do this when things have the same comportment in game (bullet, life, attack speed, ...)

Plus, I would add a random Y (not a lot, just a little) so all characters are not above each others, and still trigger the collision detection.

Btw, if you want to push your program further, you should try to get rid of this every tick with 4 collision detection... it's costly, and in your case, you could just compare the maximum X of player and minimum X of enemy, to know where the fight is happening. It would be a lot easier on the CPU.
B
17
S
8
G
4
Posts: 461
Reputation: 6,107

Post » Tue Jul 02, 2013 2:57 pm

@Guizmus, thank you for replying
i understand just now after i read your code slowly
but i got the question again, if i have enemy and player with same spesification*, with your code
why the player always win? and the enemy attack only once?

(*)
HP = 5
AttPow = 1
AttSpeed = 7
The winner is player with 4 HP
B
16
S
2
Posts: 39
Reputation: 717

Post » Tue Jul 02, 2013 3:12 pm

@yosualb
They don't have the same specifications in what I wrote. Click on the player and the on the enemy, you'll see.
Enemies are attacking for 1 damage every 5 seconds, player every 2 seconds for 2 damage. It's normal the player wins ;) Just check the object Properties, not their common family.

An no problem for everything, no need to thank ^^
B
17
S
8
G
4
Posts: 461
Reputation: 6,107

Post » Tue Jul 02, 2013 3:58 pm

@Guizmus, thank you for replying
no no, i already edit your specifications with my specification.

in my investigation, its like if the collision sprite is stand at rather left, the first player sprite only attack once,

and if the collision sprite is stand at rather right the first enemy sprite only attack once

sorry for my thank, but its my style at forum
B
16
S
2
Posts: 39
Reputation: 717

Post » Tue Jul 02, 2013 4:00 pm

@yosualb
Could you re-send me the last version so I can take a look ? I'll come back to you on the subject later, have to go now, but you are not far from getting it working ! Faith and Courage ! (ok, this was too much)
B
17
S
8
G
4
Posts: 461
Reputation: 6,107

Post » Tue Jul 02, 2013 4:10 pm

@Guizmus, thank you for replying
here is Collision Test(1).capx

oh yeah, i got an enlightenment,
if the collision position rather right because the player overlaping the enemy and enter the first if condition
if the collision position rather left because the enemy overlaping the player and enter the third if condition

maybe you can add something for equalize them?

[UPDATE]
hmm, i think the timer is the problem
if i spawn player first, and then spawn enemy
the timer of enemy is didnt start, any idea?yosualb2013-07-02 17:06:51
B
16
S
2
Posts: 39
Reputation: 717

PreviousNext

Return to How do I....?

Who is online

Users browsing this forum: bambang150, conker23, Janaina, LaurenceBedford, lucaralho and 6 guests