Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/19/24 18:45
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
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
5 registered members (AndrewAMD, 7th_zorro, TedMar, Ayumi, kzhao), 756 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
World Of Warcraft Camera #53413
08/26/05 23:22
08/26/05 23:22
Joined: Jan 2004
Posts: 295
OptimuS Offline OP
Member
OptimuS  Offline OP
Member

Joined: Jan 2004
Posts: 295
A little script for a World of Warcraft style camera. I deleted some lines that you dont need , eg. a collision check that does not work right if the script does not work , or give an error , post it because I havent tested it without those lines but I think it should work.
Hope you enjoy it.

Code:

var camera_distance = 400;

var zoom;

function player_act
{
player = me;
zoom = camera_distance;
while(1)
{
if(key_space == 1)
{
if(ang(camera.pan) < ang(player.pan - 3))
{
camera.pan += 5 * time;
}
if(ang(camera.pan) > ang(player.pan + 3))
{
camera.pan -= 5 * time;
}
}

if(mickey.z > 0)
{
zoom -= 25 * time;
}
if(mickey.z < 0)
{
zoom += 25 * time;
}
if(zoom < 40) { zoom = 40; }
if(zoom > 600) { zoom = 600; }

camera_distance = zoom;

if(camera_control == 1)
{
camera.tilt += 6 * mouse_force.y * (time * 2);
if(camera.tilt > 75)
{
camera.tilt = 75;
}
if(camera.tilt < -75)
{
camera.tilt = -75;
}

camera.pan -= 6 * mouse_force.x * (time * 2);
}
else
{
camera.pan += 6 * (key_left - key_right) * time;
}
camera.z = my.z - camera_distance * sin(camera.tilt);
camera.x = my.x - camera_distance * cos(camera.tilt) * cos(camera.pan);
camera.y = my.y - camera_distance * cos(camera.tilt) * sin(camera.pan);
wait(1);
}
}

function camera_control_init()
{
while(1)
{
if(mouse_left == 1)
{
wait(8);
if(mouse_left == 1)
{
camera_control = 1;
}
else
{
camera_control = 0;
}
}
else
{
camera_control = 0;
}
wait(1);
}
}



Re: World Of Warcraft Camera [Re: OptimuS] #53414
08/27/05 18:08
08/27/05 18:08
Joined: Jul 2005
Posts: 421
Germany
DoC Offline
Senior Member
DoC  Offline
Senior Member

Joined: Jul 2005
Posts: 421
Germany
it dont working explain how i must include it and I think many things ar not defined (keyword unknown)

Re: World Of Warcraft Camera [Re: DoC] #53415
08/27/05 18:19
08/27/05 18:19
Joined: May 2005
Posts: 86
O
Ogtrax Offline
Junior Member
Ogtrax  Offline
Junior Member
O

Joined: May 2005
Posts: 86
Code:
 var camera_distance = 400;

var zoom;

function player_act()
{
player = me;
zoom = camera_distance;
while(1)
{
if(key_space == 1)
{
if(ang(camera.pan) < ang(player.pan - 3))
{
camera.pan += 5 * time;
}
if(ang(camera.pan) > ang(player.pan + 3))
{
camera.pan -= 5 * time;
}
}

if(mickey.z > 0)
{
zoom -= 25 * time;
}
if(mickey.z < 0)
{
zoom += 25 * time;
}
if(zoom < 40) { zoom = 40; }
if(zoom > 600) { zoom = 600; }

camera_distance = zoom;

if(camera_control == 1)
{
camera.tilt += 6 * mouse_force.y * (time * 2);
if(camera.tilt > 75)
{
camera.tilt = 75;
}
if(camera.tilt < -75)
{
camera.tilt = -75;
}

camera.pan -= 6 * mouse_force.x * (time * 2);
}
else
{
camera.pan += 6 * (key_left - key_right) * time;
}
camera.z = my.z - camera_distance * sin(camera.tilt);
camera.x = my.x - camera_distance * cos(camera.tilt) * cos(camera.pan);
camera.y = my.y - camera_distance * cos(camera.tilt) * sin(camera.pan);
wait(1);
}
}

function camera_control_init()
{
while(1)
{
if(mouse_left == 1)
{
wait(8);
if(mouse_left == 1)
{
camera_control = 1;
}
else
{
camera_control = 0;
}
}
else
{
camera_control = 0;
}
wait(1);
}
}



This should work. Just some missing parentheses


Re: World Of Warcraft Camera [Re: Ogtrax] #53416
08/27/05 20:10
08/27/05 20:10
Joined: Apr 2005
Posts: 4,506
Germany
F
fogman Offline
Expert
fogman  Offline
Expert
F

Joined: Apr 2005
Posts: 4,506
Germany
"camera_control"

I think this is the missing variable. Itīs not
defined.

Define camera_control as global var, then it should work.


no science involved
Re: World Of Warcraft Camera [Re: fogman] #53417
08/28/05 20:35
08/28/05 20:35
Joined: Jan 2004
Posts: 295
OptimuS Offline OP
Member
OptimuS  Offline OP
Member

Joined: Jan 2004
Posts: 295
sorry I forgot about that.
The rotation when pressing space isnt working as it should be. Sometimes the camera rotates all around the entity , and the closest way wasnt in this direction...if you can understand what I mean
I will fix this soon , and try to add a collision detection. If someone wants to play with the script and come up with something post it.


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