@Harres I noticed that the ChangeAnimation actions in the collision with top side of ground event has a FORWARD animation as apposed to the norm of NO_CHANGE,
Why is that exact?
Turon wrote:So the player returns to a standing position upon collision with ground, however if I were to hold down the jump button the player will jump over and over again and also without reverting to a standing position in between, I only wish for the player to jump once with one press of the button and holding it down to make no difference,
will that also require some toying with animidex?
lcl wrote:Is the collision event that sets the jump variable back to 1 set to repeat?
lcl wrote:For checking if a certain key is pressed or not, check the GE documentation's Script Reference part and search for GetKeyState.
Hares wrote:lcl wrote:Is the collision event that sets the jump variable back to 1 set to repeat?
@Turon:
For now it is not set to repeat. But I don't see any reason why it could not be set to repeat.
So go ahead and set it to repeat.
Turon wrote:If you mean I must set the Collision on Top side of the ground the repeat yes I've tried that and there is no visible difference as of yet.
char *key = GetKeyState(); //Get entire keyboard state
if(key[KEY_RIGHT] == 1) && (key[KEY_LEFT == 1)//Test if left or right key is pressed
{
jump=1;
}
if (animindex==5)
//PlayJumpLeft is animindex 5
{
ChangeAnimation("Event Actor", "PlayerStillLeft", FORWARD);
}
if (animindex==6)
//PlayerJump is animindex 6
{
ChangeAnimation("Event Actor", "PlayerStillRight", FORWARD);
}
if(key[KEY_RIGHT] == 1) && (key[KEY_LEFT == 1)
if((key[KEY_RIGHT] == 1) && (key[KEY_LEFT == 1))
if(key[KEY_RIGHT] == 1 && key[KEY_LEFT == 1)
lcl wrote:In the right direction, yes.
But two things.
First, you can't have if statements like that:
- Code: Select all
if(key[KEY_RIGHT] == 1) && (key[KEY_LEFT == 1)
All the conditions must be within the same parenthesis, so that code would have to be:
- Code: Select all
if((key[KEY_RIGHT] == 1) && (key[KEY_LEFT == 1))
Or you could also write it with only single big parenthesis, and I'd recommend that since it's much clearer:
- Code: Select all
if(key[KEY_RIGHT] == 1 && key[KEY_LEFT == 1)
lcl wrote:But, the actual problem with your code is that you didn't quite follow my instructions. I told you to check whether the jump key is not pressed.
Instead of doing that you checked if both the walking buttons are pressed.
Turon wrote:I'd think that setting the ones to zeros would be checking that keys are not being pressed.
Users browsing this forum: No registered users and 1 guest