3 registered members (AndrewAMD, Quad, 1 invisible),
721
guests, and 7
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: Slightly improved Zelda code
[Re: gamespider]
#38107
04/27/06 07:16
04/27/06 07:16
|
Joined: Apr 2006
Posts: 36 India
gamespider
Newbie
|
Newbie
Joined: Apr 2006
Posts: 36
India
|
sorry for double posting..... just remembered...
The following code in the first if(movement_mode==0) branch:
IF (z_force < -2) { //are we falling?
vec_set(temp,my.x); //scan in front of player to see if he has hit a wall temp.x += 30 * cos(my.pan); temp.y += 30 * sin(my.pan); temp.z = my.z + player_head_height; //scan at head height trace_mode = ignore_me+ignore_sprites+ignore_models; result = trace(my.x,temp); IF(result == 0) { ledge_grab_test = 0; } ELSE { IF (result > 0) && (ledge_grab_test == 0) { vec_to_angle(temp,normal.x); IF (abs(ang(my.pan - (temp.pan - 180))) < 30) { temp2.pan = (temp.pan - 180); //make player face towards ladder vec_set(temp,target.x); //scan to see if there is space up above player for it to grab onto ledge temp.x += 10 * cos(temp2.pan); temp.y += 10 * sin(temp2.pan); temp.z += player_head_height - 2; //scan at head height target.z += 10; trace_mode = ignore_me+ignore_sprites+ignore_models; result = trace(temp.x,target.x); // vec_to_angle(temp,target.x); IF (result > 0) { //if we have a wall in the way, and the surface above is less than a 10 degree slant vec_set(temp,my.x); //scan to see if there is space up above player for it to grab onto ledge temp.z += player_head_height - 2; //scan at head height trace_mode = ignore_me+ignore_sprites+ignore_models; result = trace(temp.x,target.x); IF (result == 0) { //scan above head to make sure we didn't hit a roof ledge_grab_test = 1; movement_mode = 10; my.pan = temp2.pan; //make player face towards ladder } } } } }
can be safely replaced by the following with NO problems at all. tested it out myself.... Asu can see, the code is much shorter and easier to execute...
IF (z_force < -2) { //are we falling?
vec_set(temp, my.x);//trace straight from belly temp.x += 30 * cos(my.pan); temp.y += 30 * sin(my.pan); temp.z += 30; vec_set(temp3, my.x); temp3.z += 30; trace_mode = ignore_me+ignore_sprites+ignore_models; result = trace(temp3, temp); if(result> 0 && ledge_grab_test == 0) { //IF (abs(ang(my.pan - (temp.pan - 180))) < 30) //{ vec_to_angle(temp,normal.x); temp2.pan = (temp.pan - 180); vec_set(temp, my.x); temp.z += 42; vec_set(temp3.x, my.x); temp3.z += 42; temp3.x += 30 * cos(my.pan); temp3.y += 30 * sin(my.pan); trace_mode = ignore_me+ignore_sprites+ignore_models; result = trace(temp, temp3); if(result ==0) { vec_set(temp,my.x); //scan to see if there is space up above player for it to grab onto ledge temp.z += 50; //scan at head height trace_mode = ignore_me+ignore_sprites+ignore_models; result = trace(temp.x,target.x); if(result == 0) { ledge_grab_test = 1; movement_mode = 10; //move_vec.z =0; my.pan = temp2.pan; //make player face towards ladder }
} } //IF (abs(ang(my.pan - (temp.pan - 180))) < 30) //} else { ledge_grab_test = 0; }
} else { ledge_grab_test = 0; }
|
|
|
Re: Slightly improved Zelda code
[Re: Serlink]
#38110
04/28/06 03:29
04/28/06 03:29
|
Joined: Nov 2004
Posts: 862 Australia
DavidLancaster
OP
User
|
OP
User
Joined: Nov 2004
Posts: 862
Australia
|
It's here: Zelda Code Implemented But I'm not planning on renewing my subscription to that URL when the time comes next month, so that link wont be active for long, if it's still in demand afterwards perhaps I'll upload it elsewhere.
|
|
|
Re: Slightly improved Zelda code
[Re: DavidLancaster]
#38111
04/28/06 05:54
04/28/06 05:54
|
Joined: Aug 2000
Posts: 7,490
Orange Brat
Senior Expert
|
Senior Expert
Joined: Aug 2000
Posts: 7,490
|
Just to eliminate the pending wave of confusion: http://www.accessphenomenon.com/zelda.zipI'll see about re-uploading my original test zip once I sort some stuff out. I don't know why I deleted it...all of the other various tester levels seem to still be there.
My User Contributions master list - my initial post links are down but scroll down page to find list to active links
|
|
|
Re: Slightly improved Zelda code
[Re: gamespider]
#38113
04/28/06 06:32
04/28/06 06:32
|
Joined: Dec 2003
Posts: 1,220 Just down the road from Raven
BlueBeast
Serious User
|
Serious User
Joined: Dec 2003
Posts: 1,220
Just down the road from Raven
|
I'd like to jump in too... it was only mentioned briefly, but what about jumping? Is the jumping pretty good?
My jump will land me on the next block above me if there is one... technically, I could ascend a 10 story bulding from the inside, 1 floor at a time, just by jumping... but then, this was a simple 'lets see what it does' code.. so how is the jumping in the Zelda code?
Gamestudio Pro 6.4 Pentium 4 3.0 GHz 800MHz BUS AtiRadeon 9800 pro 256Mb 21" Monitor 1 Gig DDR RAM 36 Gig RAPTOR SATA+ 120 Gig SATA SB Audigy 2 w/ 450 watt Logitech Z680 5.1 www.nordicepitaph.com
|
|
|
Re: Slightly improved Zelda code
[Re: gamespider]
#38114
04/28/06 06:48
04/28/06 06:48
|
Joined: Nov 2004
Posts: 862 Australia
DavidLancaster
OP
User
|
OP
User
Joined: Nov 2004
Posts: 862
Australia
|
I'm not too sure about grabbing a ledge from the top, can you walk backwards off a ladder's top and grab it as you fall? Can you jump up to a ladder and grab onto it mid air? I can't remember if I set it up so that you can only use a ladder if you are on the ground or not. As to how you'd get that to work, allow the player to grab onto the ladder even if he is airborne, that might work. I think that the ultimate way to get ladders working the best, is to have trigger areas where if the player enters it, ie walks to the top of a ladder, he automatically climbs onto it, it may be tricky to program.
@BlueBeast I'd say the jumping is average, not the best, the jumping height changes slightly when the frame rate is low, which is a bit annoying, and you can bob in the ground and stuff when you land, otherwise it works pretty cool, the animations with the jumping are good.
|
|
|
|