Custom controls(see example)

0 favourites
  • 11 posts
From the Asset Store
Unlock platyers earning coins, and save it with Localstorage
  • Hi, Im relatively new to construct and im trying to make a physics based game, But I want to replicate the controlls of this game -

    Subscribe to Construct videos now

    What i have so far is,

    On mouse down object.apply force (y = -15)

    But in this game, If the mouse is down the character tilts upwards and then go's towards that direction, however you cannot completely go up in the air, gravity catches up with you..

    Can someone help?

    Thanks.

  • Im not sure if that game in the link uses physics, doesnt look like it to me. But if you do wanna use physics, I would look at the "Apply force towards position" function instead, and use the Mouse.X and Mouse.Y as parameters.

    I made this very simple example, where I dont use physics, but with the same thought as with the physics version. This version just rotate the object by the mouse position and move it forward, and it moves up and down depending on the forward vector.

    I think with some tweeking it should work just as the youtube example you linked to.

    http://dl.dropbox.com/u/52716812/MoveWithAngle.capx

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hmm Yeah it uses physics, And i cannot figure out how to replicate it using the physics object :(

  • Basically when you touch the screen the whale tilt up and goes higher, when you don't touch the screen he tilts and goes down.

    Other than that an autoscroll based on horizontal speed of the whale.

    There's nothing about friction, damping, you don't have environmental elements that influence the whale's movement (Except for the speed burst but it's just speed...) it's just all about simple orientation of speed vector. Maybe some secondary element does use physics, but the whale is definitely not physics driven.

    You can emulate the same kind of movement with a simple bullet behavior.

  • Yann

    So something like:

    On mouse down, player.rotate clockwise - 10 <--(How do you constantly rotate?)

    on mouse released, Player... ?

  • like that whaleRip.capx

  • Legend!!! One more thing..

    You see how if the players rotation is greater than 180 then when the mouse is released it carrys on following that angle,

    I tried to implement this my self with:

    Mouse: Left button is down(invert)

         System: compare 2 values(Player.angle - >= 180)

    • -----> ???
  • you want to do the looping thing?

    I think it might be either an animation on the sprite itself, or an automatic rotation (once launched it will play until a certain angle)

    For the first option it's juste sprite animation so let's go to the second one

    Make an instance variable for the player object called "looping" with default false

    and for events :

    System: a < -80
    Mouse: [invert] Left button is down
        -> Player: set looping to true
    Player: is looping
        -> System: substract 80*dt from a
    System: a < -275
        -> System: set a to 85
        -> Player: set looping to false

    It's all based on the capx I provided.

    However you have to change something to shutdown the classic angle calculation ([invert] mouse down -> add rotationSpeed*dt)

    Basically it would look like :

    Player: [invert] is looping
        Mouse: [invert] Left button is down
            -> set a to max(a-rotationSpeed*dt,-aMax)
        Mouse: Left button is down
            -> set a to min(a+rotationSpeed*dt,aMax)

    I won't insure you that it will work 'cause I didn't test and I wrote all that from memory.

    Well redownload the capx I updated it with all this sh*t, 'cause the values weren't right (rotation too slow, angle limit too high etc)

  • Yann i think i done something wrong,

    Take a look Game

    Thanks

  • redownload my capx above and compare the differencies, you should see, it's obvious.

    (clue : in my explanation I did say "change something" not "add something")

  • THANKSTHANKSTHANKSTHANKSTHANKSTHANKSTHANKSTHANKSTHANKSTHANKSTHANKS!!!!!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)