How do I get the size of an array in megabytes?

About Monkey 2 Forums Monkey 2 Programming Help How do I get the size of an array in megabytes?

This topic contains 7 replies, has 3 voices, and was last updated by  Amon 1 year, 2 months ago.

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #13249

    Amon
    Participant

    How do I get the size of an array in megabytes?

    #13250

    therevills
    Participant

    It’ll depend on the objects stored in the array…

    #13253

    cocon
    Participant
    #13264

    Amon
    Participant

    Cool, thank you, Cocon. That’ll do lovely. 🙂

    #13274

    therevills
    Participant

    Very nice Cocon, didnt know you could do that in MX2!

    Does it work with an array of objects? I’ll have to check it out!

    Also Amon, why did you want to know this?

    #13278

    Amon
    Participant

    Heya. The game I’m making is a platform game but a bit like an endless running game. The level scrolls downwards and you have to keep jumping up, destroying enemies etc. till you get to the top where you face the final boss. I noticed that there was about an eight seconds delay when switching to my game screen so I thought it must be the level array but I had no idea how to test its size to see if that was in fact, causing the delay. Thanks to Cocon’s code I found it was the level array.  I split the array into smaller chunk arrays and now the loading is less than a second.

    #13281

    cocon
    Participant

    I updated the example to include struct and classes.

    Also testing the Monokai theme… 🙂

    #13282

    Amon
    Participant

    Pretty cool. Thanks for the updates. This is now archived as must have MX2 code.

    Thank you, Cocon.

Viewing 8 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic.