The Dink Network

Movin' Sprite

August 5th 2005, 04:06 AM
duckdie.gif
BeheadedDuck
Peasant He/Him Australia
So lazy... So incredibly lazy... 
How do I get a sprite (in this case Dink) to move across the screen. I want him to move to the right by about 4.5 squares if anyone wants to give me a line for a .C file instead of telling me.
August 5th 2005, 04:26 AM
spike.gif
The most common commands to do that are move(); (moves the sprite but continues onward the script) and move_stop(); (doesn't continue the script until the sprite has arrived at the coordinate he was told to go at)

move_stop(1, 6, 310, 1); would move Dink in the middle of the screen. (taken he's on the left side of the screen) The first number determines what sprite you want to move, second number stands for the direction you want to move it in (numpad), third number is the x- or y-coordinate you want to move the sprite to and the fourth number determines if the sprite will be stopped by any hard obstacles or not (the value is either 1 or 0).

On horizontal and diagonal movement the coordinate is X and on vertical it's Y. North(8) and west(4) borders are at X0 and Y0 and east(6) and south(2) borders are at X620 and Y400
August 5th 2005, 04:31 AM
duckdie.gif
BeheadedDuck
Peasant He/Him Australia
So lazy... So incredibly lazy... 
Okay, but what if i want a different sprite to move? Like a duck? do i type its sprite name like duck,6,310,1? and does 1 at the end mean go thourgh and does 0 mean stop if hardness?
August 5th 2005, 04:53 AM
spike.gif
If you want to move the duck in it's own script, the duck is known as &current_sprite;
otherwise you need to go to the editor and check the duck's sprite number (press I) and then use that number instead of 1, or attach a global to the duck or do eg.

int &duck = get_sprite_with_this_brain(3, 1);
move_stop(&duck, 2, 200, 1);

Ya, 1 moves over hardness and 0 doesn't
August 5th 2005, 08:41 AM
duckdie.gif
BeheadedDuck
Peasant He/Him Australia
So lazy... So incredibly lazy... 
Awesome. Thanks Scratcher.

EDIT 1: So just saying I want dink to move to the right by about 4.5 squares if would be something like: (1,6,200,1)? (The 200 was a guess and I do want him him to walk over hardness).
August 5th 2005, 09:13 AM
spike.gif
You can see the coordinates in the editor on the bottom of the screen... (usually anyway) so you don't have to guess.
August 5th 2005, 09:20 AM
duckdie.gif
BeheadedDuck
Peasant He/Him Australia
So lazy... So incredibly lazy... 
Yeah I knew that. Well, thanks for the help. Actually would you also know how to edit custom tiles? Whenever I try to change the hardeness on tiles i made meself it always effects every tile in the whole mod. Any ideas?
August 5th 2005, 09:55 AM
spike.gif
The command would be move_stop(1, 6, 225, 1); (each tile is 50x50 so it's propably precisely that )

As for editing tiles, the changes affect every single similar tile in the dmod so if you add hardness to a particular grass tile it will apply to all other similar grass tiles in the whole dmod. Pressing H and then choosing hardness will only affect that tile.
August 5th 2005, 09:57 AM
duckdie.gif
BeheadedDuck
Peasant He/Him Australia
So lazy... So incredibly lazy... 
dang your helpful.
August 5th 2005, 10:13 AM
custom_magicman.gif
magicman
Peasant They/Them Netherlands duck
Mmmm, pizza. 
Well... no, not really.

move_stop(1, 6, 225, 1); will move it to the right to x-coordinate 225. There's no real command for relative movement (like move 225 pixels from where I stand). You'll have to use a variable to get around this:

int &crap = sp_x(1, -1);
//1 in previous line means Dink. -1 means "retrieve value"
&crap += 225;
move_stop(1, 6, &crap, 1);
August 5th 2005, 10:47 AM
spike.gif
Oh, my mistake for not thinking there. I need more sugarrrr