Kazan's Forum Posts

  • So this works very well but I've come across an issue with it while testing.

    When I go to add a number to the variable, 0.2 for example Construct will occasionally add a whole mess of numbers after it. So instead of adding 0.2 it will add 0.29999999999999999999 or something like that.

    This screws everything up as I'm relying on these values to be perfectly precise as other functions in the project depend on it to be that way.

    It doesn't happen every time, but it happens enough that it's a problem.

    Any 'hopefully' simple fix for this?

  • That was ridiculously helpful! Thanks so much, works like a charm.

  • Hi all, hopefully you can help me with this.

    I have a sprite (A) that I want to move between two X positions on the layout (B, the starting point and C, the ending point).

    That's easy enough to do with lerp, however, I have a global variable that I want to tie into these two positions.

    When I press a key I want to add a number to that global variable, say 20 for example and have the sprite, A, move SMOOTHLY 20% of the way between points B and C.

    Basically I want B to be 0% and C to be 100% but I'm not sure how to write that expression wise.

    Any thoughts?

    Thanks for any help :)

  • Thank you sooo much!

  • Hi. I swear I've gotten something like this to work in the past but I have no idea how I did it. I might not even be remembering correctly, no clue.

    Anyway, I have a simple sprite with an instance variable on it called index, it set to 0 by default. All I want to do is create say, 3 instances of that object in-game but with the index variable for each of them to sequentially increase by 1.

    So the first instance it's index would be 1

    The second instance it's index would be 2

    The third instance it's index would be 3 and so on and so on.

    I feel like this should be very simple to do but I'm not quite sure how to make it happen.

    Can anyone offer any insight on it?

    Thanks

  • blackhornet

    Brilliant! Works great.

    Thanks a lot for taking the time

  • Hi.

    I have multiple instances of a sprite, one with a variable number set to 1 while the others are set to 0. I'm trying to pick the instance of the sprite that is closest to the sprite with it's variable set to 1. I tried a few things I saw on other forum posts but none seem to be working.

    Basically, this is what I've been trying:

    Pick all (sprite)

    -Pick (sprite) where variable = 1

    --Pick (sprite) nearest to (sprite) --- Destroy

    That just destroys the sprite that has a 1 for the value.

    Not sure what I'm doing wrong. I guess essentially I want to pick the second nearest sprite.

    Any ideas?

    Thanks!

  • Well this is odd for sure. I'm not sure how I'm getting a different result when most of you are getting the same color. AllanR got a different result as well though.

    AllanR Thanks for the explanation, that clears it up a bit actually. Maybe I'll just roll with replace color for now using your suggested adjustments.

    99Instances2Go Thanks for checking it out for me. No I'm not running Flux nor do I have any color profiles set up. Honestly, I didn't think my monitor would matter. Does color picking actually go by that? Will I actually get different RGB values depending on my monitor? I always assumed it was sort of..."hard coded" in the software.

    My monitor isn't brand new, it is a little on the old side but I didn't think it was so off that I would be getting different RGB values from screenshots. I guess I'll just chalk this up to a monitor issue for now then.

    Thanks everyone for testing it out for me.

  • Ok so here's a .capx with the issue. It's very simple.

    https://1drv.ms/u/s!AveyCUjlTWnXgvUzQDidPWEdrit89w

    I'm not entirely sure this is a bug or not so I'm hesitant to post in the bug section til someone more knowledgeable than me has a look at it.

    Here's what I did. I created a simple blue square and created a clone of it. On the clone I put a "set color" effect. I copied the RGB values of the original and put them into said set color effect. The point of this is to create two separate squares both with the exact same color value.

    Now, since Construct can't ever seem to be consistent in anything it does it uses a 0-100 RGB system...but only when it feels like it. It does so unfortunately with the Set Color effect, So I converted those values using an expression I found on the forums: "valuehere/255*100 in the event sheet. Here's the result.

    Two boxes with two entirely different colors despite having the exact same RGB values.

    Why is this happening?

  • I thought about it but there are far too many separate images and animation frames to do it that way, it's not practical.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hi everyone.

    Could someone look at this capx for me and clue me in on a way to go about doing this?

    https://1drv.ms/u/s!AveyCUjlTWnXgvUOivfCIN8fJ03F-w

    At the start of my game I want the player to have the option to customize their skin color. Not any color at all, but instead I've created a few predefined skin tones in Photoshop using an HSL adjustment layer, see here:

    Having 2 shades of color on the same object though is a problem (I actually want to have more than 2 later). At first I thought of using 2 separate 'Replace Color' effects to do this. That actually works, but replace color picks up on the gradients and anti-aliased edges where the 2 colors meet. creating at best an ugly grey line and at worst huge streaks of white, depending.

    So is there anyway to do this using, I don't know, the tint mask or the adjust hsl effects? I've played with them but I don't know how to "convert" a PS adjutsment layer into some Construct can make sense of. I guess basically what I'm asking is how do I get the HSL and RGB info from my reference files and make that work with C2's effects?

    Any help on this would be huge. Thanks for any help.

  • Haha can't believe it was that simple.

    Thanks a lot!

  • Hi all. Can someone please help me in figuring this out?

    Okay, so I have an enemy family, the family has a family instance variable of "HP" and I've set it to 100.

    I have a bunch of enemies in one layout and when damaged the HP value changes individually for each one, perfect so far.

    If I leave the layout however, and then come back to it later their health values reset to 100. I don't want that, I want the damage each of them took to persist between layouts...but family instance variables aren't static, and it doesn't seem that they can be set to be static either. I mean, I think I understand why they can't be static but I'm not sure what else to try now.

    Global variables don't make a whole lot of sense for multiple enemies of the same type, right? And local variables have always confused me a bit to be honest and I'm not sure how to implement something like that anyway.

    Any solution to this problem? Thanks for any help.

  • Hi

    Is it possible to pick from 2 different arrays at random?

    For example I have array1 and array2. Is there some sort of expression I could use to randomly pick one of those two arrays?

    Thanks

  • granpa okay, I'll give that a shot. Thank you very much