blackhorse09's Recent Forum Activity

  • I will post pictures if needed but basically I have 2 main objects and a 3rd object that determines when one object is within range of another (overlapping).

    • Soldier object has an invisible circle object around him called Range.
    • When the Enemy object is overlapping Range the Soldier targets the Enemy.
    • When the Enemy is not overlapping (either the enemy runs or is destroyed), the Soldier is SUPPOSED to continue doing his task.
    • Everytime the Enemy dies his respawn time increases (this is how I found the issue)

    What actually happens is that the Soldier behaves normally when the Enemy is alive, both when Enemy is overlapping and not overlapping the Range. However when the Enemy is destroyed while overlapping Range the Solider continues to target where the Enemy was UNTIL the Enemy respawns, which then he acts normally again.

    So during the time that the Enemy object is destroyed the Soldier still thinks the object is alive in that previous spot. I DO destroyed the Enemy sprite. I also have tried working around On Enemy destroyed by using variables and whatnot, but it seems like there's something in the Construct 2 logic that I do not understand.

  • Problem solved. A friend found the issue, I'm missing an option for if both players health are above zero. SILLY ME! Thanks for the responses!

  • You are setting an INSTANCE variable which means it will be gone together with the instance of the object.

    You should provide some screens, so we could actually see what are you doing there.

    First pic is my on start of layout event. The function is called but does not change the target. (please ignore the getTarget(1) it's no longer in my project)

    2nd pic is of my Enemy object and instance variable default at None.

    3rd pic is from preview mode. The object is not moving and I have text to show it's current target which is still None

    4th pic is the actual function code

    Note: Also the function DOES call at the start of layout because the text is set to CALLING during preview mode, but it does not set the target.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Not sure why you insist on using a Function. If you really want too, i can show you.

    But. Consider this.

    'On x Destroyed' is allready a function with as parameter(0): the destroyd object. It gets called by a trigger, just automaticaly and with not headaches.

    See:

    https://

    drive.google.com/open?id=0B1SSuCVV8v74amROMHVHR3lKU28

    I have the enemy finding a new target when their target dies, when they die, and when they heal back up after retreating. So I'm using a function to save the hassle of writing that every time. I'll post screenshots in a second. Thanks for the response I'll see if I can use what you've given me.

  • Well I do have it on a wait timer before it runs the call so it should respawn in time. But even calling on start of layout the function doesn't work. I believe it's my main sub events for the function that is the issue.

  • I have 2 Enemy objects: Enemy 1 and Enemy2. It is a respawn game so there is always only one of each object at one time. Both enemies have an instance variable which determines their target. What I want to accomplish is having a function that gives them a new target everytime they die or they kill their target.

    What I tried was having the function

    EVENT - On FUNCTION

    • -- SUBEVENT1 - Parameter 0 = 1

    ------ SUBEVENT1A - If .... then Enemy1 set instance variable Target to...

    --- SUBEVENT 2 - Paramater 0 = 2

    ------ SUBEVENT2A - If .... then Enemy2 set instance variable Target to...

    on Enemy1 destroyed - call FUNCTION(1)

    But this does not work. The enemy keeps the same target that it had when it died. I also have:

    ON start of layout - Call Function(1) & Call Function(2) but this doesn't seem to work either.

  • They probably never overlap perfectly..

    y=200 is not the same as y=199.9999

    you could for example compare distance between the two and if it's very small set the movement stopped and set the position to the exact coordinate..

    That's what I was left to assume, but I figured it could very well be me making some sort of error.

    I googled for a bit and found this tutorial that has a linked capx file https://c2tutorials.wordpress.com/2014/ ... er-object/

    I'm sure there's a name for the formula, but in the tut they basically check if a smaller sprite is completely inside of another bigger sprite. If it is then the animation changes, but if even a sliver is outside of the bigger sprite then the animation is not changed. I used the same formula for my issue and it worked!

    Anyways, thanks!

  • basically I have objects that are letters at one position and I also have the same number of identical letters at another position. At a certain moment the first set move towards the positions of the identical set through custom movement.

    My issue is that I can't seem to make the first set stop moving as they perfectly overlap. I've tried comparing Y's of both and disabling the movement/setting speed to 0 when they are equal, but it does not work. It's like they never hit perfectly on the dot although it's clear they do overlap at one point.

    If I just set them to stop moving when they overlap, they stop moving but it's nowhere close to being perfectly overlapped. I could probably just do the positions manually but I know there has to be a simpler way.

  • "What's limiting us from making 0.0001 x 0.0001 sprites and zooming in by adjusting the layer scale to see those sprites?"

    Basically: the actual on screen rendering size and texture size will be the limit.

    A texture cannot be smaller than 1x1 pixel (as... it is the minimum quantity of information you can have for an image., less than that would just be non-sense as the number of pixels a texture has is an integer), also, by having a 0.0001x0.0001 sprite object (not the actual texture) zoomed in 100 000 times or 0.1x0.1 zoomed in 100 times will give the same result as the rendered area will be the same and the texture size will also be the same in both case.

    If you wanted however to say reducing the texture size, well, it can be worth it in many cases, but be sure that it still looks good, as a 1x1 texture zoomed in will look blurry or pixelated (depending on the sampling), a gradient texture can be scaled down with the linear sampling yet still looking good for exemple, as the blur won't damage it much.

    Ok I think I understand, thanks so much

  • Up to a fairly great amount, it does not matter. It is about what you do with them.

    I noticed the greatest performance hits with large amounts of objects, is when you loop through them continuously and check/do things with each.

    Thank you, I'll keep that in mind for the future!

  • The size of an image determines how much room it takes up in C2, if we use very small images and "zoom in" by adjusting the layer scale, is it possible to create an extremely large map/world with all of the objects already created at the start? Especially if you're using very few different and very small sprites? Or is there an amount of sprites that causes lag/dropped frame rates?

    If I worded that terribly I'm basically saying. If we limit ourselves to 750MB, then there's only so many 1000 x 1000 images we can import before we hit that limit. Same with 100x100 images, but we can have more. If we're just using say 5 different sprites. What's limiting us from making 0.0001 x 0.0001 sprites and zooming in by adjusting the layer scale to see those sprites?

    Thanks in advance.

  • Does look better, thanks

blackhorse09's avatar

blackhorse09

Member since 30 Sep, 2013

None one is following blackhorse09 yet!

Trophy Case

  • 11-Year Club
  • Email Verified

Progress

12/44
How to earn trophies