Gamestudio Links
Zorro Links
Newest Posts
loading historical data 1st time
by AndrewAMD. 04/14/23 12:54
Trade at bar open
by juanex. 04/13/23 19:43
Bug in Highpass2 filter
by rki. 04/13/23 09:54
Adding Limit Orders For IB
by scatters. 04/11/23 16:16
FisherN
by rki. 04/11/23 08:38
AUM Magazine
Latest Screens
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Hecknex World
Who's Online Now
3 registered members (AndrewAMD, The_Judge, Grant), 898 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
rki, FranzIII, indonesiae, The_Judge, storrealba
18919 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Can sprites face the user vertically? #333725
07/18/10 17:08
07/18/10 17:08
Joined: Jun 2010
Posts: 590
California
Ruben Offline OP
User
Ruben  Offline OP
User

Joined: Jun 2010
Posts: 590
California
Does anyone know of a way to make a sprite face the user vertically if the user goes under or over it?

I set all the rotate values of my sprites to 0.0, making them face me in the horizontal direction I am from them. However, I cannot seem to make them face up toward me if I am over them, or down toward me if I am under them. Does anyone know how to make sprites face you vertically instead of just horizontally?

Last edited by Ruben; 07/18/10 17:11.
Re: Can sprites face the user vertically? [Re: Ruben] #333726
07/18/10 17:11
07/18/10 17:11
Joined: Jul 2009
Posts: 1,198
Berlin, Germany
L
Liamissimo Offline
Serious User
Liamissimo  Offline
Serious User
L

Joined: Jul 2009
Posts: 1,198
Berlin, Germany
Code:
action toplayerlook()
{
	VECTOR temp;
	while(me)
	{
		vec_set(temp,ball.x);
		vec_sub(temp,my.x);
		vec_to_angle(my.pan,temp);
		wait(1);
	}
}



Replace the ball.x with your player entitiy laugh


"Ich weiss nicht genau, was Sie vorhaben, aber Sie können keine Triggerzonen durch Ihr Level kullern lassen."
-JCL, 2011
Re: Can sprites face the user vertically? [Re: Liamissimo] #333759
07/18/10 21:01
07/18/10 21:01
Joined: Jun 2010
Posts: 590
California
Ruben Offline OP
User
Ruben  Offline OP
User

Joined: Jun 2010
Posts: 590
California
Thanks TheLiam. I will try that when I get back to programming for the game with Lite-C.

Re: Can sprites face the user vertically? [Re: Ruben] #333762
07/18/10 21:16
07/18/10 21:16
Joined: May 2008
Posts: 2,113
NRW/Germany
alibaba Offline
Expert
alibaba  Offline
Expert

Joined: May 2008
Posts: 2,113
NRW/Germany
@TheLiam
i think you made a small mistake.
you wrote this:
vec_set(temp,ball.x);
vec_sub(temp,my.x);
vec_to_angle(my.pan,temp);

but temp is a vector, so it has to look like this :
vec_set(temp.x,ball.x);
vec_sub(temp.x,my.x);
vec_to_angle(my.pan,temp.x);


Professional Edition
A8.47.1
--------------------
http://www.yueklet.de
Re: Can sprites face the user vertically? [Re: alibaba] #333768
07/18/10 21:41
07/18/10 21:41
Joined: Aug 2007
Posts: 1,922
Schweiz
Widi Offline
Serious User
Widi  Offline
Serious User

Joined: Aug 2007
Posts: 1,922
Schweiz
@alibaba: you are wrong. If you define the vector with "VECTOR temp;" then the x is not necessary at the vec_set. You need it only if you use a pointer to a entity so the vec_set knows witch vector of the entity you want to set (x, pan, red...)

vec_set expect a VECTOR* and temp is one. wink

EDIT: of course you can also use temp.x, works too

Last edited by Widi; 07/18/10 21:45.

Moderated by  HeelX, rvL_eXile 

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