Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: essaywrite7 on Sun 27/06/2021 06:15:52

Title: Object animation and views error message “fixed size array cannot be used..”
Post by: essaywrite7 on Sun 27/06/2021 06:15:52
Hello,
I am trying to have a shooting star fly across the sky in the game, so I created a view animation (vStar) and then assigned it to an object:

function room_FirstLoad()

{
Object[0].setview(vStar);
Object[vStar].Animate(1,1);
}

But I get the error message “fixed size array cannot be used in this way”

What am I doing wrong?
Thank you
Title: Re: Object animation and views error message “fixed size array cannot be used..”
Post by: Gilbert on Sun 27/06/2021 06:29:27
Why do you use Object[vStar].Animate(1,1)?
As you've already assigned the view to the object, just animate object #0:
Code (ags) Select
Object[0].Animate(1,1);
Title: Re: Object animation and views error message “fixed size array cannot be used..”
Post by: essaywrite7 on Sun 27/06/2021 06:39:37
I tried that also, but I get the same result
Title: Re: Object animation and views error message “fixed size array cannot be used..”
Post by: Cassiebsg on Sun 27/06/2021 08:07:11
View names have to be used in all caps. VSTAR.

Code (ags) Select

function room_FirstLoad()

{
  object[0].SetView(VSTAR);  // AGS code is case sentive, and setview is not the same as SetView
  object[0].Animate(1,1);
}



Note that, when you are in the room, you can call the object by it's name. So you could have it this way (assuming your object is called oStar:

Code (ags) Select

function room_FirstLoad()

{
  oStar.SetView(VSTAR);
  oStar.Animate(1,1);
}



EDIT: changed Object[0] to object[0] as Khris mentioned bellow. (I didn't caught that one.  :-[ )
Title: Re: Object animation and views error message “fixed size array cannot be used..”
Post by: Khris on Mon 28/06/2021 09:26:27
You can assign a name to the object and use that: oStar (only in a room script)
Or you can use its ID and the global array: object[0]
Note the lowercase name.