Make my character jum


#1

Hello,

I’m trying to create a game in Vulkan and I want to make my character jump.

I have wrote the code for juming but when I run the application and press the space key the character doen’t move.

Does GLFW allow to perform jumping?

Thank you in advance


#2

I’m presuming your first language isn’t English as this question is a bit odd since GLFW provides a simple API for creating windows, contexts and surfaces, receiving input and events.

So it has nothing to do with game code like jumping.

If you are asking about inputs such as the space bar please see the GLFW input documentation.


#3

Hello,

thank your reply. No my first language isn’t English.

Thank you for the link.

What I want to say is that I want to create an key boardkey to creare an event and the carracter to move. I don;t get any errors when I relese my project however there is no movement.

bool onKeyboard(veEvent event) {

		 
		if (event.idata3 == GLFW_RELEASE) {
			VEEntity*e3 = getSceneManagerPointer()->getEntity("The Cube3");

			time += event.dt;

			if (CharacterMotionListerner::GroundCollition) {

				CharacterVelosity = -CharacterGravity * event.dt;
				if ( GLFW_RELEASE)
				{
					CharacterVelosity = CharacterJump;
					return true;
				}

			}

		}

#4

I can’t tell from your code extract what you’re doing, but I suggest debugging your app or adding printf/cout output to tell what happens when onKeyboard is called.

I do spot that you have if( GLFW_RELEASE ) which will always be true since this doesn’t test any of your variables against GLFW_RELEASE.