Reply to help with object moving script
If you don't have an account, just leave the password field blank.
I am making a script to move to a destination by pushing, but there are bugs, as usual
Someone please try to help me. There are two problems I'm having, but I can't seem to find a flaw in my script.
1) When you push the object from its original position, Dink says that he can't push it from that angle. After he says that, the rock warps off screen and Dink unfreezes. The hardness is still in the same place. This causes me to suspect it's not going to the moving procedure, but I cannot see why.
2) When pushing the rock back, he says his rock moving thing which informs me that he is going to the proper procedure, but the rock stays and Dink says frozen. What gives!?
Here is the script:
Note: I'm also going to make a variable for the proper directions so everything can be toggled in the main procedure.
//Object moving Script
void main( void )
{
int &my_dir;
int &x_cor;
int &seq;
int &frame;
&frame = sp_frame(¤t_sprite, -1);
&seq = sp_seq(¤t_sprite, -1);
int &start_cor;
int &end_cor;
&start_cor = 220;
&end_cor = 300;
}
void push(void)
{
&my_dir = sp_dir(1, -1);
&x_cor = sp_x(¤t_sprite, -1);
freeze(1);
//the thing is in original position
if (&x_cor == &start_cor)
{
if (&my_dir == 6)
{
move_away();
}
}
//the thing has already been moved
if (&x_cor == &end_cor)
{
if (&my_dir == 4)
{
move_back();
}
}
say("I can't move it from this angle", 1);
unfreeze(1);
}
void move_away( void )
{
say("its moving", 1);
move_stop(¤t_sprite, 6, &end_cor, 1);
draw_hard_map();
int &hold = sp_editor_num(¤t_sprite);
if (&hold != 0)
{
editor_type(&hold, 3);
editor_seq(&hold, &seq);
editor_frame(&hold, &frame);
}
sp_x(¤t_sprite, &end_cor);
unfreeze(1);
}
void move_back( void )
{
say("moving back", 1);
move_stop(¤t_sprite, 4, &start_cor, 1);
draw_hard_map();
int &hold = sp_editor_num(¤t_sprite);
if (&hold != 0)
{
editor_type(&hold, 3);
editor_seq(&hold, &seq);
editor_frame(&hold, &frame);
}
sp_x(¤t_sprite, &start_cor);
unfreeze(1);
}
1) When you push the object from its original position, Dink says that he can't push it from that angle. After he says that, the rock warps off screen and Dink unfreezes. The hardness is still in the same place. This causes me to suspect it's not going to the moving procedure, but I cannot see why.
2) When pushing the rock back, he says his rock moving thing which informs me that he is going to the proper procedure, but the rock stays and Dink says frozen. What gives!?
Here is the script:
Note: I'm also going to make a variable for the proper directions so everything can be toggled in the main procedure.
//Object moving Script
void main( void )
{
int &my_dir;
int &x_cor;
int &seq;
int &frame;
&frame = sp_frame(¤t_sprite, -1);
&seq = sp_seq(¤t_sprite, -1);
int &start_cor;
int &end_cor;
&start_cor = 220;
&end_cor = 300;
}
void push(void)
{
&my_dir = sp_dir(1, -1);
&x_cor = sp_x(¤t_sprite, -1);
freeze(1);
//the thing is in original position
if (&x_cor == &start_cor)
{
if (&my_dir == 6)
{
move_away();
}
}
//the thing has already been moved
if (&x_cor == &end_cor)
{
if (&my_dir == 4)
{
move_back();
}
}
say("I can't move it from this angle", 1);
unfreeze(1);
}
void move_away( void )
{
say("its moving", 1);
move_stop(¤t_sprite, 6, &end_cor, 1);
draw_hard_map();
int &hold = sp_editor_num(¤t_sprite);
if (&hold != 0)
{
editor_type(&hold, 3);
editor_seq(&hold, &seq);
editor_frame(&hold, &frame);
}
sp_x(¤t_sprite, &end_cor);
unfreeze(1);
}
void move_back( void )
{
say("moving back", 1);
move_stop(¤t_sprite, 4, &start_cor, 1);
draw_hard_map();
int &hold = sp_editor_num(¤t_sprite);
if (&hold != 0)
{
editor_type(&hold, 3);
editor_seq(&hold, &seq);
editor_frame(&hold, &frame);
}
sp_x(¤t_sprite, &start_cor);
unfreeze(1);
}






