ive been trying with something like :
sprite_add(working_directory +"/data/monsters/monsterdamage.gif");
but it keeps telling me an error
can someone help me with this?
thanks
Posted 20 May 2008 - 05:28 AM
sprite_add(working_directory +"/data/monsters/monsterdamage.gif");
Posted 20 May 2008 - 05:30 AM
look at my example in my sig it shows how to do this.i been trying to load external sprites
ive been trying with something like :sprite_add(working_directory +"/data/monsters/monsterdamage.gif");
but it keeps telling me an error
can someone help me with this?
thanks
Posted 20 May 2008 - 05:34 AM
Posted 20 May 2008 - 05:47 AM
Posted 20 May 2008 - 06:00 AM
newSprite = sprite_add();
Posted 21 May 2008 - 03:42 AM
well thats a load of bull in my perspective i never had to do that to get it to work, but in perfect respect if you dont use a variable use should replace it with sprite_indexYou cannot just say sprite_add();
you must assign sprite_add() to a variablenewSprite = sprite_add();
sprite_add(fname,imgnumb,precise,transparent,smoot
h,preload,xorig,yorig) Adds the image stored in the file fname to the set of sprite resources. Many different image file types can be dealt with. When the image is not a gif image it can be a strip containing a number of subimages for the sprite next to each other. Use imgnumb to indicate their number (1 for a single image). For (animated) gif images, this argument is not used; the number of images in the gif file is used. precise indicates whether precise collision checking should be used. transparent indicates whether the image is partially transparent. smooth indicates whether to smooth the edges. preload indicates whether to preload the image into texture memory. xorig and yorig indicate the position of the origin in the sprite. The function returns the index of the new sprite that you can then use to draw it or to assign it to the variable sprite_index of an instance. When an error occurs -1 is returned.
sprite_add("/data/monsters/monsterdamage.gif",0,1,1,0,0,0,0)
Edited by x-death, 21 May 2008 - 04:10 AM.
Posted 21 May 2008 - 03:53 AM
well thats a load of bull in my perspective i never had to do that to get it to work, but in perfect respect if you dont use a variable use should replace it with sprite_indexYou cannot just say sprite_add();
you must assign sprite_add() to a variablenewSprite = sprite_add();
Posted 21 May 2008 - 04:08 AM
i only put it as harsh as i did because he/she said you MUST use a variable. yes its better you do, but you don't have to and thats what i was rebeling against. but the rest of post solves the problem, it was a very simple answer and i'm surprised didn't get found sooner but all well.well thats a load of bull in my perspective i never had to do that to get it to work, but in perfect respect if you dont use a variable use should replace it with sprite_indexYou cannot just say sprite_add();
you must assign sprite_add() to a variablenewSprite = sprite_add();
Well I suppose you can say that... but it's better to assign everything to a variable so you can get what it RETURNS.
Like a script, a function returns the usage (or answer) of the function. If you want to control everything you add to the game externally then you need to at least give it a variable. A constant variable.
This is why you can control your sprites and objects, rooms and etc, all from different objects/scripts, because their names automatically become constant variables.
You don't HAVE to use a variable, but it's the smartest thing to do in any case of controlling an external object or giving an object a sprite simply because you can use the variable to refer to it.
Posted 21 May 2008 - 04:14 AM
i only put it as harsh as i did because he/she said you MUST use a variable. yes its better you do, but you don't have to and thats what i was rebeling against. but the rest of post solves the problem, it was a very simple answer and i'm surprised didn't get found sooner but all well.
Posted 21 May 2008 - 04:26 AM
i know you were adding info which could help which was the aim of the topic to help alex769 so i don't mind but if you had of said it really mean then i would have felt like that but its all good.i only put it as harsh as i did because he/she said you MUST use a variable. yes its better you do, but you don't have to and thats what i was rebeling against. but the rest of post solves the problem, it was a very simple answer and i'm surprised didn't get found sooner but all well.
I wasn't calling on you or anything. You were right; I was just adding detail.
0 members, 0 guests, 0 anonymous users