Pushing
So, I want dink to push a rock to reveal a hidden cave. How should I do to make the program know in witch direction dink is pushing from?
You can use sp_dir() to find out which way Dink is facing. For example if you want the rock to be moved from left to right only:
void push (void)
{
int &dir = sp_dir(1, -1);
if (&dir == 6)
{
//move rock change hardness etc
}
else
say("I can't move it...", 1);
}
This isn't working :/
void push (void)
{
int &dir = sp_dir(1, -1);
if (&dir == 6)
{
sp_hard(¤t_sprite, 1);
draw_hard_map();
move_stop( ¤t_sprite, 6, 401, 1);
sp_hard(¤t_sprite, 0);
draw_hard_map();
}
else
say("I can't push it in this direction...", 1);
}
void push (void)
{
int &dir = sp_dir(1, -1);
if (&dir == 6)
{
sp_hard(¤t_sprite, 1);
draw_hard_map();
move_stop( ¤t_sprite, 6, 401, 1);
sp_hard(¤t_sprite, 0);
draw_hard_map();
}
else
say("I can't push it in this direction...", 1);
}
Have you given the rock a speed higher than 0?
Hmmm... either what Meta said, and you also have a space beetwen
move_stop(and
¤t_sprite, 6, 401, 1);
Oh, how stupid of me <.<
I had speed 0
anyway, it's working now
I had speed 0
anyway, it's working now
September 10th 2009, 01:53 AM

MsDink
What stops that rock going back to where u started from (so you cant get out if its a doorway etc) The rock returns to its original location after you exit the area and effectively blocks u in? (sorry to poach yer topic iplaydink)but this particular prob is drivin me nuts too
Well, you probably want to use a global in that case. (At least that's the easy way out.)
Something like this:
Something like this:
void main (void)
{
if (&story > 3)
{
sp_x(¤t_sprite,401);
draw_hard_map();
}
}
void push (void)
{
if (&story == 3)
{
int &dir = sp_dir(1, -1);
if (&dir == 6)
{
sp_speed(¤t_sprite,1);
move_stop( ¤t_sprite, 6, 401, 1);
&story = 4;
draw_hard_map();
}
else
say("I can't push it in this direction...", 1);
}
}Nup tried that and it wont push in any direction - Thanks anyhoo... I need to do some heavy duty readin of the ole script makin thingi ma bob













