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
2 registered members (AndrewAMD, Nymphodora), 485 guests, and 3 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
Page 2 of 2 1 2
Re: Patrol on Path [Re: Liamissimo] #297338
11/06/09 21:20
11/06/09 21:20
Joined: Oct 2004
Posts: 1,655
T
testDummy Offline
Serious User
testDummy  Offline
Serious User
T

Joined: Oct 2004
Posts: 1,655
Code:
/* 
???
pathwalker_a 
A7 Lite-C
ENTITY loops / moves (x,y,z) along path 
(optional) ENTITY turns (pan, tilt) to next node
???
*/

// temp variables
VECTOR* v2 = {x=0; y=0; z=0;}
VECTOR* v3 = {x=0; y=0; z=0;}  
ANGLE* a1 = {pan=0; tilt=0; roll=0;}

// skills
#define _nodeId skill71
#define _nodeDir skill72

action pathwalker_a() {
	wait(1);
	// attach entity to nearest path
	my._nodeId = path_scan(me,my.x,my.pan,vector(360,180,1000));
	
	my._nodeDir = 1;
	//my._nodeId = 1;

	if (my._nodeId != 0) {
	
		while(me != NULL) {
			if (path_getnode(me, my._nodeId, v3, NULL) == 0) {
				my._nodeDir *= -1;
				my._nodeId += my._nodeDir;
				path_getnode(me, my._nodeId, v3, NULL);
			} 
			if (vec_dist(my.x, v3) < 25) {
				my._nodeId += my._nodeDir;
			}
			// v3 is destination VECTOR
			vec_diff(v2, v3, my.x);		// v2 is destination direction
			
			// turn ENTITY towards node
			vec_to_angle(a1, v2);
			my.pan += ang(a1.pan - my.pan) * 0.5*time_step;
			my.tilt += ang(a1.tilt - my.tilt) * 0.5*time_step;
			
			// move ENTITY
			vec_normalize(v2, 1);
			vec_scale(v2, 10 * time_step);
			c_move(me, nullvector, v2, GLIDE | IGNORE_PUSH);
			wait(1);
		}
	}
}


(arrrrr!!!)



Re: Patrol on Path [Re: testDummy] #297350
11/06/09 22:33
11/06/09 22:33
Joined: Jul 2009
Posts: 1,198
Berlin, Germany
L
Liamissimo Offline OP
Serious User
Liamissimo  Offline OP
Serious User
L

Joined: Jul 2009
Posts: 1,198
Berlin, Germany
Thanks, but were have you found it? Sorry wink


"Ich weiss nicht genau, was Sie vorhaben, aber Sie können keine Triggerzonen durch Ihr Level kullern lassen."
-JCL, 2011
Page 2 of 2 1 2

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