The Dink Network

Reply to Re: Kerrek's Development Thread (Questions included)

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:
 
 
July 22nd 2012, 09:44 PM
pillbug.gif
Pillbug
Peasant He/Him United States
Love! True love! 
1) I think RobJ has some, and I know that the Introduction to D-Mod Making has at least touches on it.

2) Hmm...off the top of my head, I would say spawn a script like this in the use() of your spells:

//charging.c
void main(void)
{
loop:
wait(1);

int &max = &magic_cost;
int &cur = &magic_level;
if(&cur < &max)
{
goto loop;
}

if(&cur >= &max)
{
    if(&once < 1)
    {
	&cur = &max;
    playsound();
    }

}
kill_this_task();
}



You could also rig up something with a variable and spawn that to run all the time, but it seems like it would just be easier to put spawn("charging"); in the use() of your spells.

3) You would need a global variable for the number, let's say &shots. What actually starts the recharge is the line in the spell's use that sets &magic_level to 0. &magic_level is how full the bar is, out of &magic_cost. At the beginning of use() put:
&shots += 1;


And around &magic_level = 0; put:

if(&shots == 4)
{
&magic_level = 0;
&shots = 0;
}


That will make it recharge only when the fourth shot is fired, and reset the number of shots to 0.

4) It's actually sp_mx and sp_my, which is how many pixels the sprite travels in a set amount of time. There's a section on it in the DinkC Reference. Basically increase the numbers to go faster, decrease to go slower (inverse if you're going left or up, since those are negative numbers I suppose).