Gamestudio Links
Zorro Links
Newest Posts
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
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (degenerate_762), 1,128 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
question #96502
10/29/06 18:07
10/29/06 18:07
Joined: Aug 2006
Posts: 68
A
alex5801 Offline OP
Junior Member
alex5801  Offline OP
Junior Member
A

Joined: Aug 2006
Posts: 68
is the code below can convert into control like is 1st person shooting game?
like w and s to go forward and backward
a and d to go backwards
mouse to turn

Code:
--------------------------------------------------------------------------------

FUNCTION handle_movement() {
temp.x = -1000;
temp.y = 0;
my.moving = 0;
IF (key_w == 1 && key_s == 0 && key_a == 0 && key_d == 0) { temp.x = camera.pan; }
IF (key_s == 1 && key_w == 0 && key_a == 0 && key_d == 0) { temp.x = camera.pan + 180; }
IF (key_a == 1 && key_s == 0 && key_w == 0 && key_d == 0) { temp.x = camera.pan + 90; }
IF (key_d == 1 && key_s == 0 && key_a == 0 && key_w == 0) { temp.x = camera.pan - 90; }
IF (key_w == 1 && key_a == 1 && key_d == 0 && key_s == 0) { temp.x = camera.pan + 45; }
IF (key_w == 1 && key_d == 1 && key_a == 0 && key_s == 0) { temp.x = camera.pan - 45; }
IF (key_s == 1 && key_a == 1 && key_d == 0 && key_w == 0) { temp.x = camera.pan + 135; }
IF (key_s == 1 && key_d == 1 && key_a == 0 && key_w == 0) { temp.x = camera.pan - 135; }
IF (temp.x != -1000) {
my.moving = 1;
IF (key_shift == 1) { temp.y = 10 * time; } ELSE { temp.y = 15 * time; }
}

IF (my.movement_mode == 0) {
my.move_x = fcos(temp.x,temp.y);
my.move_y = fsin(temp.x,temp.y);
}
IF (my.movement_mode == 1 || my.movement_mode == 2) {
temp.y = fsin((my.animate * 1.2) + 45,15 * time);
my.move_x = fcos(my.pan,temp.y);
my.move_y = fsin(my.pan,temp.y);
temp.y = 0;
IF (temp.x != -1000)
{
temp.y = 1;
}
}

move_mode = ignore_passable | glide;
ent_move(nullvector,my.move_x);


result = trace(vector(my.x,my.y,my.z - my.z_offset),vector(my.x,my.y,my.z - 4000));
IF (result < 0)
{ my.z -= result;
my.velocity_z = 0;
}

--------------------------------------------------------------------------------

Last edited by alex5801; 10/29/06 22:55.
Re: question [Re: alex5801] #96503
10/29/06 18:23
10/29/06 18:23
Joined: Jan 2003
Posts: 1,738
Nashua New Hampshire
anonymous_alcoho Offline
Senior Developer
anonymous_alcoho  Offline
Senior Developer

Joined: Jan 2003
Posts: 1,738
Nashua New Hampshire
Dude, I can't even read that. If it was structured properly, either:

Code:
 
function myFunc()
{
if(someCondition)
{
myVar += 2;
}
}


or
Code:
 
function myFunc() {
if(someCondition) {
myVar += 2;
}
}



maybe I could read it and answer your question.

On a side note, I prefer the top format, but both are pretty readable.


"Oh no, it's true! I'm a love magnet!" Calvin from Calvin and Hobbes My name's Anonymous_Alcoholic.

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