Gamestudio Links
Zorro Links
Newest Posts
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
Trading Journey
by howardR. 04/28/24 09:55
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 972 guests, and 3 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
Page 3 of 3 1 2 3
Re: simple jump code needs some tweaking... [Re: Doc_Savage] #367810
04/18/11 18:19
04/18/11 18:19
Joined: Jun 2004
Posts: 2,234
Wisconsin USA
FoxHound Offline
Expert
FoxHound  Offline
Expert

Joined: Jun 2004
Posts: 2,234
Wisconsin USA
What you need to have is a gravity code in place. Easiet way is to trace from the player to the ground and if there is space between the feet of the player and the ground you move them down using c_MOVE


Now when you press the space bar have it call a function that puts upward force on the player. Each frame have that number dropped down a bit. Use c_move to move the player up.

This should give you tw0 sets of c_move which is not a good thing but it will work and the framerate slow down, if there is any, would be very low to none at all and will work fine until you get further in codding.

Now if gravity is at -5 then the up jump should be 15.


---------------------
There is no signature here.


QUIT LOOKING FOR ONE!
Re: simple jump code needs some tweaking... [Re: FoxHound] #367817
04/18/11 19:01
04/18/11 19:01
Joined: Jan 2010
Posts: 145
Doc_Savage Offline OP
Member
Doc_Savage  Offline OP
Member

Joined: Jan 2010
Posts: 145
ok i have a gravity code in place:
Code:
function handle_gravity()
{
      result = c_trace(my.x,my.y,my.z-1000),IGNORE_PASSABLE|IGNORE_MODELS|USE_BOX);
if (result > 1)
{    dist.z -= 5 * time_step;
}
ELSE
{
    dist.z = 0;
}
}



does this look alright? or should i replace dist.z with c_move?

the only thing the jump function has is:
Code:
dist.z += 5;




i guess ill start there tongue trying to add c_move to one of those.. and, sorry for my last post. it was late night and i was frustrated lol.. i guess it can get like that sometimes tongue

Last edited by Doc_Savage; 04/18/11 19:14.

Do not concern yourself with my race, personality or origin. find my record in the pits, and then make your wager.
Re: simple jump code needs some tweaking... [Re: Doc_Savage] #367838
04/18/11 22:43
04/18/11 22:43
Joined: Jun 2004
Posts: 2,234
Wisconsin USA
FoxHound Offline
Expert
FoxHound  Offline
Expert

Joined: Jun 2004
Posts: 2,234
Wisconsin USA
You're getting there. Main thing is just to try and not ask if it will work. There is info I don't have. Like how far is it from your model's origin to the bottom of the lowest vertex to know how much distance you should move the mesh to get it to the ground.


function blah_name()

{
var blah = 15;
while(blah){
blah -= 1;
//this is moved in the world movement
c_move(me, blah vector(0,0,blah * time_step), blah

wait(1);//this should move the player up. Adjust the 15 and the -1 to see what works best
}



}


---------------------
There is no signature here.


QUIT LOOKING FOR ONE!
Re: simple jump code needs some tweaking... [Re: FoxHound] #367849
04/19/11 03:32
04/19/11 03:32
Joined: Jan 2010
Posts: 145
Doc_Savage Offline OP
Member
Doc_Savage  Offline OP
Member

Joined: Jan 2010
Posts: 145
ok ive fiddled with this template you supplied.

Code:
function jumpyoubastard()
{
var jumpheight = 5;
while(key_space == 1){
//this is moved in the world movement
c_move(my,dist,vector(0,0,jumpheight * time_step), IGNORE_PASSABLE|GLIDE);
wait(1);//this should move the player up. Adjust the 15 and the -1 to see what works best
}



}



i took out the -= 1; because thats already in place in my handle_gravity code.

ive got some movement i just need to figure out why if i hold the jump button down it causesl:
1: me to go to the top and slowly fall down
2: me to move really fast using the movement keys.


Last edited by Doc_Savage; 04/19/11 04:23.

Do not concern yourself with my race, personality or origin. find my record in the pits, and then make your wager.
Page 3 of 3 1 2 3

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