Gamestudio Links
Zorro Links
Newest Posts
ZorroGPT
by TipmyPip. 02/26/26 21:35
WFO Training with parallel cores Zorro64
by Martin_HH. 02/26/26 16:03
Zorro version 3.0 prerelease!
by TipmyPip. 02/25/26 16:38
Camera always moves upwards?
by clonman. 02/21/26 09:29
Sam Foster Sound | Experienced Game Composer for Hire
by titanicpiano14. 02/19/26 13:22
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
1 registered members (TipmyPip), 6,016 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
the1, alx, ApprenticeInMuc, PatrickH90, USER0328
19200 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