Object animation and views error message “fixed size array cannot be used..”

Started by essaywrite7, Sun 27/06/2021 06:15:52

Previous topic - Next topic

essaywrite7

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

Gilbert

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
Object[0].Animate(1,1);


Cassiebsg

View names have to be used in all caps. VSTAR.

Code: ags

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

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.  :-[ )
There are those who believe that life here began out there...

Khris

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.

SMF spam blocked by CleanTalk