0 Favourites

Custom Platform Style Movement

This forum is currently in read-only mode.
  • Hello all, I'm relatively new to Construct but used to use TGF2 extensively.

    So far I'm loving Construct and finding it to be a brilliant tool for prototyping some of the ideas I'm working on.

    Anyway, I've looked for help and experimented a fair bit but I can't seem to work out the most effective means of doing what I want.

    I have a platform style game where the main character can walk, run and jump. However, I want the character to jump a specific distance while moving and do not want it to be affected by the speed of the movement. When the player is not moving and presses jump I want the character to jump a fixed distance straight upward. I'm intending on using a variable to specify the 'state' of the character for controlling which action will be carried out when the player presses the jump button.

    My question is, what is the best way to handle the jumping? Is there a behaviour type that I can switch to upon pressing the jump button that will do what I want? It's very important that the jump distance remains a fixed distance in pixels so that levels can be built around it.

    Thanks!

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • no need for a special behavior

    http://dl.dropbox.com/u/1013446/constantjump.cap

    cap is fairly straightforward

    if the character is on the ground

    set a pv "jumping" to 0

    if the character is jumping set it to 1

    if that pv==1 then move the character at a constant speed * the direction it was moving in

    the only reason you can't do it one event, like this:

    character is jumping
    or 
    character is falling[/code:36adq4t7]
    is because then falling off the edge would cause the character to move at that same constant speed if you just fell off a platform
    
    if you want to make it so the character always falls straight down if you don't jump, then do
    [code:36adq4t7]--character is falling
    --"jumping" is equal to 0
    ---------set platform x velocity component to 0[/code:36adq4t7]
    let me know if you have any additional questions
    this cap will require one of the latest unstable versions to run:
    [url]http://www.scirra.com/forum/viewtopic.php?f=2&t=7183&start=0[/url]
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)