I just can't seem to get arrays right.
I am trying something that should be real simple and works if I just name all the characters one after the other, but I want to do it using arrays.
Whats wrong with this simple piece of code?? I am told there's a null pointer reference. But I assigned a value to the pointers. I don't understand.
In globalscript:
Code: ags
I am trying something that should be real simple and works if I just name all the characters one after the other, but I want to do it using arrays.
Whats wrong with this simple piece of code?? I am told there's a null pointer reference. But I assigned a value to the pointers. I don't understand.
In globalscript:
Character *trash[12];
int trashcounter;
function removetrash()
{
trashcounter = 1;
while (trashcounter < 3)
{
if (trash[trashcounter].Frame == 4)
{
trash[trashcounter].x = 1;
trash[trashcounter].y = 1;
trash[trashcounter].Frame = 0;
}
trashcounter ++;
}
}
function repeatedly_execute()
{
removetrash();
}
function game_start()
{
trashcounter = 1;
trash[1] = cAffald1;
trash[2] = cAffald11;
trash[3] = cAffald12;
}