Gamestudio Links
Zorro Links
Newest Posts
Trading Journey
by howardR. 04/28/24 09:55
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Help with plotting multiple ZigZag
by M_D. 04/26/24 20:03
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
M1 Oversampling
by jcl. 04/26/24 11:12
Why Zorro supports up to 72 cores?
by jcl. 04/26/24 11:09
Eigenwerbung
by jcl. 04/26/24 11:08
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
5 registered members (ozgur, howardR, AndrewAMD, exile, Ayumi), 725 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
wandaluciaia, Mega_Rod, EternallyCurious, howardR, 11honza11
19049 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Path problem #182297
02/06/08 03:27
02/06/08 03:27
Joined: Dec 2007
Posts: 19
colombo, Sri Lanka
kombuwa Offline OP
Newbie
kombuwa  Offline OP
Newbie

Joined: Dec 2007
Posts: 19
colombo, Sri Lanka
can anyone say good tutorial about path(move entity in a path )?
please,

Re: Path problem [Re: kombuwa] #182298
02/06/08 09:39
02/06/08 09:39
Joined: Dec 2007
Posts: 19
colombo, Sri Lanka
kombuwa Offline OP
Newbie
kombuwa  Offline OP
Newbie

Joined: Dec 2007
Posts: 19
colombo, Sri Lanka
how to move a object on a path?

Re: Path problem [Re: kombuwa] #182299
02/06/08 16:29
02/06/08 16:29
Joined: Aug 2005
Posts: 390
Florida
O
oldschoolj Offline
Senior Member
oldschoolj  Offline
Senior Member
O

Joined: Aug 2005
Posts: 390
Florida
if you're looking to just simply move an object along a plath its quite straight forward. Try this:

Code:
#define MOVEMENT_SPEED skill1
var dist = 0; // entity path
var vLastPos[3];
var vDir[3];

action the_entity ()
{
path_set(my, "the_path");
while(1)
{
path_spline(me,my.x,dist);
dist += 5*time_step;
vec_diff(vDir,my.x,vLastPos);
vec_to_angle(my.pan,vDir);
vec_set(vLastPos,my.x);
ent_animate(my, "walk", my.MOVEMENT_SPEED, ANM_CYCLE);
my.MOVEMENT_SPEED += 30 * time_step;
wait(1);
}
}



you can either assign this action to the entity in wed, or turn it into a function and assign it to an entity that you've created in your script. If you have a action already for the entity, then just put this in your current action.



Last edited by oldschoolj; 02/06/08 16:30.

you can find me with my face in the keyboard, unshaven, listening to some nameless techno tragedy, and hashing through code over a cold cup a stale joe. __________________________________ yours truly
Re: Path problem [Re: oldschoolj] #182300
02/08/08 04:11
02/08/08 04:11
Joined: Dec 2007
Posts: 19
colombo, Sri Lanka
kombuwa Offline OP
Newbie
kombuwa  Offline OP
Newbie

Joined: Dec 2007
Posts: 19
colombo, Sri Lanka
thank you for help.
code is working fine.

now i have another problem. it is how to find next node of path.
Code:
 
next_nod=path_nextnode(my,path_getnode(me,1,1,my.skill2),path_getedeg(me,1,1,my.skill1));

next_nod= path_scannode(my,path_getnode(my));



i have tryed this methods but faile.

i want to get current node vector position and next node vector position to
calculate angel like this
Code:

ang_c=atan(((next_node.x-curr_node.x)/next_node.y-curr_node.y));
vec_to_angle(my.pan+ang_c,vDir);



Re: Path problem [Re: kombuwa] #182301
02/09/08 07:12
02/09/08 07:12
Joined: Dec 2007
Posts: 19
colombo, Sri Lanka
kombuwa Offline OP
Newbie
kombuwa  Offline OP
Newbie

Joined: Dec 2007
Posts: 19
colombo, Sri Lanka
can anyone help me for problem that occurred in Path, node.

i want to get next node x,y

for calculate and set angel of object move in path

Re: Path problem [Re: kombuwa] #182302
02/09/08 08:55
02/09/08 08:55

A
Anonymous
Unregistered
Anonymous
Unregistered
A



Hi kombuwa,

here is a test app for the GS paths I made several weeks ago.
It shows the most possibilities of the path technique plus has the not in lite-c/c-script implemented function (but highly needed) path_prevnode (de)
I also shows the way to use more edges from one node.

test app for lite-c

test app for c-script

I think this gives you enough hints to get the way to use paths?

have fun, mercuryus


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1