X y movement commands
been trying to work it out but sofar i just can't get the boss to get to the right place with the commands so i was wondering what is the best command setup to get a sprite to X:315 Y:100?(the rest of the boss works properly that is the only part i screwed up. so if anyone can help me getting those commands under control I know I can get the boss to work.
Look for an sp_move(); command. I think there's something like that. Sorry I don't know these things off the top of my head.
I'm assuming the difficulty is coming from having the boss go to those coordinates from any point on the screen?
I would suggest creating a sprite at those coordinates and using sp_follow(&boss, &sprite); Something like this:
The boss won't go to those exact coordinates, it will go a bit off of the statue, so experiment with the statue's coordinates to get the boss right where you want him.
EDIT:
If I'm way off here and you're just trying to get him move, use:
<dir> is a number from 1-9, and it's based on the numpad. 2 is down, 4 is left, 6 is right, 8 is up, and the rest are diagonal directions.
<coordinate> is the X or Y coordinate you want him to move to. So if you have him move right (6), you would use an X coordinate.
The last number is whether or not the sprite can move through hardness, 1 being yes and 0 being no.
I would suggest creating a sprite at those coordinates and using sp_follow(&boss, &sprite); Something like this:
//Wherever you have the previous move() commands at int &sprite = create_sprite(315, 100, 0, 80, 24); //Above sprite is the stone statue head thingy set_smooth_follow(1); sp_follow(¤t_sprite, &sprite);
The boss won't go to those exact coordinates, it will go a bit off of the statue, so experiment with the statue's coordinates to get the boss right where you want him.
EDIT:
If I'm way off here and you're just trying to get him move, use:
freeze(¤t_sprite); move_stop(¤t_sprite, <dir>, <coordinate>, 1);
<dir> is a number from 1-9, and it's based on the numpad. 2 is down, 4 is left, 6 is right, 8 is up, and the rest are diagonal directions.
<coordinate> is the X or Y coordinate you want him to move to. So if you have him move right (6), you would use an X coordinate.
The last number is whether or not the sprite can move through hardness, 1 being yes and 0 being no.
"I would suggest creating a sprite at those coordinates and using sp_follow(&boss, &sprite);"
A probably better* way is just to move him in the right direction depending on where he is on the screen:
Edit: *By better, I mean more accurate. Pillbug's way might look nicer
A probably better* way is just to move him in the right direction depending on where he is on the screen:
int &x = sp_x(&boss, -1); int &y = sp_y(&boss, -1); //might need adjusting if you need him to path around objects: if (&x < 315) { move_stop(&boss, 6, 315, 1); } else { move_stop(&boss, 4, 315, 1); } if (&y < 100) { move_stop(&boss, 2, 100, 1); } else { move_stop(&boss, 8, 100, 1); } //and then if you need it to be exact: sp_x(&boss, 315); sp_y(&boss, 100);
Edit: *By better, I mean more accurate. Pillbug's way might look nicer
Also, you don't really need to bother with the if stuff... Just moving him in all directions will work fine:
move_stop(&boss, 6, 315, 1); move_stop(&boss, 4, 315, 1); move_stop(&boss, 2, 100, 1); move_stop(&boss, 8, 100, 1);
Scratcher, does that actually work with a move_stop() command? Won't the script hang if it can't execute it since it's a command that pauses the script until the condition is reached? I haven't tried it though and have always done it the long, conditional way, but if that works, jeez, would have saved me a lot of time
It does work, because move_stop() pauses the script until the condition is reached or exceeded. So if the x/y is already more than stated in the command, it just won't do anything.
It works. I've always done it that way.
EDIT: Dammit, Sparrowhawk!!
EDIT: Dammit, Sparrowhawk!!
Oh wow xD Nice example of Dink's limits actually working in favor of the scripter
Thanks guys will try the suggestions later and see what works the best and when they work properly will do the finishing touches on boss no 3(second one is a summoner who'm is immune when minnions are spawned(simply using counters to check HP instead of HP system(upside noneed of defensive math downside no official way of telling the damage given)