Making sprites walk
I am a beginning scripter, and I would like to know how to make sprites walk. People for example. Help would be appreciated. Thanx!
: I am a beginning scripter, and I would like to know how to make sprites walk. People for example. Help would be appreciated. Thanx!
First:
1. How to import new animation sprites
2. How it works
3. How to script
1:
Open dink.ini and find an empty number ( if you didnt add a new sprite, use 850 )
scroll down and add this line:
load_graphics graphicsmonster ame1- 851
load_graphics graphicsmonster ame3- 853
load_graphics graphicsmonster ame5- 855
load_graphics graphicsmonster ame7- 857
load_graphics graphicsmonster ame9- 859
BASE = 850
name1 = he walks sw
name3 = he walks se
name5 = he is dead
name7 = he walks nw
name9 = he walks ne
NOTE: They are all in the 85* base...
NOTE: When he walks sw make sure you name the file: Name1-01, for the first frame, for the second: Name1-02, etc...
NOTE: A frame is 1 bmp
NOTE: 50 frames can be imported into 1 sequence ( ie: 851 )
NOTE: Wanna make him attack, then do this
load_graphics graphicsmonsterattack1- 861
put it into another base ( ie: 860 )
etc...
2:
If you done it dinkedit should find the new sprite in the sprite menu, just press [ when you are in the menu and you will see him...
How does it work? Well, it works with a thing called "BASE":
If you make a new sprite that can move and you made the graphics and imported them into 851 - 859, then the base would be 850
if you make a new sprite that can move and attack
and you imported them into 851 - 859 ( move ) 861 - 869 ( attack )
the bases would be:
move = 850
attack = 860
3:
So, youve imported them, ok... Now, you need to script it...
Place that sprite on the ground, and give him the script called "example" by press shift+5 ( no "" ) leave dinkedit and open cedit ( my favorite script programm, download if you dont have it )
then put this into the script:
void main(void)
{
sp_base_walk(&current_sprite, ***);
sp_base_attack(&current_sprite, ***);
"and the rest, sp_hitpoints and sp_speed, etc..."
}
*** Fill in the bases and voila, you play your dmod and you should see him moving and attacking if you done this (he doesnt move or attack if you didnt gave him: )
sp_speed
sp_timing
:D
Hope you understand it :D
First:
1. How to import new animation sprites
2. How it works
3. How to script
1:
Open dink.ini and find an empty number ( if you didnt add a new sprite, use 850 )
scroll down and add this line:
load_graphics graphicsmonster ame1- 851
load_graphics graphicsmonster ame3- 853
load_graphics graphicsmonster ame5- 855
load_graphics graphicsmonster ame7- 857
load_graphics graphicsmonster ame9- 859
BASE = 850
name1 = he walks sw
name3 = he walks se
name5 = he is dead
name7 = he walks nw
name9 = he walks ne
NOTE: They are all in the 85* base...
NOTE: When he walks sw make sure you name the file: Name1-01, for the first frame, for the second: Name1-02, etc...
NOTE: A frame is 1 bmp
NOTE: 50 frames can be imported into 1 sequence ( ie: 851 )
NOTE: Wanna make him attack, then do this
load_graphics graphicsmonsterattack1- 861
put it into another base ( ie: 860 )
etc...
2:
If you done it dinkedit should find the new sprite in the sprite menu, just press [ when you are in the menu and you will see him...
How does it work? Well, it works with a thing called "BASE":
If you make a new sprite that can move and you made the graphics and imported them into 851 - 859, then the base would be 850
if you make a new sprite that can move and attack
and you imported them into 851 - 859 ( move ) 861 - 869 ( attack )
the bases would be:
move = 850
attack = 860
3:
So, youve imported them, ok... Now, you need to script it...
Place that sprite on the ground, and give him the script called "example" by press shift+5 ( no "" ) leave dinkedit and open cedit ( my favorite script programm, download if you dont have it )
then put this into the script:
void main(void)
{
sp_base_walk(&current_sprite, ***);
sp_base_attack(&current_sprite, ***);
"and the rest, sp_hitpoints and sp_speed, etc..."
}
*** Fill in the bases and voila, you play your dmod and you should see him moving and attacking if you done this (he doesnt move or attack if you didnt gave him: )
sp_speed
sp_timing
:D
Hope you understand it :D
OMG prophet! I'm sure that's NOT what he was talking about!
He probably meant how to make a sprite move over the screen.
it's done like this :
move_stop(&current_sprite, 6, 400, 1);
You can substitute move_stop with move but that will NOT pause the script and wait until teh sprite has reached its destination.
6 is an example of a direction. You can change this to the direction you want your sprite to move in.
The next parameter determines tyhe destination coordinate. WHether its supposed to be an x-coordinate or a y-coordinate depends on the direction.
The 1 stands for "going through hardness". If it's 0 the sprite will stop when he touches hardness.
Hope this helps.
He probably meant how to make a sprite move over the screen.
it's done like this :
move_stop(&current_sprite, 6, 400, 1);
You can substitute move_stop with move but that will NOT pause the script and wait until teh sprite has reached its destination.
6 is an example of a direction. You can change this to the direction you want your sprite to move in.
The next parameter determines tyhe destination coordinate. WHether its supposed to be an x-coordinate or a y-coordinate depends on the direction.
The 1 stands for "going through hardness". If it's 0 the sprite will stop when he touches hardness.
Hope this helps.
To make a sprite walk around the screen by itself, give it a brain of 16. This is the 'Smart People' brain... they will walk around, stop, look around, then walk again. If you want the sprite to just walk around all the time, give it a brain of 9. This is done by using this command in that sprite's script:
sp_brain(&current_sprite, 16);
A sprite will not move unless it has a speed value. So give it one:
sp_speed(&current_sprite, 1);
Also, you need the base walk of the sprite, which as theprophet alluded to, is the sequence numbers of the sprite. So, if you're going to make an old man, who has 231, 233, 237, and 239 as the walk sequences, the base walk would be 230.
sp_base_walk(&current_sprite, 230);
sp_brain(&current_sprite, 16);
A sprite will not move unless it has a speed value. So give it one:
sp_speed(&current_sprite, 1);
Also, you need the base walk of the sprite, which as theprophet alluded to, is the sequence numbers of the sprite. So, if you're going to make an old man, who has 231, 233, 237, and 239 as the walk sequences, the base walk would be 230.
sp_base_walk(&current_sprite, 230);