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
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
0 registered members (), 1,094 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Double jump #260622
04/12/09 15:38
04/12/09 15:38
Joined: Apr 2008
Posts: 245
GameScore Offline OP
Member
GameScore  Offline OP
Member

Joined: Apr 2008
Posts: 245
did someone know how can i realize a double jump with this code?

Code:
	if (key_space)
{
if (distance_to_ground < 2)
{
distance_to_ground = 1;
player_dist.z = 5;
}
}

if (distance_to_ground > 0)
{
			
if (player_dist.z < (distance_to_ground * -1))
{
player_dist.z = distance_to_ground * -1;
				
}
}
else
{			
player_dist.z = -1 * distance_to_ground;
}


Re: Double jump [Re: GameScore] #260671
04/12/09 22:13
04/12/09 22:13
Joined: Jan 2009
Posts: 86
Brasil - RS
D
DiegoFloor Offline
Junior Member
DiegoFloor  Offline
Junior Member
D

Joined: Jan 2009
Posts: 86
Brasil - RS
I don't understand what your code does. What is the role of this player_dist vector?

Re: Double jump [Re: DiegoFloor] #260711
04/13/09 06:44
04/13/09 06:44
Joined: Apr 2008
Posts: 245
GameScore Offline OP
Member
GameScore  Offline OP
Member

Joined: Apr 2008
Posts: 245
VECTOR player_dist is for move the player along the x,y and z axis
and distance to the ground is
c_trace(vec1_from, vec1_to, IGNORE_ME|IGNORE_PASSENTS|IGNORE_PASSABLE|IGNORE_SPRITES|USE_BOX);

vec1 means
vec_set(vec1_from,my.x);
vec_set(vec1_to,my.x);
vec1_to.z -= 500;

Re: Double jump [Re: GameScore] #260771
04/13/09 14:43
04/13/09 14:43
Joined: Jan 2009
Posts: 86
Brasil - RS
D
DiegoFloor Offline
Junior Member
DiegoFloor  Offline
Junior Member
D

Joined: Jan 2009
Posts: 86
Brasil - RS
Ok. Are you executing a function with this vec_dist that displaces the character in z? Or are you using it directly, like: my.z = vec_dist.z; ? The later isn't a good solution, because when hitting space the player will automatically be at 5 quants above.

The reason I'm asking is that, to do the double jump, the code got to ask in what point of the jump the player is. If it's in the top of the jump AND pressing space_key then increase z speed. Something like that..

I still don't understand what you're doing.

Re: Double jump [Re: DiegoFloor] #260789
04/13/09 16:06
04/13/09 16:06
Joined: Apr 2008
Posts: 245
GameScore Offline OP
Member
GameScore  Offline OP
Member

Joined: Apr 2008
Posts: 245
this code i have from the lite-c kingdom heart movement code
works very well
you can find it here

http://www.coniserver.net/wiki/index.php/Modified_Kingdom_Hearts_Movement

Re: Double jump [Re: GameScore] #260833
04/14/09 01:07
04/14/09 01:07
Joined: Jan 2009
Posts: 86
Brasil - RS
D
DiegoFloor Offline
Junior Member
DiegoFloor  Offline
Junior Member
D

Joined: Jan 2009
Posts: 86
Brasil - RS
Right! I get it now :]

There are probably several ways to do this, but I can't think of any great solution. You could do something like this:
when jumping keep checking move_to_vector.z (this is the speed in z and is constantly being decreased during the jump), when is arond 0 (move_to_vector.z<0.5 && move_to_vector.z>-0.5 , for example) it means it's close to the highest point, then check for key_space again. If space is pressed then move_to_vector = 5 (or something)

The code should look something like this:
if(move_to_vector.z<0.5 && move_to_vector.z>-0.5)
{
if(key_space) move_to_vector.z = 5;
//this is sloppy. Try to come up with a way to know if the player just hit
//space. Or else he could just keep pressing space from the beginning of the
//jump and still be able to double jump.
}

Re: Double jump [Re: DiegoFloor] #261113
04/15/09 21:40
04/15/09 21:40
Joined: Apr 2008
Posts: 245
GameScore Offline OP
Member
GameScore  Offline OP
Member

Joined: Apr 2008
Posts: 245
ok, i will try to find a way like your idea


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

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