blackhorse09's Forum Posts

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

  • 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

  • I've read the C2 tutorials on image optimization, but it's still something that I've never been able to quite grasp. If someone could explain how I would achieve the following it would be EXTREMELY helpful:

    So I have an image of a jeep (39x64) in Inkscape. If I zoom in and out in Inkscape the image loses no quality. However when I import the .png file into Construct 2 it looks fine at first, but when I zoom in to get the 854, 480 window size to fill the layout screen the image looks blurry. Using Letterbox Integer in preview mode has better image quality, but it's not full screen like Letterbox Scale, which has lower image quality. How do I prevent from having blurry images?

    Imgur link for visual (letterbox integer on left, letterbox scale on right) http://i.imgur.com/LADjfSV.png

  • And is one of the Scorekeepers for the peer increasing ?

    If so, its something in your logic or setup causing there to be 2 scorekeepers.

    If you have a scorekeeper on the layout by default, make sure to destroy that one for the peer on start of layout, the hosts Scorekeeper should get synched and created on the peer side.

    Yup I had one on default. Thanks so much for your help, it's working perfect now

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • It works for host. Everything I've tried has worked fine for host, but it's something with the peer. On the debugger scorekeeper's kills raises for host, but on peer it looks there's 2 scorekeepers. When I click on the scorekeeper option it shows

    #0

    #1

    On host it only shows #0 which gets updated. #1 is getting updated on peer, but not #0.

    http://i.imgur.com/NXDrDPl.png