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.

Newcomers DBPro Corner / Naming spurious images and sprites?

Author
Message
Radio Check
20
Years of Service
User Offline
Joined: 18th Aug 2004
Location:
Posted: 15th Oct 2004 09:37
I have been playing with functions, and I have run into a problem I hope has a more graceful solution then the one I am using. My function creates a bitmap, draws on it using parameters passed to the function, gets the image, and makes a sprite.

But if I try to call it more than once, since it uses the same image number etc to make the sprite, I get unfortunate results. I fixed it by requiring a unique name to be passed each time it is used, but I would rather the function itself choose a special name each time it's used. I thought of using the timer but hoped there was a better way.

Any ideas? I've included a short example in case my description was confusing, just remove the last parameter of the MakeButton() function and function calls to see the problem

Making a cool sig is just too much pressure for me right now.
Ric
20
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 16th Oct 2004 09:34 Edited at: 16th Oct 2004 09:37
You want to change the value of the image number within the function, each time the function is called?

To do that, you would need to define the variable as global (outside the function), then increase it by one within the function. Something like this:



This makes the function increase the value of the image number and display it on the screen each time you press a key. (Note that you can't include the global variable as an argument of the function.)


Radio Check
20
Years of Service
User Offline
Joined: 18th Aug 2004
Location:
Posted: 16th Oct 2004 13:36
Thanks!

That's approximately what I ended up doing, but I'm still unhappy. I'm thinking about parsing the timer() to get separate names, that way the function will be more "plug and play". So far my attempts have really slowed down the fps. Probably redundant loops.

Making a cool sig is just too much pressure for me right now.

Login to post a reply

Server time is: 2024-11-27 13:03:05
Your offset time is: 2024-11-27 13:03:05