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 10th 2020, 01:33 PM
slayer.gif
Exzcimus
Peasant He/Him Philippines
Change is constant, but Constants do not change. 
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(&current_sprite, -1);
sp_hard(&current_sprite, 0);
draw_hard_sprite(&current_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(&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);

}

}