The Dink Network

Reply to Re: A "high-score" based Dmod

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 11th 2020, 11:22 PM
spike.gif
An additional problem is that the touch procedure will constantly run. It's the same as how if you stand on a pillbug, it will constantly damage you. Here the touch procedure will run over and over, and probably interrupt the script when it reaches a wait command in the talk procedure. You could set sp_touch_damage to 0 in touch, but there is a more elegant solution...

BEHOLD! The almighty button brain:

void main ( void )
{

screenlock(1);
sp_hard(&current_sprite, 0);
draw_hard_sprite(&current_sprite);

sp_brain(&current_sprite,14)
int &reach
}

void buttonon
{
&reach = 1
say("I'm touching the switch", 1);
}

void buttonoff
{
&reach = 0
say("watashiwa stopped touching the switch desu",1)
}

void talk ( void )
{
int &num = random(5,1);

int &rx = random(600, 0);
int &ry = random(400, 0);

if (&reach == 1)
{

if (&num == 1)
{

sp_pseq(&current_sprite, 844);
sp_pframe(&current_sprite, 2);
playsound(19, 32050,0,0,0);
playsound(19, 33000,0,0,0);
wait(500);
screenlock(0);
playsound(43, 22050,0,0,0);
say_xy("`3*SCREEN UNLOCKED!!*", 15, 75);
&switch += 1;
wait(1500);
kill_this_task();

}

if (&num != 1)
{

sp_pseq(&current_sprite, 844);
sp_pframe(&current_sprite, 2);
playsound(19, 32050,0,0,0);
playsound(19, 33000,0,0,0);
sp_hard(&current_sprite, 1);
draw_hard_sprite(&current_sprite);
wait(500);
&switch += 1;
sp_pseq(&current_sprite, 844);
sp_pframe(&current_sprite, 1);
sp_x(&current_sprite, &rx);
sp_y(&current_sprite, &ry);

sp_hard(&current_sprite, 0);
draw_hard_sprite(&current_sprite);

spawn("give-5g");

}
}
else
{

say("I can't reach the switch!", 1);
}

}