InDWrekt's Forum Posts

  • I took a look at your project and yes, there is a much more simple way to do what you are trying. Take a look at this sample project. I added 3 layouts all using the same event sheet with 4 events. It should be relatively self-explanatory. I used a text object for the color name. The only thing you have to do different is, get the animation name instead of the text value of the selected object.

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

  • A level select menu only needs 1 event. Name the level the same as a variable on the item you are clicking to select the level (if it is a dropdown, the dropdown selected text should be the same as the level name). Then use the Go To Layout by Name action passing in the variable from the item.

  • The issue is caused by the size change. A mirror sprite has a negative width. That is how the system handles mirroring. Since you are setting the width to a positive value, you are losing the mirrored appearance. Instead of setting the size, could you set the scale? That might be the easiest fix for you. If not, you will have to check mirrored state and reset it right after changing the size.

  • The idea by AllanR would work just fine but requires conversion back and forth between the object you click and the animation you show. Conversely, creating an object that follows the cursor from the clicked object uses very few events and doesn't require the addition of a cursor sprite object. Take a look at the example project.

    drive.google.com/file/d/1M6zdd0rbgjiJcGq0AkrEiarz6bJGw4-p/view

  • Set the mouse style to None and every tick, set the position of the sprite object to the mouse position.

  • Take a look at the Simple Light example in the beginner examples shipped with Construct.

  • I modified the example project with the changes we discussed on Discord. Hopefully seeing them in action will help you finish your project. Good luck.

  • This looks like it works better:

    Date.ToDateString(Date.parse("11/22/2021"))

    I am available on Discord to chat for a while. discord.gg/48PjzKZW.

    The more I play with it, the more I see things going wrong with the get. Not sure if they are bugs but I can help you work through it if you would like.

  • Except, I was just playing with your code and realized 11 doesn't mean November. It means December. Months are 0 based meaning January is 0 and it goes up 1 from there. That may be the one thing causing you the most grief. In programming, it is most common to start counting with 0, not 1. In cases like month in the date object, it can get confusing if you aren't used to this.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • My answer is very wordy. I think all you need to do is move the last parens before the /24.

  • int(Date.ToTotalHours(abs(Date.Difference(Date.Parse(Date.ToDateString(Date.Now)), Date.Parse(right(BDay.Text, 11))))) / 24)

    Try this again, when I copied over the code and removed my project specific stuff, I must have messed up the parens. Here is the code the way I have it in my project. As you can see, there are more parens before the /24. In yours, you put it after. That means you are dividing my 24 too early and it throws off the result.

    In my example project I am using Date.Parse(right(BDay.Text, 11)) to get the birthday info from a text object. This is no different than using the Date.Get(2021,11,22, 0, 0, 0, 0)) method.

    Here is a link to the example I built to figure out how to solve your problem:

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

  • I think the second example you are looking at is doing WAY more then is necessary. I would suggest you ignore that one. All you need to get the date difference is this:

    int(Date.ToTotalHours(abs(Date.Difference(Date.Parse(Date.ToDateString(Date.Now)), Date.Get(year, month, day, hr, min, sec, mil))) ÷ 24)

    The first date, "Date.Parse(Date.ToDateString(Date.Now))" gets the current date without time. That way the time of day won't mess up the difference function.

    The second date is where you pass in the birthdate. For the year, use the year of their next upcoming birthday. If their birthday this year has passed, use next year. If not, use this year. For everything after day, you can just pass in 0.

    To break it down, the date difference function returns the difference between the 2 dates in milliseconds. Abs so we don't get a negative value. the TotalHours function then gives us the millis in hours so we divide by 24. Finally, we pass it into the int function to just get the integer value representing days.

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