Gamestudio Links
Zorro Links
Newest Posts
Future of ZorroHFT
by TipmyPip. 11/16/25 13:52
COT Download with Quandl does not work
by Petra. 11/15/25 09:35
Training with the R bridge does not work
by Petra. 11/15/25 09:31
Zorro 2.70
by jcl. 11/15/25 08:43
Camera always moves upwards?
by NeoDumont. 11/14/25 16:32
brokerCommand PLOT_HLINE parameters
by M_D. 11/13/25 10:42
ZorroGPT
by TipmyPip. 11/10/25 11:04
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
5 registered members (TipmyPip, Grant, Ayumi, ozgur, Quad), 7,400 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
tritom, sheliepaley, Blueguy, blobplayintennis, someone2
19178 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Camera and Player Control #189623
03/20/08 11:37
03/20/08 11:37
Joined: Jul 2006
Posts: 28
B
burning_devil Offline OP
Newbie
burning_devil  Offline OP
Newbie
B

Joined: Jul 2006
Posts: 28
Does anyone know a code where the controls of your player change, depending on what position the camera is facing.

Re: Camera and Player Control [Re: burning_devil] #189624
03/21/08 13:31
03/21/08 13:31
Joined: Nov 2006
Posts: 193
England
RyuShinji Offline
Member
RyuShinji  Offline
Member

Joined: Nov 2006
Posts: 193
England
If i understand your question, here's some code from the khmovement tutorial that does just that!


FUNCTION handle_movement() {
temp.x = -1000;
temp.y = 0;
IF (key_w == 1) { temp.x = camera.pan; }
IF (key_s == 1) { temp.x = camera.pan + 180; }
IF (key_a == 1) { temp.x = camera.pan + 90; }
IF (key_d == 1) { temp.x = camera.pan - 90; }
IF (temp.x != -1000) { temp.y = 15 * time; }
my.move_x = fcos(temp.x,temp.y);
my.move_y = fsin(temp.x,temp.y);
c_move(my,nullvector,my.move_x,use_aabb | ignore_passable | glide);
}


hope that helps...

Last edited by RyuShinji; 03/21/08 14:58.
Re: Camera and Player Control [Re: RyuShinji] #189625
03/22/08 11:55
03/22/08 11:55
Joined: Mar 2007
Posts: 151
JokeSpeaker Offline
Member
JokeSpeaker  Offline
Member

Joined: Mar 2007
Posts: 151
sry for taking this thread, but my problem is akin.
I write the code, that Ryu posted and use it for my physics.

temp.x = -1000;
temp.y = 0;
if(key_w == 1) { temp.x = camera.pan; }
if(key_s == 1) { temp.x = camera.pan + 180; }
if(key_a == 1) { temp.x = camera.pan + 90; }
if(key_d == 1) { temp.x = camera.pan - 90; }
if(temp.x != -1000) { temp.y = 15 * time_step; }
ball_speed.x = fcos(temp.x,temp.y);
ball_speed.y = fsin(temp.x,temp.y);
ball_speed.z = 0;
phent_addcentralforce(ball, ball_speed);

But the Ball don't move...
What I writed wrong?

The code is in the while of the main function.

I use A7 Commercial

Last edited by JokeSpeaker; 03/22/08 11:56.

Gamestudio download | 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