InDWrekt's Recent Forum Activity

  • I think the unfortunate answer here is, you can't using just Construct. Version numbers are the domain of subversioning software. You would need to create a subversion server (or setup a GitHub account), save your project as a folder instead of a single file, then use a subversion program to commit the project. This will create a file in your project that records the current version being worked on. In the game you would then have to reference that file to get and display the version number.

    If that seems like too much work, the easiest thing to do is use a global variable that stores the version and after exporting a version to upload, update the version number. I say AFTER, not BEFORE because I know I am more likely to remember after I export. In which case, I would facepalm, update and re-export. If I export then update, I can immediately update the number so the next export version is ready for the next time.

    On a side note, subversioning is a great idea because it usually gives tons of options for rolling back problems. If you haven't ever looked into it, you should.

  • You can use a tilemap object with the solid behavior to build your levels with. The character will only be able to walk where there is no tile set.

  • That is literally what this is doing but without the problem of the trigger not happening because the player is moving too fast.

    If you only want to trigger on the 50, 100, etc... all you need is:

    distance(Touch.X, Touch.Y, StartX, StartY) % 50 = 0

    However, if the person moves their finger 3 pixels per tick, this is what will happen.

    Touch starts at x =1 y = 1.

    Drag to the right so x increases.

    At tick 18, system registers x = 49.

    At tick 19, system registers x = 52.

    The system never sees the touch x = 50.

    This isn't a hypothetical either. It is guaranteed to happen. And, this is even considering the system is only recording position in integers. Unfortunately, the system doesn't just register position in integers. You could get a value like 50.00000000000001 instead of 50 and it would not trigger your event.

    Take a look at this simple sample.

    drive.google.com/file/d/1ATDZyF5o97m_T86IXhtoVZAH6SOtKyGi/view

    If you click and drag in the green, you will get a particle effect every 50 pixels. It uses the exact equation I gave you in my previous post. If you click and drag in the red, you MAY get a particle effect every 50 pixels if the distance happens to land exactly on a multiple of 50 during a tick. This uses the distance only (but I did change it to just get the integer value to remove the decimal issue).

    Remember, timing and positioning are also heavily dependent on the system. The slower the system, the less precise therefore, more likely to miss detecting a player reaching a single pixel.

  • Got it. Your screenshot looked like you were using a custom progress bar, not the plugin. Sorry.

  • Sprites have a color property. I use it all the time to change the color of the sprite.

    No need to play with the css.

  • If it's triggering that early, you may need to add a check to ensure the distance is > 10. The modulo operator (%) can return 0 if the the number to the left = 0.

    Here's what is going on:

    distance(Touch.X, Touch.Y, StartX, StartY) gives the distance in pixels the touch has traveled.

    int(distance(Touch.X, Touch.Y, StartX, StartY) ÷ 10) next we divide by 10 and get just the integer value. This removes all but the number in the 10s position. IE, if the distance, is 10, 11, 15, etc..., this returns 1.

    int(distance(Touch.X, Touch.Y, StartX, StartY) ÷ 10) × 10 we then multiply by to to get it back to a multiple of 10. Again, we do this so there isn't just a single pixel that will trigger the event.

    (int(distance(Touch.X, Touch.Y, StartX, StartY) ÷ 10) × 10) % 50 = 0 Finally we use the modulo operator. Modulo is a division operator that returns the remainder. IE, 15 / 10 = 1.5 so 15 % 10 = 5. If the modulo returns 0, the original value is a multiple of the divisor. 20 % 10 = 0 because there is no remainder so, 20 is a multiple of 10. In your question, why does it work for 300, 300 is a multiple of 50 so 300 % 50 = 0.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • The picture of your actions doesn't give enough information to help you with this issue. I noticed you posted this same question before and I guess the answers didn't help. If you would like someone to help you here, you will need to post a copy of your project file. Without seeing what is going on, we will be unable to help. This is also the best way in the future to get help with your projects.

  • | Global number StartY‎ = 0

    | Global number StartX‎ = 0

    + Touch: On any touch start

    -> System: Set StartX to Touch.X

    -> System: Set StartY to Touch.Y

    -> Text: Set text to "Touch Started"

    + Touch: Is in touch

    + System: (int(distance(Touch.X, Touch.Y, StartX, StartY) ÷ 10) × 10) % 50 = 0

    + System: Trigger once

    -> Text: Set text to int(distance(Touch.X, Touch.Y, StartX, StartY) ÷ 10) × 10

    Try something like this. Compare the distance using the current touch values and the original touch values using the following equation. This will return true if the distance rounded to the nearest 10 is a multiple of 50.

    (int(distance(Touch.X, Touch.Y, StartX, StartY) ÷ 10) × 10) % 50 = 0

    I do it this way because if you just check to see if the distance is a multiple of 50 and the touch moves fast enough, it will miss the 1 pixel where it will be true. Doing this gives a 10 pixel area that will register as true instead of just 1.

  • Sorry. I miss typed. The action is "Set Double Jump Allowed."

  • The Double-jump behavior has an action called "Set Double Jump Allowed." I show it in the example I gave you. I tells the system to allow the player to jump again. It can be used to jump another time after a double jump has happened but before the player lands on the ground.

  • Then you probably don't need the actions that enable and disable the double jump. Play with the example and see if you can get it to work with double jump already enabled.

    Again, this is a solution I found to solve the problem using the tools at hand. There are probably many ways to do it with no right answer. Just viable solutions. If this example doesn't work for you, I'm sorry.

    Good luck with your project.

  • Glad to help and good luck with your project.

InDWrekt's avatar

InDWrekt

Member since 19 Sep, 2011

Twitter
InDWrekt has 7 followers

Trophy Case

  • 13-Year Club
  • Forum Contributor Made 100 posts in the forums
  • Forum Patron Made 500 posts in the forums
  • Regular Visitor Visited Construct.net 7 days in a row
  • RTFM Read the fabulous manual
  • Email Verified

Progress

18/44
How to earn trophies