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
1 registered members (AndrewAMD), 1,089 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Resetting jump. #320212
04/20/10 13:55
04/20/10 13:55
Joined: Oct 2009
Posts: 60
T
Tman Offline OP
Junior Member
Tman  Offline OP
Junior Member
T

Joined: Oct 2009
Posts: 60
Hey guys and gals,
I have a jump question, I have a jump when I press the space bar and I thought that I have it set to when it reached a height it would reset the button to the point where I could hold the button and the jump animation would play once and not continue to bounce while holding the button. Any help is appreciated.
Code:
if(key_space == 1 && !reached_height)
   {
   	my.ANIMATION = 0;
		my.STATE = 7;
	   reached_height = 1;
	  
   }
    
   if(my.STATE == 7 && dist_down ==-1)
	{
		 my.ANIMATION = 0;
	    my.STATE = 9;
	    reached_height = 0;	
	}



The states are the jumping states and the landing states and they hold the animations that are associated with it.
Here is the jump code to move the player into the air.
Code:
if(key_space == 1)
	      {
	      	jump_target = jump_height * time_step;
	     
	     	   
	      }


I was helped courtesy of DarkInferno. Got to give credit where credit is due.

Re: Resetting jump. [Re: Tman] #320224
04/20/10 14:37
04/20/10 14:37
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
if(key_space == 1 && key_space_released == 1) {
key_space_released = 0;
jump_target = jump_height * time_step;
}


if(my.ground_distance < xx && key_space == 0) { key_space_released = 1; }


"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: Resetting jump. [Re: Superku] #320230
04/20/10 15:08
04/20/10 15:08
Joined: Oct 2009
Posts: 60
T
Tman Offline OP
Junior Member
Tman  Offline OP
Junior Member
T

Joined: Oct 2009
Posts: 60
I will try that.

Thanks Bro.

Re: Resetting jump. [Re: Tman] #320231
04/20/10 15:28
04/20/10 15:28
Joined: Oct 2009
Posts: 60
T
Tman Offline OP
Junior Member
Tman  Offline OP
Junior Member
T

Joined: Oct 2009
Posts: 60
This is what I did and it still didn't work.
Code:
if(key_space == 1 && key_space == 0)
	      {
	      	key_space = 0;
	      	jump_target = jump_height * time_step;
	     
	     	   
	      }
	      if(dist_down < 0 && key_space == 0)
	      {
	      	key_space = 1;
      	}



I didn't do key_space_released because it couldn't find it so what I did was just say key_space off and on. But what it is doing is just hopping around when I hold the key.

Re: Resetting jump. [Re: Tman] #320236
04/20/10 15:51
04/20/10 15:51
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
You have to define key_space_released yourself:
var key_space_released = 0;

Use my code from above, I'm sorry but your attempt does not make much sense, key_space is a read only flag that equals to "space is pressed" (as you know).


"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: Resetting jump. [Re: Superku] #320269
04/20/10 17:52
04/20/10 17:52
Joined: Oct 2009
Posts: 60
T
Tman Offline OP
Junior Member
Tman  Offline OP
Junior Member
T

Joined: Oct 2009
Posts: 60
Hey thanks for the heads up let me run that again. I will let you know what happens.


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