Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Copying one Array to Another?

Author
Message
Frank C
16
Years of Service
User Offline
Joined: 3rd Jul 2010
Location: Houston TX
Posted: 1st Nov 2010 20:56
I did a Search on arrays in forum but couldn't find an answer, what I want to do is copy the values in one of my arrays to another array.
For example: Enemies(indexA) to RandomEnemies(IndexB), both arrays are of the same type i.e. Enemies() as Entity and RandomEnemies() as Entity.

Since my Random Enemies get deleted when they are defeated and they will also possibly be modified and I want keep the base Enemies that have been loaded for later use I though it would be easiest if I just copied them into the RandomEnemies array.

Whats the proper command to do this, I was thinking maybe this:




Would that copy all the elements over?
Indicium
18
Years of Service
User Offline
Joined: 26th May 2008
Location:
Posted: 1st Nov 2010 20:59
for x = 1 to number of enemies
randomenemies(x) = enemies(x)
next x

Login to post a reply

Server time is: 2026-07-22 04:38:00
Your offset time is: 2026-07-22 04:38:00