Yes it should be .length not .length - 1. So Arrays start from zero and array.length always points to the last element
Sometime people will get into trouble by querying if the length is a certain value and then referencing the element like so
if index =< myArray.length and myArray[index] = 0
Because basic evaluates ALL the elements of a condition this will still fail because if index is greater than myArray.length it will still try to resolve myArray[index]
One thing i do that reduces the array referencing is to place the array element into a type at the top of the loop like this;
Function Galanian_etoile_deplacer (MapX as Integer, MapY as Integer, sx as Integer, sy as Integer)
Local i as Integer
Local tbl as Galanian_type_etoile
For i=0 To Galanian_tableau_etoiles.Length // OR Galanian_tableau_etoiles.Length-1
tbl = Galanian_tableau_etoiles[i]
If tbl.MapX = MapX and tbl.MapY = MapY
Inc tbl.PosX, sx
Inc tbl.PosY, sy
SetSpritePositionByOffset (tbl.Sprite, tblPosX, tbl.PosY)
Galanian_tableau_etoiles[i] = tbl
Exit
EndIf
Galanian_tableau_etoiles[i] = tbl
Next
EndFunction
You just need to remember to set your array to the temporary variable at the end of processing the element