Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 1,486 guests, and 10 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19055 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
Jump doesn't work (unit falls into the ground after jump) #325455
05/26/10 18:13
05/26/10 18:13
Joined: May 2010
Posts: 23
Germany
h34dl4g Offline OP
Newbie
h34dl4g  Offline OP
Newbie

Joined: May 2010
Posts: 23
Germany
Hi, my problem is, that my unit falls a bit into the ground after he successfully jumps. I raise the jump_percentage with +3*time_step but the unit falls more than it raises. I started the debugger and it shows me that jump_percentage is nearly -0.045, not always the same number, but nearly the same, so it changes after every jump. I though it would be 0 after every jump but it isn't. Is it because *time_step? If so how can i fix it?

Here is my code:

Code:
action guard_with_pointer() // Movementsystem
{
	guard1 = my;
	while (1)
	{	
		ent_animate(my, NULL, 0, 0); // Animation reset
		if (key_space && guard_life > 0) // Player jumps
		{
			jump_percentage = 0;
			while(jump_percentage < 18) // Raise into air
			{
				c_move (my, vector(0, 0, jump_percentage *time_step), nullvector, GLIDE); // Raise for jump_percentage
				ent_animate(my, "jump", jump_percentage, NULL);
				jump_percentage += 3* time_step; // Increase jump_percentage
				wait(1);
			}
			jump_percentage = 18;
			while(jump_percentage > 0) // Fall from the air
			{
				c_move (my, vector(0, 0, -(jump_percentage *time_step)), nullvector, GLIDE); // Fall for jump_percentage
				ent_animate(my, "jump", jump_percentage, NULL); 
				jump_percentage -= 3* time_step; // Degrease jump_percentage
				wait(1);
			}
		}
		wait (1); 
	}
}


Screenshot:




1338, beyond leet.
Re: Jump doesn't work (unit falls into the ground after jump) [Re: h34dl4g] #325564
05/27/10 09:23
05/27/10 09:23
Joined: Aug 2007
Posts: 1,922
Schweiz
Widi Offline
Serious User
Widi  Offline
Serious User

Joined: Aug 2007
Posts: 1,922
Schweiz
wait(1);
c_setminmax(me);

Set this at the beginning of your action.

Re: Jump doesn't work (unit falls into the ground after jump) [Re: Widi] #325595
05/27/10 11:10
05/27/10 11:10
Joined: May 2010
Posts: 23
Germany
h34dl4g Offline OP
Newbie
h34dl4g  Offline OP
Newbie

Joined: May 2010
Posts: 23
Germany
It works better now, but jump_percentage is after the jump still not 0.
And how can I reset the c_setminmax(me)?


1338, beyond leet.
Re: Jump doesn't work (unit falls into the ground after jump) [Re: h34dl4g] #325600
05/27/10 11:33
05/27/10 11:33
Joined: Aug 2007
Posts: 1,922
Schweiz
Widi Offline
Serious User
Widi  Offline
Serious User

Joined: Aug 2007
Posts: 1,922
Schweiz
You dont have to reset c_setminmax. Why do you want to reset it? Read the manual !


Last edited by Widi; 05/27/10 11:33.
Re: Jump doesn't work (unit falls into the ground after jump) [Re: Widi] #325611
05/27/10 12:21
05/27/10 12:21
Joined: Jan 2004
Posts: 3,023
The Netherlands
Helghast Offline
Expert
Helghast  Offline
Expert

Joined: Jan 2004
Posts: 3,023
The Netherlands
EDIT: I just realised that makes no difference...

regards,

Last edited by Helghast; 05/27/10 12:25.

Formerly known as dennis_fantasy
Portfolio - http://www.designorhea.com/
Project - http://randomchance.cherrygames.org/
Re: Jump doesn't work (unit falls into the ground after jump) [Re: Helghast] #325644
05/27/10 14:32
05/27/10 14:32
Joined: May 2010
Posts: 23
Germany
h34dl4g Offline OP
Newbie
h34dl4g  Offline OP
Newbie

Joined: May 2010
Posts: 23
Germany
Ok, with c_setminmax it works good enough, but now I got another problem:

Since I set c_setminmax, there is a invisible wall in front of a enemy. Is that normal? I though the box would be changed to its original size but it doesn't look like it.

Here is a screen shot:




1338, beyond leet.
Re: Jump doesn't work (unit falls into the ground after jump) [Re: h34dl4g] #325647
05/27/10 14:38
05/27/10 14:38
Joined: Sep 2009
Posts: 496
P
Progger Offline
Senior Member
Progger  Offline
Senior Member
P

Joined: Sep 2009
Posts: 496
press F11 and make a screenshot then show it to us because when u press F11 when u included default.c then u see how big the boundingboxes are

Last edited by Progger; 05/27/10 14:38.

asking is the best Way to get help laugh laugh laugh
Re: Jump doesn't work (unit falls into the ground after jump) [Re: Progger] #325657
05/27/10 15:00
05/27/10 15:00
Joined: May 2010
Posts: 23
Germany
h34dl4g Offline OP
Newbie
h34dl4g  Offline OP
Newbie

Joined: May 2010
Posts: 23
Germany
Oh, now its simple to understand why there is a "invisible wall", thanks for the idea. But shouldn't c_setminmax change the box to its original size...that doesn't look like the same size ._.




1338, beyond leet.
Re: Jump doesn't work (unit falls into the ground after jump) [Re: h34dl4g] #325658
05/27/10 15:04
05/27/10 15:04
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
"c_setminmax (ENTITY*)
Sets the collision ellipsiod and bounding box coordinates of the entity to it's real proportions (a bounding box around all it's frames)"

You should try c_updatehull to create a bounding box that surrounds the stand/walk frame.


BTW: You did not understand the while-loop yet, jump_percentage is not supposed to be exactly 0, but lower equal than 0 (so the condition (jump_percentage > 0) is not true). F.i. let time_step be 1 and jump_percentage = 2.3. After the loop

while(jump_percentage > 0)
jump_percentage -= 3* time_step;
wait(1);
}

jump_percentage will be -0.7. The simple solution:

while(jump_percentage > 0)
jump_percentage -= 3* time_step;
wait(1);
}
jump_percentage = 0;

Last edited by Superku; 05/27/10 15:07.

"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: Jump doesn't work (unit falls into the ground after jump) [Re: Superku] #325667
05/27/10 15:24
05/27/10 15:24
Joined: May 2010
Posts: 23
Germany
h34dl4g Offline OP
Newbie
h34dl4g  Offline OP
Newbie

Joined: May 2010
Posts: 23
Germany
Thanks the c_updatehull gave my model the right collision box. I changed the code like Superku showed.

But now I got the problem, that my unit can jump on other units. After the jump, he will gain a new hight which lets him walk in the air.

Can I make him fall after he walks from the top of the other unit?
or
Is it possible to make, that my unit cant jump on top of other units?



Last edited by h34dl4g; 05/27/10 15:39.

1338, beyond leet.
Page 1 of 2 1 2

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