The Dink Network

Reply to Re: sprites-editor\sprites-script

If you don't have an account, just leave the password field blank.
Username:
Password:
Subject:
Antispam: Enter Dink Smallwood's last name (surname) below.
Formatting: :) :( ;( :P ;) :D >( : :s :O evil cat blood
Bold font Italic font hyperlink Code tags
Message:
 
 
November 22nd 2005, 11:05 AM
fish.gif
Simeon
Peasant He/Him Netherlands
Any fool can use a computer. Many do. 
Not to be rude but why would you want to delete then recreate something that is already there?

Perhaps cypry has the better idea. This would allow you to reuse an existing object based on your scripts needs.


It depends on the situation. For small scenes with a small number of sprites (say, n <= 10), it is managable to attach a script to all sprites that should appear (or not). Yet even for this small number, it's not recommended to do this. Because let's say, you have scripted it to display the sprites when &story is greater than or equal to 10.

Later in development, you realize it shouldn't be 10 but 12. What to do now? You'll have to go through all the scripts and change the value. To prevent maintenance and version problems, you don't want to write code twice. The problem because more significant when we're talking about greater numbers (50, 90, and it does not have to end there if someone removes the spriteslimit of 99).

Your argument for not wanting to recreating the same sprites again applies to the recreation of the same code as well. And usually, the scene you'll create through a script will be different from the scene stored in a vision (it will vary either slightly, a lot or they won't be similar at all..).

Of course, a real programming language (and not a scripting language like DinkC), offers enough possibilities to solve this problem: you could create a method higher in the class hierarchy to perform this check. This way, the information is only stored once in the program (or game in this case) for all the sprites that should appear or not on that screen.

As a side note, it's interesting that this game offers people with different (yet sometimes computer-related) backgrounds various topics to talk about, be it the computer or gaming itself