Index in list is randomly changing

hi, i have an online game where you can walk and shoot viruses. and everything was working but when i shoot virus to right side then on the other device its going down. if someone want to check my code and support me with it then here is an aia file.
mr2.aia (1.2 MB)

here are some blocks



image

Post relevant blocks, people aren't always at computer , if you show blocks you can get answers more fast and people can help you also without a computer :+1:t2:

Fix this, then repost if the problem persists.
image


its just a part of my code that i didnt want to work for a moment

i gived it now

for this purpose you also can deactivate blocks, you can find that option after doing a right mouse click onto that if block

Taifun

1 Like

I disabled your error code by isolating it in a procedure block with a matching value parameter, to get an error free environment.
Your blocks, cleaned up:

Since I do not know Polish (?), I can only give general impressions in my time available.

I see you are using the MIT CloudDB server.

You also lack a


block to catch errors and notify the user (who can hopefully read Polish).

From the arrangements of components and general logic, I imagine you are doing a two person game involving movement around a 5 by 8 grid of Image components, with the topography defined by wall Pictures, and some kind of combination of component lists that I find very suspicious.

You rely on indices into lists of components, but the lists have varying lengths, so there's plenty opportunity for out of bounds errors.

If the error event does not help, you can make your directional control more robust by coding four directional functions (left,right,up,down) that accept image components and return the corresponding image component bordering the input in that direction. For components at the edge, return the input component.

Here is a sample app to study using a table of buttons:

I can't vouch for the reliability of those extensions you are using.
image