How do I jump player towards mouse position on left click?

0 favourites
  • 9 posts
From the Asset Store
Basic Rounded Vector Geometry Player Design with Glow for 3 player games
  • Hey guys, so as the title suggests I hope someone can give me a hint as to the best way to go about this.

    I basically just want the player sprite to jump and move in the direction of position Mouse.X and Mouse.Y (if that is the best way of course?) I am using Platform (preferably would like to keep that behaviour) and currently have it set to when 'left mouse released > simulate platform pressing jump'. Of course the next step is the angle and direction.

    Some help is kindly appreciated.

    Thanks!

  • It may have some issues depending upon exactly what you looking for, but maybe this will get you started. I used Touch instead of Mouse.

  • Hey thanks for that! Definitely serves it's purpose, and actually I do need it for both touch and mouse so it's good.

    Now I need to play around with this because actually I need the jump to perform in a more specific way. First thing I noticed now is the touch has to be held down for the jump to complete in either direction. Actually, finally my end goal is to have a mechanic whereby when the player touches in the direction they want to jump, it powers the jump depending on how long they press. A little directional arrow appears when in touch before they jump (this I have already setup). And then of course when they release touch the player fires in the direction they had the arrow and at the power they specified when in touch.

    Is this a complicated mechanic to setup? I don't expect anyone to make this for me of course. But again, if you could point me in the right direction of events/actions needed it would be appreciated.

    Thanks!

  • A little bump.

    For my question above. How would this be best achieved actually? With behaviour Platform or Custom Movement? I've been playing around with the custom movement but not really achieved what I'm looking for. Platform behaviour is easier to work with but again not achieving what I need for my move mechanic.

    Thanks again!

  • Well, here is a start. It still needs work, but I'd need to study some on vector mathematics before I could go farther.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I made this for a guy with the same question yesterday

  • Wow that's awesome guys thanks so much. I've just opened both and am starting to understand and tinker with them.

    Shirokuma you definitely went above and beyond, much appreciated. I've just started tinkering as I said but just one question. I notice with Platform behaviour it seems it is not possible to jump direction down on the Y axis when aiming the direction to the floor for example. Is this actually possible?

    Anyway, was just my first quick observation as I said I'm going to play around with this.

    Thanks again!

  • rheece

    I was just discussing vectors with a coworker (an actual programmer instead of a hack like me), and I can say it is possible to calculate a vector in the negative Y direction. In my example I intentionally avoided them thinking that you wouldn't need a negative Y vector because you are standing on a platform, so you can't go that direction. But I guess if you want to do something like that you could add some code that turns off the solidity of the platform you are standing on when you get a negative Y vector.

    I should warn you that my vector code isn't correct, so use at your own risk.

  • Haha, ok no worries Shirokuma. Your help was great thanks for taking the time.

    I was actually just about to reply again mentioning after more playing around with 7Souls example I notice I can indeed jump the player in any desired direction it seems.

    So, now I have enough help from you both to get me to the next stage in my game mechanics. Great stuff!

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