Maako's Recent Forum Activity

  • Ok so I wanted to make a "Pre-Jump" mechanic, where if you press jump slightly before you hit the ground, you will jump as soon as you land.

    Code is very simple:

    If you press jump button while platform is not on ground - set "PreJump" value to 30

    If PreJump is greater than 0 - Subtract 1 from PreJump

    If Player is on ground and PreJump is greater than 0 - Jump

    This almost always works no problem. Sometimes though, if I press Jump while in the air, not only will the object not jump on landing, but will then not be able to jump at all until the "PreJump" value reaches 0. (Tested in debug mode)

    I recreated this in a blank project with just a Player object and ground and it still happens.

    I can't seem to force it to happen, and usually have to just spam jump to get it to trigger. Sometimes it feels like holding jump right before landing effects it, but it's hard to tell.

    Screencap of code: imgur.com/cNAWFdn

    Anybody know what might be happening?

    Tagged:

  • Nevermind I found a solution from a post I made years ago and forgot about.

    In case someone else stumbles on this and wants to know here's the solution:

    Give Object_1 the Sine behavior.

    When you create the Object_2, set the coordinates to:

    X: Object_1.X+cos(Object_1.Angle)*(Object_1.Sine.Value+50)

    Y: Object_1.Y+sin(Object_1.Angle)*(Object_1.Sine.Value+50)

    That's it. If you want to change the distance just change the number after Sine.Value

    Hope this helps someone!

  • So if Object_1 is at a 90 degree angle, I want to create Object_2 50 pixels away in the direction that Object_1 is facing.

    Sorry if there's a simple answer but math and angles aren't something I know a lot about.

    Thanks for any help

    Tagged:

  • Hey thanks for the reply, I will definitely look through these.

    The throwing part wasn't too difficult to find, it was just the trajectory path I was having difficulty with. The "trajectory" keyword definitely helps, thanks for that!

  • Sorry for confusing title, but I'm having difficulty putting this into words, so also had trouble googling solution.

    I want to be able to throw an object in an arc and at different strengths. However, I want to show a curving line that will indicate the exact path the object will take.

    Also, if possible, I would like the line to stop when it collides with a solid, but this is not 100% needed.

    I was hoping there is a plugin or tutorial somewhere where someone has already done this, but I could not find it, and math was never my strong suite, so making curves with math and stuff is a little beyond me.

    Thanks for any help!

    I'm still using Construct 2 if that matters at all.

    Tagged:

  • Wow interesting.

    I think that explains my confusion. Definitely feels good to know this now.

    Thanks again for all your help

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Ok I think I realized why I was confused.

    If you make the code:

    If Green has LOS to Red - set value to 1

    (Invert) If Green has LOS to Red - set value to 0

    This will not work if one Green has LOS to Red while a Green copy does not (at least not in my test)

    However, if you just reverse the order so it's:

    (Invert) If Green has LOS to Red - set value to 0

    If Green has LOS to Red - set value to 1

    It works correctly with all copies.

    Again I might be missing something because I'm tired but I keep running into walls with this and Ive been trying to get it figured out for days now.

    I'm going to sleep soon so sorry in advance if I don't get to respond to anyone who might help but I will check tomorrow

    thanks again

  • Ok thanks for all the help.

    I think I was misunderstanding what I was looking at in my code, and am currently too tired/brainfried to sort it all out.

    I'll look at it again later and try to figure things out

    thanks again for all the help its greatly appreciated

  • Hey thanks for the help. This works great.

    I'm a little confused though.

    Why does the code, "If green has LOS to object - set value to 1" work for multiple copies, but won't work if you invert it?

    I've been so frustrated for the past few days wrestling with this function XD It would be nice to know for the future

    thanks again

  • I'm using the following code

    If object "Green" has LineofSight to object "Red" - Set Value to 1

    Else - Set value to 0

    This works fine until I make copies of Object"Green". If one of the green objects loses LOS to all red objects, the value still won't change if a different copy of "green" still has LOS to a red object.

    I'm pretty sure I know why this happens but I can't figure out how to get around it.

    I can't just say "If Green does not have LOS to Red, set value to 0" because it has the same problem, if a copy still has LOS, it wont change.

    I've tried using For Each but that didn't work either.

    Am I missing something?

    Thanks for any help

  • Hey thanks so much again for the help.

    I didn't know that could be done, I've never used the else function before, but it works perfectly.

    I totally forgot about the manual and if I run into any more issues I'll read that before asking here.

    You've been a great help thanks again for the patience and assistence

  • Try this:

    If player has LoS to Enemies -> (no actions here)

    Else -> Do something here

    This event may look like the same as "Player NOT had LoS" condition, but in fact it works differently.

    Sorry I just realized an issue.

    What if I need to add other conditions? Such as multiple values being certain numbers?

    Again I could just do:

    If player has LoS to Enemies -> (no actions here)

    Else -> Set value "NoLOS" to 1

    And then just use the "NoLOS" value instead of the LoS function

    But this would again mean having to add multiple values for different objects/scenarios. Which isn't the end of the world at all but I was just hoping there would be a more simple solution.

Maako's avatar

Maako

Member since 14 Feb, 2015

None one is following Maako yet!

Trophy Case

  • 9-Year Club
  • RTFM Read the fabulous manual
  • Email Verified

Progress

11/44
How to earn trophies