Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
0 registered members (), 16,643 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 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