A redesign of the AGS site is now ready to be implemented! Please help us with art and content.

Author Topic: Object animation and views error message “fixed size array cannot be used..”  (Read 224 times)

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

  • Local Moderator
  • * KILL* * KILL * * KILL *
    • Lifetime Achievement Award Winner
Why do you use Object[vStar].Animate(1,1)?
As you've already assigned the view to the object, just animate object #0:
Code: Adventure Game Studio
  1. Object[0].Animate(1,1);

I tried that also, but I get the same result

Cassiebsg

  • Cavefish
  • Fleeing the Cylon tyrrany...
    • Cassiebsg worked on one or more games that won an AGS Award!
    •  
    • Cassiebsg worked on one or more games that was nominated for an AGS Award!
View names have to be used in all caps. VSTAR.

Code: Adventure Game Studio
  1. function room_FirstLoad()
  2.  
  3. {
  4.   object[0].SetView(VSTAR);  // AGS code is case sentive, and setview is not the same as SetView
  5.   object[0].Animate(1,1);
  6. }
  7.  
  8.  

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: Adventure Game Studio
  1. function room_FirstLoad()
  2.  
  3. {
  4.   oStar.SetView(VSTAR);
  5.   oStar.Animate(1,1);
  6. }
  7.  
  8.  

EDIT: changed Object[0] to object[0] as Khris mentioned bellow. (I didn't caught that one.  :-[ )
« Last Edit: 28 Jun 2021, 18:08 by Cassiebsg »
There are those who believe that life here began out there...

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.