Jump to content

Recommended Posts

Posted

Hello, I'm attempting to learn lua script and have been battling what I'm sure is a simple issue. I have my cube"Player" that I have made to be able to jump via key press. With the current logic, I can continue to press the key and the player will never hit the ground. I would like to be able to double jump and then wait for x amount of seconds before doing it again. I was looking into "Wait" but I'm not having luck with it either. 

Posted

Although I am on my phone and cannot provide any code snippets, I would recommend making a Boolean that is set to false when the player is touching the ground and true when the player jumps. Two of those booleans would allow a double jump (if one is set to true only when the other is true).

i now hate love C++

Beeeeeeeeeeeeeep~~This is a test of the emergency signature system~~Beeeeeeeeeeeeeep

RX 6800XT | i5-13600KF | 32GB DDR5 | 1440p is perfect

Posted
Just now, Sweetgebus said:

is this specific to ultraengine? or is the same for leadwerks 4.6?

 

function Script:UpdatePhysics()

    self.entity:AddForce(0,0,-.5)

    if window:KeyHit(Key.Space) then
        self.entity:AddForce(0,10,0,true)
    end
end 
 

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...