Interating through all Objects in game or in a room

Started by SilverSpook, Thu 29/06/2017 03:53:48

Previous topic - Next topic

SilverSpook

Hi, is there a way to get an array of all of the objects in a room?  I know for characters you can use 'character[]' but I was wondering if there's a way to get all of the objects to perform a function on them, one by one.

Gurok

Yes, there is a corresponding object array that you can iterate through like so:

Code: ags
for(int i = 0; i < Room.ObjectCount; i++)
    DoSomethingTo(object[i]);
[img]http://7d4iqnx.gif;rWRLUuw.gi

SMF spam blocked by CleanTalk