I cannot remember these SPRITE/OBJECT numbers...

Previous topic - Next topic

Kitty Hello

Hi,

there's folks who cannot remember the indices of their sprites/sounds. Or the numbering requires an insertion of a new resource (for aesthetical reasons). For all these I sketched a method of using names instead of numbers:

Code (glbasic) Select
   spr_human = DynLoadSprite("Human.bmp")

    SPRITE spr_human, 0,0
    SHOWSCREEN
    MOUSEWAIT


FUNCTION DynLoadSprite: file$
    LOADSPRITE file$, GLOBAL spr_id_max
    spr_id_max = spr_id_max + 1
    RETURN spr_id_max-1
ENDFUNCTION


FUNCTION DynLoadSound: file$, buffer
    LOADSOUND file$, GLOBAL spr_id_max, buffer
    snd_id_max = snd_id_max + 1
    RETURN snd_id_max-1
ENDFUNCTION


FUNCTION DynLoadObject: file$
    X_LOADOBJ file$, GLOBAL obj_id_max
    obj_id_max = obj_id_max + 1
    RETURN obj_id_max-1
ENDFUNCTION
it's obvious what I mean, isn't it? All these functions should go in C:\Program Files\GLBasic\Projects\Common\DynLoad.gbas and can be inserted in any project from there easily.

Regards,
Gernot

Hb!

tsk i cant believe it even i... a donkey..... im able to use that and they arent able to remember number codes? is that soo hard? tsk XD

Kitty Hello

The problem sometimes arises, when you have the animations from 0-15 full, and now need to insert a sprite right in between. Then the aproach above is better.
I, however, prefer the numbers myself, too.