|
Re: Demo of my game
[Re: tek]
#81313
07/14/06 15:57
07/14/06 15:57
|
Joined: May 2005
Posts: 222
tek
OP
Member
|
OP
Member
Joined: May 2005
Posts: 222
|
Quote:
The camera is too close from the ground so you should change the tilt of the camera or rise the target of the camera .
Does anyone know how to fix this in my code, where I got my code was from a tutorial, I tried changing numbers but nothing seem to work. this is my code.
Quote:
var laufen[3]=0,0,0; var unten[3]=0,0,-3; var dist_planar = 0; var cam_angle = 0; var dist_total = 60; var tilt_3rd = 30; var dist_traced; var zoom=300; var move_vec[3]=0,0,0; var stand_percent=0; var walk_percent=0; var player_distance[3]=0,0,0; define gegner,flag1; define health,skill1; sound player_hurt=<player_hurt.wav>; sound hit_scorpion=<hit_scorpion.wav>; bind <bullet.mdl>; var jump_time=1; var gravity=2; var player_distance; var distance_traced; define ground_dist, skill2;
function validate_view() { player=my; trace_mode = ignore_me + ignore_passable; dist_traced = trace (player.x, camera.x); if (dist_traced == 0) { return; } // No obstacles hit... fine if (dist_traced < dist_total) { dist_traced -= 5; // Move it out of the wall dist_planar = cos (tilt_3rd)* dist_traced; camera.x = player.x - cos (cam_angle) * dist_planar; camera.y = player.y - sin (cam_angle) * dist_planar; camera.z = player.z + sin (tilt_3rd) * dist_traced; } }
function update_views() { dist_planar = cos (tilt_3rd) * dist_total; camera.pan=player.pan;camera.tilt=player.tilt;camera.roll=player.roll; camera.x = player.x - cos(player.pan)*cos(-player.tilt)*zoom; camera.y = player.y - sin(player.pan)*cos(-player.tilt)*zoom; camera.z = player.z + sin(-player.tilt)*zoom; camera.pan = cam_angle; camera.roll = 0; camera.tilt = - tilt_3rd; validate_view(); }
FUNCTION fall_event { if(event_type==event_block) { unten.z=0; } else { unten.z=-3; } if(event_type==event_entity) { unten.z=0; } else { unten.z=-3; } }
ACTION player_move { my.health=100; player=my; my.event=fall_event; my.enable_click=on; score.visible=on; //name_ent1();
while(my.health > 0)
{ ////camera//// update_views(); camera_to_target();
////walking//// c_move (me,laufen,nullvector,GLIDE+IGNORE_PASSABLE); c_move (me,unten,nullvector,IGNORE_PASSABLE); ////controle////
if(key_t==1) { camera.genius=player; camera.x=player.x; camera.y=player.y; camera.z=player.z+55; camera.pan=player.pan; waitt(1); }
player_distance.x=18*(key_w-key_s)*time; my.pan-=12*mouse_force.x*time; move_vec[1]=(key_comma-key_period)*20*time; if(camera.tilt > 90){camera.tilt = 90;} if(camera.tilt < -90){camera.tilt = -90; } vec_set (temp, my.x); temp.z -= 1000; trace_mode = ignore_me + ignore_passable + use_box; my.skill2 = trace(my.x, temp); if (my.skill2 > 2) { player_distance.z -= 2 * time; } else { player_distance.z = 0; } if (my.skill2 < 0) { player_distance.z += 5 * time; } /* if(my.health<=0) { wait(1); load_level(<mynewgame.wmb>); my.enable_impact=ON; my.event=lev_2_event; } if(myscore==390) { my.enable_impact=ON; my.event=lev_1_event; my.enable_impact=OFF; wait(1); load_level(<MOSESL~1.wmb>); } */ if(key_shift ==1) { player_distance.x += player_distance.x; player_distance.y += player_distance.y;} if(key_w-key_s) { walk_percent=(walk_percent+5*time)%100; ent_animate(me,"walk",walk_percent,ANM_CYCLE); } if(key_w-key_s==0) { stand_percent=(stand_percent+5*time)%100; ent_animate(me,"stand",stand_percent,ANM_CYCLE); } if (key_shift!=0&&key_w-key_s!=0) { walk_percent=(walk_percent+5*time)%100; ent_animate(me,"walk",walk_percent,ANM_CYCLE); } if (key_ctrl==1) { attack_percent=(attack_percent+5*time)%100; ent_animate(me,"attack",attack_percent,ANM_CYCLE); } if(mouse_left==1) { attack_percent=(attack_percent+5*time)%100; ent_animate(me,"attack",attack_percent,ANM_CYCLE); }
if(key_space == 1){jump();} move_mode = ignore_passable+glide; ent_move (player_distance,nullvector); wait(1); } camera.roll = 90; }
I know this is a long code, but if someone can just tell me where I can start experimenting to make the camera not be in Moses behind I would greatly appreciate :\
|
|
|
Re: Demo of my game
[Re: ZZZgames]
#81314
07/14/06 16:05
07/14/06 16:05
|
Joined: May 2005
Posts: 222
tek
OP
Member
|
OP
Member
Joined: May 2005
Posts: 222
|
Quote:
How many spikes did you place all over the holes? Because the problem might not be the polycount but more the fact there are many mdls due to many spikes ... thats why i told you to create one big mdl with many spikes and attach to it the spike script.
yea thats a good idea im gonna do that. thanks for the advice that would help my game.
|
|
|
Re: Demo of my game
[Re: tek]
#81316
07/14/06 17:58
07/14/06 17:58
|
Joined: Aug 2005
Posts: 218
ZZZgames
Member
|
Member
Joined: Aug 2005
Posts: 218
|
Cool that it worked For the tilt ..You can change the tilt by two ways. The camera function is called from player_move action with the line " update_views();" 1)So when you look at the function update_views() ,you can see there is the 8th line of the function that says "camera.tilt = - tilt_3rd;" . So you can change directly the tilt with a numeric value here instead of the tilt_3rd var. Or 2)tilt_3rd is a var defined in the first lines before the functions ... Its defined in the 6th line of the whole script you posted ..And it says "var tilt_3rd = 30;" So you can change the value of the variable there. This is how ,imho you can change the tilt ...But i am not sure since i cant test it.
|
|
|
Re: Demo of my game
[Re: tek]
#81319
07/19/06 15:14
07/19/06 15:14
|
Joined: May 2005
Posts: 222
tek
OP
Member
|
OP
Member
Joined: May 2005
Posts: 222
|
hi every1 I got good news I changed the camera so that it's no longer in Moses behind and I zoomed the camera a little back I also added a new level, Level 2 "Unseen Hope" this is where Moses has to go up the mountain and get to the burning Bush I still havent fixed the problem of when I get near a wall but hopefully I will one day. here are some pics of the camera change and the new level feedback please and heres mount Sinai btw does any1 know where I can find egyptian wav music I want for my pyramid level to play an egyptian song. I am also gonna add a panel in the beginning that you click with the mouse start and then you go to first level or exit and you leave.
Last edited by tek; 07/19/06 21:54.
|
|
|
|