The Dink Network

Reply to Moving sprite damaging other sprites

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:
 
 
May 26th 2009, 08:00 AM
bonca.gif
Christiaan
Bard They/Them Netherlands
Lazy bum 
I've been messing around with moving objects that damage everything that touch them. My first guess was to use brain 11, but it seems a brain 11 sprite is unable to move.

What I'm trying to accomplish is this:

1) The lethal object has to move vertically from outside of the screen at the top, to outside of the screen at the bottom, and back again, and repeat.
2) The lethal object has to hurt anyone who touches it.
3) When a sprite (or Dink) touches the lethal object, the object freezes and after 500 milliseconds or so, the object stops hurting Dink or the sprites.
4) When Dink hits the object, it starts moving vertically again, and again hurting anyone who touches it.

I already made it work that it does all this, but I can't figure out how to make it that the lethal object also hurts other sprites besides Dink.

This is my script:

void main (void)
{
int &dam;

sp_brain(&current_sprite, 10);
sp_hitpoints(&current_sprite, 10);
sp_base_death(&current_sprite, 210);
sp_touch_damage(&current_sprite, 1);
sp_speed(&current_sprite, 11);
loop:
freeze(&current_sprite);
move_stop(&current_sprite, 2, 600, 1);
move_stop(&current_sprite, 8, -250, 1);
freeze(&current_sprite);
wait(100);
goto loop;
}

void hit (void)
{
&dam = sp_hitpoints(&current_sprite, -1);
if (&dam > 7)
{
int &crap = random(2,1);
if (&crap == 1)
{
sp_speed(&current_sprite, 16);
sp_touch_damage(&current_sprite, 3);
freeze(&current_sprite);
move_stop(&current_sprite, 2, 600, 1);
freeze(&current_sprite);
}
if (&crap == 2)
{
sp_speed(&current_sprite, 16);
sp_touch_damage(&current_sprite, 3);
freeze(&current_sprite);
move_stop(&current_sprite, 8, -250, 1);
freeze(&current_sprite);
}
}

if (&dam < 8)
{
sp_touch_damage(&current_sprite, 0);
freeze(&current_sprite); }
}

void touch (void)
{
wait(500);
sp_touch_damage(&current_sprite, -1);
sp_speed(&current_sprite, 0);
}