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
2 registered members (AndrewAMD, 7th_zorro), 935 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 1 of 3 1 2 3
simple jump code needs some tweaking... #367244
04/11/11 07:25
04/11/11 07:25
Joined: Jan 2010
Posts: 145
Doc_Savage Offline OP
Member
Doc_Savage  Offline OP
Member

Joined: Jan 2010
Posts: 145
ok ive learned enough to make my own jump code. but it has a bit of a problem. i can hold the button down and you will bounce up and down until you release the button, at which time youl fall very fast to the ground. and if you jump onto say, a box, it will kinda "reset" your height as if you jumped ON the box before falling back to the ground. (i hope that makes sense :p) id love to get help on these problems.

anyways heres the code i made

Code:
if(key_space)
	{
		dist.z = 5;
	wait(-0.66);	
		dist.z = 0;
	}



i know its not much but it kinda does the job tongue

i hope you guys can help smirk

Last edited by Doc_Savage; 04/14/11 04:30.

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] #367378
04/12/11 18:58
04/12/11 18:58
Joined: Jan 2010
Posts: 145
Doc_Savage Offline OP
Member
Doc_Savage  Offline OP
Member

Joined: Jan 2010
Posts: 145
anyone??


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] #367385
04/12/11 20:14
04/12/11 20:14
Joined: Jan 2002
Posts: 4,225
Germany / Essen
Uhrwerk Offline
Expert
Uhrwerk  Offline
Expert

Joined: Jan 2002
Posts: 4,225
Germany / Essen
Seriously, what is this code supposed to do? It just sets an entities z coordinate to 5, waits 2/3 seconds and resets it to 0 if space is pressed. What do you intend it to do? Where ist the rest of the code? Context? Question?


Always learn from history, to be sure you make the same mistakes again...
Re: simple jump code needs some tweaking... [Re: Uhrwerk] #367495
04/14/11 04:22
04/14/11 04:22
Joined: Jan 2010
Posts: 145
Doc_Savage Offline OP
Member
Doc_Savage  Offline OP
Member

Joined: Jan 2010
Posts: 145
did you read the whole post? its a makeshift jump animation, id like to know how to get help on the problems i stated. or possibly make it better altogether. bear in mind this is in the "starting with GameStudio" section. and i am indeed starting.

Last edited by Doc_Savage; 04/14/11 04:29.

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] #367521
04/14/11 11:09
04/14/11 11:09
Joined: Jan 2002
Posts: 4,225
Germany / Essen
Uhrwerk Offline
Expert
Uhrwerk  Offline
Expert

Joined: Jan 2002
Posts: 4,225
Germany / Essen
It's not a problem that you're a beginner. But you need to offer more information on your problem. The code fragment you posted cannot be all of your code. How does the rest work? How do you move in your game? How do you apply gravity. What is the variable dist and where else is it used? What kind of game is it at all that you make.


Always learn from history, to be sure you make the same mistakes again...
Re: simple jump code needs some tweaking... [Re: Uhrwerk] #367589
04/15/11 04:14
04/15/11 04:14
Joined: Jan 2010
Posts: 145
Doc_Savage Offline OP
Member
Doc_Savage  Offline OP
Member

Joined: Jan 2010
Posts: 145
that code fragment is everything that controls jumping aside from this:

Code:
function handle_gravity()
{
	result = c_trace(my.x,vector(my.x,my.y,my.z-1000),IGNORE_PASSABLE|IGNORE_MODELS|USE_BOX);
	if(result > 1)
	{
		dist.z -= 1 * time_step;
	}
	else
	{
		dist.z = 0;
	}
}



its a.. well. lets just call it a first person shooter for now. movement is separate. this and the code fragment above are all that have to do with jumping. perhaps with this, you can help me to solve the problems i have? maybe i need a new code for jumping entireley or somthing. i know its not really jumping. it just pushes the player up a bit. lol

i do appreciate you taking the time to look at this and help me. if you need any more code let me know.

Last edited by Doc_Savage; 04/15/11 04:41.

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] #367624
04/15/11 15:56
04/15/11 15:56
Joined: Jan 2002
Posts: 4,225
Germany / Essen
Uhrwerk Offline
Expert
Uhrwerk  Offline
Expert

Joined: Jan 2002
Posts: 4,225
Germany / Essen
Ok, now we've got a second code snippet that writes values into your distance vector. The most important thing is still missing, namely the part where the actor is moved according to dist.z. It's also important how your first code fragment is called. In order to help you we need a more complete view of the problem.

Imagine you're assembling a clock and you've come to a problem there. Now you're asking in a forum for help and show two photos of two small gears. That is not enough. The other members need to understand how the different gears of your clock come together and interact. ;-)


Always learn from history, to be sure you make the same mistakes again...
Re: simple jump code needs some tweaking... [Re: Uhrwerk] #367636
04/15/11 20:35
04/15/11 20:35
Joined: Jan 2010
Posts: 145
Doc_Savage Offline OP
Member
Doc_Savage  Offline OP
Member

Joined: Jan 2010
Posts: 145
ah i see. ok. so what part do you need exactly? the entire movement code is here:
Code:
function handle_movement()
{
		if(key_shift)
	{
		dist.x = 25 * (key_w - key_s) * time_step;
		dist.y = 25 * (key_a - key_d) * time_step;
	}
	else
	{
		dist.x = 15 * (key_w - key_s) * time_step;
		dist.y = 15 * (key_a - key_d) * time_step;
	}
			if(key_space)
	{
		dist.z = 5;
	wait(-0.66);	
		dist.z = 0;
	}


}




what else? ill get it all together

Last edited by Doc_Savage; 04/15/11 20:41.

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] #367640
04/15/11 21:26
04/15/11 21:26
Joined: Jan 2002
Posts: 4,225
Germany / Essen
Uhrwerk Offline
Expert
Uhrwerk  Offline
Expert

Joined: Jan 2002
Posts: 4,225
Germany / Essen
Ok, I think I'm starting to understand your overall approach. I assume handle_movement() is called every frame? And I assume you have somewhere else in your code a function that moves your player entity by the distance stored in the dist vector?

If that is the case I don't recommend using a wait inside the handle_movement function. If dist.z = 0 takes effect depends on the order of the functions in the internal scheduler.

Could you please try to exactly write down which part of the code's behaviour you want to change?


Always learn from history, to be sure you make the same mistakes again...
Re: simple jump code needs some tweaking... [Re: Uhrwerk] #367646
04/16/11 01:47
04/16/11 01:47
Joined: Jan 2010
Posts: 145
Doc_Savage Offline OP
Member
Doc_Savage  Offline OP
Member

Joined: Jan 2010
Posts: 145
i only put the wait in there after to try and get it to only jump once. i dont know how to get it to jump only once when you hold the key down. ok basically i would love to get a jump code basically. the first segment of code was my weak attempt at a jump code lol. it was the only way i knew how to make one haha


Do not concern yourself with my race, personality or origin. find my record in the pits, and then make your wager.
Page 1 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