Gamestudio Links
Zorro Links
Newest Posts
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 (Akow, TipmyPip, tomaslolo), 788 guests, and 11 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19055 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Concerning the camera code in workshop 24 #316384
03/23/10 18:21
03/23/10 18:21
Joined: Oct 2009
Posts: 49
L
Lecithin Offline OP
Newbie
Lecithin  Offline OP
Newbie
L

Joined: Oct 2009
Posts: 49
I understand all of the functions in the code below but I have a question regarding the ENTITY pointer.


I understand that the function camera_follow is assigned to ENTITY* ent but how does Gstudio know which entity is ent? There are multiple entities, why does the camera follow your wizard and not the other?

Code:
function camera_follow(ENTITY* ent)
{
	while(1) 
	{
		vec_set(camera.x,vector(-150,10,50));  // camera position relative to the player      
		vec_rotate(camera.x,ent.pan); // rotate the camera position with the player
		vec_add(camera.x,ent.x);      // add player position
		vec_set(camera.pan,vector(ent.pan,-10,0)); // look in player direction, slighty down      
		wait(1);
	}
}



Re: Concerning the camera code in workshop 24 [Re: Lecithin] #316389
03/23/10 19:04
03/23/10 19:04
Joined: Feb 2009
Posts: 3,207
Germany, Magdeburg
Rei_Ayanami Offline
Expert
Rei_Ayanami  Offline
Expert

Joined: Feb 2009
Posts: 3,207
Germany, Magdeburg
the wizard has, if i am right, an action.

in this action the entity pointer "me" is valid for the model which has the action assigned.

In this action the function camera_follow is called. It overgives the pararmeter which entity should be followed. That means, if an action calls camera_follow and overgives the me/my parameter the camera will follow the entity wink

camera_follow(me); //in the action of the model which the camera should fllow

Re: Concerning the camera code in workshop 24 [Re: Rei_Ayanami] #316407
03/23/10 20:45
03/23/10 20:45
Joined: Oct 2009
Posts: 49
L
Lecithin Offline OP
Newbie
Lecithin  Offline OP
Newbie
L

Joined: Oct 2009
Posts: 49
wow I feel like an idiot. I got so caught up on the camera code that I forgot about the action that is called later...

Thanks for your explanation, if I understand it correctly, it's just passing the me to the camera so that the me entity is the same me as the action that originally assigned it.


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