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
simple CAMERA CODE for cell based or board games #51903
08/15/05 15:59
08/15/05 15:59
Joined: Aug 2005
Posts: 1,185
Ukraine
Lion_Ts Offline OP
Serious User
Lion_Ts  Offline OP
Serious User

Joined: Aug 2005
Posts: 1,185
Ukraine
Code:

//CAMERA CODE
//2005 by LionTs.
//Place big (72pt) text over your gamescreen:"THANKS TO LionTs" in pure red, if this one was used in your project, text must be visible 1 hour :)
//Ok, it's my stupid joke above...
//FREE for all 3DGS community, can be used or modified freely in any project without written permissions from author.
// - for cell based or board games
// - 3rd view, follow the player
// - player moves in four directions only
// - code can be rewritten for diagonal move (add another if(player.pan==...))
function follow_cam()
{
proc_kill(4); //kill camera code if exist
proc_late();
vec_set(camera.pan,nullvector); //reset camera's angles
camera.tilt = -15; // look down at the player
while (1){ //do it forever
while (player==null) {wait(1);}
vec_set(camera.x,player.x);
camera.x -= 320; //distance between the player and the camera
camera.z += 190; // above the player
//case forward
if (player.pan == 0) {
if (camera.tilt != -15) {
if (camera.tilt < -15) {
camera.tilt += time;
camera.tilt=min(camera.tilt,-15);
}
}
if (camera.pan != 0) {
if (camera.pan > 0) {
camera.pan -= time;
camera.pan=max(camera.pan,0);
}
if (camera.pan < 0) {
camera.pan += time;
camera.pan=min(camera.pan,0);
}
}
} else {
//case backward
if (player.pan == 180) {
if (camera.tilt != -30) {
if (camera.tilt > -30) {
camera.tilt -= time;
camera.tilt=max(camera.tilt,-30);
}
}
if (camera.pan != 0) {
if (camera.pan > 0) {
camera.pan -= time;
camera.pan=max(camera.pan,0);
}
if (camera.pan < 0) {
camera.pan += time;
camera.pan=min(camera.pan,0);
}
}
} else {
//case left
if (player.pan == 270) {
if (camera.tilt != -15) {
if (camera.tilt < -15) {
camera.tilt += time;
camera.tilt=min(camera.tilt,-15);
}
}
if (camera.pan != -15) {
if (camera.pan > -15) {
camera.pan -= time;
camera.pan=max(camera.pan,-15);
}
if (camera.pan < -15) {
camera.pan += time;
camera.pan=min(camera.pan,-15);
}
}
} else {
//case right
if (player.pan == 90) {
if (camera.tilt != -15) {
if (camera.tilt < -15) {
camera.tilt += time;
camera.tilt=min(camera.tilt,-15);
}
}
if (camera.pan != 15) {
if (camera.pan > 15) {
camera.pan -= time;
camera.pan=max(camera.pan,15);
}
if (camera.pan < 15) {
camera.pan += time;
camera.pan=min(camera.pan,15);
}
}
}}}}//switch
wait(1);
}
} // end of FOLLOW_CAM()



Re: simple CAMERA CODE for cell based or board games [Re: Lion_Ts] #51904
08/16/05 16:22
08/16/05 16:22
Joined: Sep 2004
Posts: 178
J
jweb Offline
Member
jweb  Offline
Member
J

Joined: Sep 2004
Posts: 178
hi lion
thank for this code !
We can i implement this code in my projekt ?
I see no Action to attach on a model ....

Thanks for help

Jweb

Re: simple CAMERA CODE for cell based or board games [Re: jweb] #51905
08/16/05 17:01
08/16/05 17:01
Joined: Aug 2004
Posts: 593
Germany
Efrint Offline
Developer
Efrint  Offline
Developer

Joined: Aug 2004
Posts: 593
Germany
here is an example

ACTION hero
{
follow_cam()
//here´s the other stuff of the player_code
}

I hope, you understand it...

Regards Efrint

Re: simple CAMERA CODE for cell based or board games [Re: Efrint] #51906
08/17/05 12:50
08/17/05 12:50
Joined: Aug 2005
Posts: 1,185
Ukraine
Lion_Ts Offline OP
Serious User
Lion_Ts  Offline OP
Serious User

Joined: Aug 2005
Posts: 1,185
Ukraine
Yeah, call it from action where Your player was created


Moderated by  adoado, checkbutton, mk_1, Perro 

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