[SOLVED] Enemy AI using private variables goes crazy.

For questions about using Classic.

Post » Mon Nov 17, 2014 9:21 pm

First of all, excuse my english level, it is not my mother language.
I want to say hello to everyone in this site, sharing this hobby(?) of us. And thanks to peole on Scirra, Construct is a very useful and easy to use tool.

Let´s go to the problem:

A .cap file is linked above, this is a platform game, the character smoothly works with all the movements and states that I´ve addressed to rivate variables, can dash hitting twice, holding attack button, or even combining attack button and direction keys. Also my enemy, a little coloured cat, runs all his events correctly, states addressed in private variables also, BUT when i got two instances of the same enemy, the IA becomes crazy, and the more enemies I spawn, they weird it gets. It is supose for every enemy to get the value for itself, but instead of that, they share it. BUT (again) they not share every PV, and thats even more weird, for examle, the enemy decide when to jump in order to the value that private variable "wantjump" gets a random value every 10 ticks, they jump separatly, but the same case for attacking variable DO NOt work, when there are more than 1 enemy, they all attack at the same time, but jump randomly....

I have read the whole Construct Classic forum, I have experience in other programs that I own and I´m also a grown man, 33 years old, but about to cry with this issue. :? :? :?

Thank in advance for your help, I hope I attached right the cap
You do not have the required permissions to view the files attached to this post.
Last edited by Baconizer on Tue Nov 25, 2014 10:53 am, edited 5 times in total.
B
5
S
1
Posts: 31
Reputation: 439

Post » Mon Nov 17, 2014 9:29 pm

I forgot to mention the controls:

MOVE: arrow keys
ATTACK: D key
JUMP: S key (in air ,press again for double jump)
Ki blast: hold D
Dragon punch: up + D
Diving kick: in air, down+D
Double punch: in gorund, down+D
Dashing kick: hit twice forwards

SPACE: spawn more enemies
ENTER: destroy them
B
5
S
1
Posts: 31
Reputation: 439

Post » Mon Nov 17, 2014 10:14 pm

Oh1 I´ve realize a picking issue. if you have several instances and the code: "if player.X>enemy.x (enemy.angle=0)" and "if player.X<enemy.x (enemy.angle=180)" not all the instance turns to the player, but if I use "for each enemy", then it begins to work properly. it is has to be that way? it is suposed for every enemy to turn around without the "for each" action right?
B
5
S
1
Posts: 31
Reputation: 439

Post » Tue Nov 18, 2014 12:15 pm

I think this is a Construct BUG, no reasons for this not to work, it just messes up
B
5
S
1
Posts: 31
Reputation: 439

Post » Tue Nov 18, 2014 7:24 pm

Anyone check this? I´ve seen some downloads but no answer yet...I´m really mad about this, i think idoesnt work correctly
B
5
S
1
Posts: 31
Reputation: 439

Post » Tue Nov 18, 2014 10:44 pm

This is odd but the problem does not appear on my pc when previewing the cap. The enemies attack and jump at different times. Only changing the frame rate mode to unlimited causes them to attack and jump repeatedly.
B
10
S
3
G
1
Posts: 103
Reputation: 1,390

Post » Wed Nov 19, 2014 1:00 am

they did not spawn the coloured cirlces at the same time? did you try that about changing angle for every enemy?

i have them juming randomly too here on my c, but when its more than one you should look at them very closely to see how tehy beging to get buggy. From animations hapenning in the states they are not, movement bugs, they cannot go acrros de vertexY of the player and they do sometimes, they supose to be attacking but spawn nothing....
B
5
S
1
Posts: 31
Reputation: 439

Post » Wed Nov 19, 2014 1:06 am

R0J0HOUND come at us, pleaseeee!

Anyone at Scirra?
B
5
S
1
Posts: 31
Reputation: 439

Post » Wed Nov 19, 2014 1:22 am

I upload another try, keeing things simplier just to see the failure. They do jump and seems to attack and spawn hitboxes randomly, but they are really messed up. Watching the debugger, they are attacking and the value for "action" its not "atttacking", what should be. The keep sharing behaviour in a way, just one cat do it perfecttly well, stop in mid air or wherever to attack for example, more than one cat never stop their vertical speed... :o :o :o :o :o :o
You do not have the required permissions to view the files attached to this post.
B
5
S
1
Posts: 31
Reputation: 439

Post » Fri Nov 21, 2014 12:49 pm

Uooo downloaded times are going up...i wonder if anyone fix it and take the game for him XD
B
5
S
1
Posts: 31
Reputation: 439

Next

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 5 guests