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.

Code Snippets / Goodbye object/image/sprite/etc... numbers

Author
Message
Shadow
22
Years of Service
User Offline
Joined: 17th Oct 2002
Location: In the shadows
Posted: 20th Mar 2004 16:36 Edited at: 20th Mar 2004 23:16
A possible way to avoid having to remember object numbers and the like. The functions could be altered to work for images, sprites, or whatever you need. (See attached source code).
indi
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 21st Mar 2004 04:04
I manage all media with a typed array
eg:

Monster(1).Hitpoints

IT still uses a numbered sequence but dang its sweet to manage.


Arkheii
21
Years of Service
User Offline
Joined: 15th Jun 2003
Location: QC, Philippines
Posted: 21st Mar 2004 13:39
Replace the for-next with while-endwhile because you waste a lot of cpu time going through the entire 65535 numbers, when the free space was object number 1 after all. Hehe, didn't I post something like this here before?


"Story in a game is like story in a porn movie. It's expected to be there, but it's not that important." - John Carmack
Shadow
22
Years of Service
User Offline
Joined: 17th Oct 2002
Location: In the shadows
Posted: 21st Mar 2004 21:35
Quote: "Replace the for-next with while-endwhile because you waste a lot of cpu time going through the entire 65535 numbers, when the free space was object number 1 after all. Hehe, didn't I post something like this here before?"


Whoops! Sorry, this line:

if object exist(i)=0 then free=i

should be:

if object exist(i)=0 then free=i: exit

Then it will stop when it finds it.

Login to post a reply

Server time is: 2024-11-23 21:54:59
Your offset time is: 2024-11-23 21:54:59