Gamestudio Links
Zorro Links
Newest Posts
Executing Trades on Next Bar Open
by vicknick. 06/13/24 08:51
Zorro Beta 2.61: PyTorch
by jcl. 06/10/24 14:42
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
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (monarch), 1,259 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19059 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 3 of 3 1 2 3
Re: Beim Sprung friert die cam ein [Re: Ich_bin_Batman] #337404
08/10/10 18:48
08/10/10 18:48
Joined: Dec 2008
Posts: 222
janerwac13 Offline OP
Member
janerwac13  Offline OP
Member

Joined: Dec 2008
Posts: 222
function Kamera()
{
while(me != NULL)
{
camera.x = player.x;
camera.y = player.y;
camera.z = player.z;
rot_angle += mickey.x * 4;
rot_height = clamp(rot_height + mickey.y * 2,0,45);
vec_set(offset,vector(-300,0,100));
vec_rotate(offset,vector(rot_angle,-rot_height,0));
vec_set(camera.x,my.x);
vec_add(camera.x,offset);
camera.pan = rot_angle;
camera.tilt = -rot_height;
wait(1);
}
}

action ball()
{
VECTOR ball_speed;
ENTITY* ball;
var rot_angle = 0;
var rot_height = 0;
VECTOR offset;
var jumptimer = -1.5;
my.skill1=0;
ph_setgravity (vector(0, 0, -500)); // set the gravity
phent_settype (my, PH_RIGID, PH_SPHERE); // set the physics entity type
phent_setmass (my, 3, PH_SPHERE); // and its mass
phent_setfriction (my, 80); // set the friction
phent_setdamping (my, 40, 40); // set the damping
phent_setelasticity (my, 50, 20); // set the elasticity
while (1)
{
ball_speed.x = 40 * (key_d - key_a); // move the ball using the cursor keys
ball_speed.y = 40 * (key_w - key_s); // 25 sets the x / y movement speeds
ball_speed.z = 0; // no need to move on the vertical axis
vec_rotate(ball_speed,vector(camera.pan,0,0)); //Die Zeile rotiert deinen Bewegungsvektor mit der Kamera
if (key_p)
{
freeze_mode = 1;
set(pause_pan,VISIBLE);
mouse_mode = 2;
}
if(my.skill1>2 && key_space)
{
my.skill1=0;
phent_addvelcentral(me,vector(0,0,1000*time_step));

}
phent_addtorqueglobal (my, ball_speed); // add a torque (an angular force) to the ball
rot_angle += mickey.x * 4;
rot_height = clamp(rot_height + mickey.y * 2,0,45);
vec_set(offset,vector(-300,0,100));
vec_rotate(offset,vector(rot_angle,-rot_height,0));
vec_set(camera.x,my.x);
vec_add(camera.x,offset);
camera.pan = rot_angle;
camera.tilt = -rot_height;
if(my.z<-850)
{
ent_remove(my);
game_load("level",1);
return;
}
wait (1);
}
}

Re: Beim Sprung friert die cam ein [Re: janerwac13] #337408
08/10/10 18:54
08/10/10 18:54
Joined: May 2010
Posts: 48
I
Ich_bin_Batman Offline
Newbie
Ich_bin_Batman  Offline
Newbie
I

Joined: May 2010
Posts: 48
Code:
function Kamera()
{
while(me != NULL)
{
var rot_angle = 0;
var rot_height = 0;
camera.x = player.x;
camera.y = player.y;
camera.z = player.z;
rot_angle += mickey.x * 4;
rot_height = clamp(rot_height + mickey.y * 2,0,45);
vec_set(offset,vector(-300,0,100));
vec_rotate(offset,vector(rot_angle,-rot_height,0));
vec_set(camera.x,my.x);
vec_add(camera.x,offset);
camera.pan = rot_angle;
camera.tilt = -rot_height;
wait(1);
}
}

action ball()
{
VECTOR ball_speed;
ENTITY* ball;
VECTOR offset;
var jumptimer = -1.5;
my.skill1=0;
ph_setgravity (vector(0, 0, -500)); // set the gravity
phent_settype (my, PH_RIGID, PH_SPHERE); // set the physics entity type
phent_setmass (my, 3, PH_SPHERE); // and its mass
phent_setfriction (my, 80); // set the friction
phent_setdamping (my, 40, 40); // set the damping
phent_setelasticity (my, 50, 20); // set the elasticity
kamera();
while (1)
{
ball_speed.x = 40 * (key_d - key_a); // move the ball using the cursor keys
ball_speed.y = 40 * (key_w - key_s); // 25 sets the x / y movement speeds
ball_speed.z = 0; // no need to move on the vertical axis

if (key_p)
{
freeze_mode = 1;
set(pause_pan,VISIBLE);
mouse_mode = 2;
}
if(my.skill1>2 && key_space)
{
my.skill1=0;
phent_addvelcentral(me,vector(0,0,1000*time_step));

}
phent_addtorqueglobal (my, ball_speed); // add a torque (an angular force) to the ball

if(my.z<-850)
{
ent_remove(my);
game_load("level",1);
return;
}
wait (1);
}
}



Versuchs mal so


Last edited by Ich_bin_Batman; 08/10/10 18:57.
Re: Beim Sprung friert die cam ein [Re: Ich_bin_Batman] #337409
08/10/10 18:56
08/10/10 18:56
Joined: Dec 2008
Posts: 222
janerwac13 Offline OP
Member
janerwac13  Offline OP
Member

Joined: Dec 2008
Posts: 222
crash in Kamera() !

Re: Beim Sprung friert die cam ein [Re: janerwac13] #337410
08/10/10 18:57
08/10/10 18:57
Joined: May 2010
Posts: 48
I
Ich_bin_Batman Offline
Newbie
Ich_bin_Batman  Offline
Newbie
I

Joined: May 2010
Posts: 48
Habs editiert versuchs nochmal

Re: Beim Sprung friert die cam ein [Re: Ich_bin_Batman] #337411
08/10/10 18:59
08/10/10 18:59
Joined: Feb 2010
Posts: 482
in deinem Kopf
Otter Offline
Senior Member
Otter  Offline
Senior Member

Joined: Feb 2010
Posts: 482
in deinem Kopf
die kamera findet den player warscheinlich nicht weil er noch nicht definiert wurde (oder hab ichs übersehen?):
player = me;


Be my UBB-Buddy, without any reason!
Re: Beim Sprung friert die cam ein [Re: janerwac13] #337413
08/10/10 19:03
08/10/10 19:03
Joined: Dec 2008
Posts: 222
janerwac13 Offline OP
Member
janerwac13  Offline OP
Member

Joined: Dec 2008
Posts: 222
nun klapt es ! Danke !
Danke an Ich_bin_Batman sebbi91 und Otter !

Re: Beim Sprung friert die cam ein [Re: Otter] #337414
08/10/10 19:04
08/10/10 19:04
Joined: May 2010
Posts: 48
I
Ich_bin_Batman Offline
Newbie
Ich_bin_Batman  Offline
Newbie
I

Joined: May 2010
Posts: 48
Stimmt jedoch bin ich dann etwas verwirrt wozu das Entity* Ball eigentlich gut ist , da alle Camera Funktionen auf den Player gesetzt sind.

Page 3 of 3 1 2 3

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