The Dink Network

Reply to homing missile (alternative)

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:
 
 
February 11th 2007, 09:09 PM
slayer.gif
rabidwolf9
Peasant He/Him United States
twitch.tv/rabidwolf9 
I think I found an alternative (or two) to making a homing missile opposed to what theprophet did. Instead of complex scripting, I've utilized sp_target(); to take care of all of that.

1)Set brain to 9, target Dink, use set_smooth_follow(1); In the touch procedure, set the brain to 11 and set a strength. Now you can successfully have a damage procedure for the "enemy".

2)Create a brain 9 sprite from the missile sprite and make a loop so that the missile sprite is always at the coordinate of the brain 9 sprite. Here's a script of the second alternative.

//guided fireball
void main( void )
{
int &cur_x = sp_x(&current_sprite, -1);
int &cur_y = sp_y(&current_sprite, -1);
int &cur_seq = sp_pseq(&current_sprite, -1);
int &cur_dir;
int &fake = create_sprite(&cur_x, &cur_y, 9, &cur_seq, 1);
int &shadow;

sp_brain(&current_sprite, 11);
sp_strength(&current_sprite, 10);
sp_flying(&current_sprite, 1);
sp_brain_parm(&current_sprite, &check_vars);
sp_nodraw(&current_sprite, 1);

sp_brain(&fake, 9);
sp_speed(&fake, 4);
sp_timing(&fake, 22);
sp_base_walk(&fake, 500);
sp_flying(&fake, 1);
sp_nohit(&fake, 1);
preload_seq(502);
preload_seq(504);
preload_seq(506);
preload_seq(508);

sp_target(&fake, 1);
set_smooth_follow(1);

&shadow = create_sprite(1,1, 15, 432, 3);
sp_brain_parm(&shadow, &current_sprite);
sp_que(&shadow, -1);
sp_brain_parm2(&current_sprite, &shadow);

sp_dir(&current_sprite, 2);

loop:
wait(1);
&cur_x = sp_x(&fake, -1);
sp_x(&current_sprite, &cur_x);

&cur_y = sp_y(&fake, -1);
sp_y(&current_sprite, &cur_y);

&cur_seq = sp_pseq(&fake, -1);
sp_pseq(&current_sprite, -1);

&cur_dir = sp_dir(&fake, -1);
sp_dir(&current_sprite, &cur_dir);

goto loop;
}

void damage( void )
{
&cur_y = sp_y(&fake, -1);
playsound(18, 8000,0,0,0);
wait(1);
sp_strength(&current_sprite, 0);
kill_shadow(&current_sprite);
sp_seq(&fake, 70);
sp_pseq(&fake, 70);
sp_frame(&fake, 1);
sp_brain(&fake, 7);
&cur_y -= 35;
sp_y(&fake, &cur_y);
sp_kill(&current_sprite, 1);
}