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.

2D All the way! / Referring to image by name

Author
Message
bugzilla
20
Years of Service
User Offline
Joined: 28th May 2006
Location:
Posted: 28th May 2006 22:39
I'm coming from BlitzBasic. In that program, when you load an image you assign it to a variable then you can access it by variable name. Is it possible to do this in DB? it seems that the way it works in DB is that the loaded image is assigned a number. If you have tons of images to work with it seems that would get really chaotic.

Any ideas?
Relativity
21
Years of Service
User Offline
Joined: 29th Mar 2005
Location: Position is relative.
Posted: 29th May 2006 00:31 Edited at: 29th May 2006 00:32
You're right; DB accesses images with numbers. This is especially convenient in instances where you need one algorithm for several images. You could then use a FOR loop to access all the images.

If you really want to use names, you could just assign a variable the image number each time you declare an image. For example:

ConorH
23
Years of Service
User Offline
Joined: 5th Feb 2003
Location:
Posted: 7th Jun 2006 16:52
It might be neccesary to make it a global variable as well

its my new rat tail dog!
Sven B
21
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 16th Jun 2006 17:47
Quote: "It might be neccesary to make it a global variable as well"


Or a constant

It's the programmer's life:
Have a problem, solve the problem, and have a new problem to solve.
Scraggle
Moderator
22
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 16th Jun 2006 23:16
Here is the first few line of my current WIP. I find this method works very well for me.



Where multiple variables are necessary, I make sure I REM the numbers used, like so ...



Kevin Picone
23
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Australia
Posted: 17th Jun 2006 00:28 Edited at: 17th Jun 2006 00:29
Why not roll a few media helper functions. Then throw them all into an include and you have your own helper library.

Like say (PB styled code)




Ex.



Cash Curtis II
21
Years of Service
User Offline
Joined: 8th Apr 2005
Location: Corpus Christi Texas
Posted: 19th Jun 2006 10:54
I use User Defined Types for everything. For example, a character entity might have several objects attached to it, and several images as well. I might have character 1, with some attributes...

char(1).object
char(1).idleSound
char(1).walkSound
char(1).gumpImage

etc.

You just feed the asset number into the UDT variable and then you can access it easily. I've got 250 objects, 90 sounds, and 175 images in my current project. Referencing them by number would simply be impossible. You should always use a variable, and I always use a UDT. UDT arrays are global, by the way.


Come see the WIP!

Login to post a reply

Server time is: 2026-07-04 15:04:10
Your offset time is: 2026-07-04 15:04:10