InDWrekt's Recent Forum Activity

  • It looks like the distance between the bottom of the collision box and the characters origin are different in the 2 animations. What is happening is, when the character lands on the ground, the bounding box changes with the animation which can cause it to overlap the ground. This pushes the character up a couple pixels which causes them to be in the air again and falling. Make sure the bounding box of your animations is se up correctly. I would also suggest that you place the origin of the character at the bottom of the image.

  • One thing to remember is, a global layer is not the same thing as a global variable or object.

    Global layers are used to override layers on many layouts so you don't have to recreate something like a HUD on every single layout it is needed. This usage of global doesn't have anything to do with persisting throughout the game. Items in a global layout will be re-instantiated on start of layout.

    Global variables/objects are used to give access to the same variable/object throughout the game runtime. These objects exist in all layouts as a single object so any change made to them is persisted when changing layouts. They are instantiated when the game is run and are not removed until the game ends. A non-global variable/object on the other hand is re-instantiated on start of layout for every layout they are place on and removed from memory (causing them to cease to exist) when the layout ends. If they still exist when the layout ends that is. According to the game engine, these are separate objects.

  • No, it won't reduce ram usage. The system still needs to load the object into memory and it takes the same amount of space whether you can see it or not. You may see a small drop in GPU usage depending on what the object is doing but it will be minimal.

  • 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.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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.

  • 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."

InDWrekt's avatar

InDWrekt

Member since 19 Sep, 2011

Twitter
InDWrekt has 7 followers

Trophy Case

  • 14-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

19/44
How to earn trophies