Gamestudio Links
Zorro Links
Newest Posts
New FXCM FIX Plugin
by flink. 06/04/24 07:30
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (Ayumi, Akow, AndrewAMD), 1,505 guests, and 9 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19058 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Question about angle functions #442502
06/23/14 22:13
06/23/14 22:13
Joined: Jun 2010
Posts: 71
L
LawnmowerMan Offline OP
Junior Member
LawnmowerMan  Offline OP
Junior Member
L

Joined: Jun 2010
Posts: 71
Hi guys I need help.
I want to create an ball (with ent_create function) from vector A position. Then I want move this ball to the vector B. My question is, how can I tell that the ball it move toward to the vector B?

Re: Question about angle functions [Re: LawnmowerMan] #442503
06/23/14 22:22
06/23/14 22:22
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Easy way:
Change pan as follows
vec_diff(temp, B, A);
vec_to_angle(ball.pan,temp);
and then c_move using the first speed parameter.


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: Question about angle functions [Re: Superku] #442506
06/23/14 23:02
06/23/14 23:02
Joined: Jun 2010
Posts: 71
L
LawnmowerMan Offline OP
Junior Member
LawnmowerMan  Offline OP
Junior Member
L

Joined: Jun 2010
Posts: 71
Thanks for answer. I do not know where I wrong, but my ball fly in wrong way

Code:
action cannon_ball(){
	set(my,PASSABLE);
	my.speed_x = 8;
	VECTOR temp2;
	while(1){
	        vec_for_vertex(temp2,cannon,43);
	        vec_diff(temp, player.x, temp2);
		vec_to_angle(my.pan,temp);
		c_move(my,temp2,my.speed_x,IGNORE_PASSABLE);
		wait(1);	
	}
}


Re: Question about angle functions [Re: LawnmowerMan] #442508
06/23/14 23:07
06/23/14 23:07
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
c_move(my,temp2,my.speed_x,IGNORE_PASSABLE);
This does not make much sense to me. Check the manual reference for c_move, you are giving a world position (temp2) as the relative speed vector.
Try sth as follows:

Code:
action cannon_ball(){
	set(my,PASSABLE);
	my.speed_x = 8;
	vec_for_vertex(my.x,cannon,43);
	vec_diff(temp, player.x, my.x);
	vec_to_angle(my.pan,temp);
	while(1){
		c_move(my,vector(my.speed_x*time_step,0,0),nullvector,IGNORE_PASSABLE);
		wait(1);	
	}
}



"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: Question about angle functions [Re: Superku] #442509
06/23/14 23:27
06/23/14 23:27
Joined: Jun 2010
Posts: 71
L
LawnmowerMan Offline OP
Junior Member
LawnmowerMan  Offline OP
Junior Member
L

Joined: Jun 2010
Posts: 71
Ah, now I understand. Thank you man!


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