Reply to Re: A "high-score" based Dmod
If you don't have an account, just leave the password field blank.
The objective in the game is to find the switch while being chased and dodging traps.
I'm trying to make the switch only activatable when Dink touches it or walks over it's hardbox.
This actually worked fine before I added some touch procedure, and before adding that &reach variable and condition to it. The switch will teleport randomly around the screen every time it's used.
But I realized that the switch can be flipped by talking to it, (space bar/examine), even if it's a meter away from Dink. I did not include a fist or any weapons at all, so the switch's function can't be called by a hit procedure. The only items you have is a magic speed boost, and a manual sprinting boots, (tap Ctrl repeatedly while moving to run a little faster).
But as of now, I don't understand how to check two conditions, or anything about complex if statements, or maybe I'm just doing it wrong.
Just remove the touch procedure and the &reach condition, then everything will work fine.
BTW, I include new graphics, it's like 678kb as of now, consisting of some few small sprites like pick-up items.
The damn script
switch-r.c
//random screen unlocking switch, 1 in 5 chances
void main ( void )
{
screenlock(1);
sp_touch_damage(¤t_sprite, -1);
sp_hard(¤t_sprite, 0);
draw_hard_sprite(¤t_sprite);
}
void touch ( void )
{
int &reach;
&reach == 1;
say("I'm touching the switch", 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(¤t_sprite, 844);
sp_pframe(¤t_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(¤t_sprite, 844);
sp_pframe(¤t_sprite, 2);
playsound(19, 32050,0,0,0);
playsound(19, 33000,0,0,0);
sp_hard(¤t_sprite, 1);
draw_hard_sprite(¤t_sprite);
wait(500);
&switch += 1;
sp_pseq(¤t_sprite, 844);
sp_pframe(¤t_sprite, 1);
sp_x(¤t_sprite, &rx);
sp_y(¤t_sprite, &ry);
sp_hard(¤t_sprite, 0);
draw_hard_sprite(¤t_sprite);
spawn("give-5g");
}
else
{
say("I can't reach the switch!", 1);
}
}
I'm trying to make the switch only activatable when Dink touches it or walks over it's hardbox.
This actually worked fine before I added some touch procedure, and before adding that &reach variable and condition to it. The switch will teleport randomly around the screen every time it's used.
But I realized that the switch can be flipped by talking to it, (space bar/examine), even if it's a meter away from Dink. I did not include a fist or any weapons at all, so the switch's function can't be called by a hit procedure. The only items you have is a magic speed boost, and a manual sprinting boots, (tap Ctrl repeatedly while moving to run a little faster).
But as of now, I don't understand how to check two conditions, or anything about complex if statements, or maybe I'm just doing it wrong.
Just remove the touch procedure and the &reach condition, then everything will work fine.
BTW, I include new graphics, it's like 678kb as of now, consisting of some few small sprites like pick-up items.
The damn script
switch-r.c
//random screen unlocking switch, 1 in 5 chances
void main ( void )
{
screenlock(1);
sp_touch_damage(¤t_sprite, -1);
sp_hard(¤t_sprite, 0);
draw_hard_sprite(¤t_sprite);
}
void touch ( void )
{
int &reach;
&reach == 1;
say("I'm touching the switch", 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(¤t_sprite, 844);
sp_pframe(¤t_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(¤t_sprite, 844);
sp_pframe(¤t_sprite, 2);
playsound(19, 32050,0,0,0);
playsound(19, 33000,0,0,0);
sp_hard(¤t_sprite, 1);
draw_hard_sprite(¤t_sprite);
wait(500);
&switch += 1;
sp_pseq(¤t_sprite, 844);
sp_pframe(¤t_sprite, 1);
sp_x(¤t_sprite, &rx);
sp_y(¤t_sprite, &ry);
sp_hard(¤t_sprite, 0);
draw_hard_sprite(¤t_sprite);
spawn("give-5g");
}
else
{
say("I can't reach the switch!", 1);
}
}