Jimzip's Recent Forum Activity

  • Hi all. Sorry to post this as I'm sure it's a simple solution, but I searched for every combo of the words on the forums + manual and still can't figure this out.

    Basically I want to repeat an action x times within a function, but nada. I know I can call the function outside x number of times and that would be dandy, but then it became a matter of curiosity as to why this doesn't work.

    Can anyone explain? Do functions simply run everything inside just once no matter what?

    Thank you in advance!

    Jimzip

  • Hey Thanks a lot for the help, I see the issue now - once I checked your solution it made sense. Much appreciated! I'm now picking through the rest of the code to see where else I've misused loops.

    Jimzip

  • blackhornet I think see your point. I'm still trying to get my head around how to think about it in the terms you described. In my head this event went: if x, y, and z, every 0.05 seconds do abc - the timer obviously being just an attempt to save CPU.

    If I were trying to save processing overhead then, what would be the correct way to limit this? Sorry to extend this thread but I think it's important to know as my thinking about these things is obviously a bit skewed. Thanks for your answers thus far.

    Jimzip

  • Aw! You guys are amazing, thank you.

    blackhornet do you know why the time condition would have had that effect on everything? It seems to have made the timing of everything very erratic, I wouldn't have expected that.

    In any case, all fixed, I'm so glad it was that simple!

    Oh and dsminor, cheers, much appreciated! Here you go:

    X)

    Jimzip

  • For anyone who wants to take a crack at this, I knuckled down and made a .capx:

    https://www.dropbox.com/s/3gaqlp8ky5ycr ... .capx?dl=0

    Note that in the TEST_REGION layout, all of the enemies actually do start patrolling, but one after the other, and in a weird, delayed manner - while in the cavern level they do not. (There should only be a 1 second delay at each point). There's nothing special about the cavern, as you can check. Honestly, I'm about to give up!

    As I've stripped away almost the entire project (leaving one level so you can see it in context), and the problem remains - I honestly think this is a construct bug - and at this point I'd love to hear that my code is the problem!! Please take a look if you can (and sorry for all the junk in the capx, I just didn't have time today to strip it all totally clean).

    Jimzip <img src="{SMILIES_PATH}/icon_e_biggrin.gif" alt=":D" title="Very Happy">

  • Hey dsminor thanks for the reply! Much appreciated. I've been hacking away at this since your post & still haven't found a solution (but I did remove the 'trigger once' you mentioned!).

    Collisions are indeed activated. What's more curious is that every few runs, the 4th enemy actually moves! He walks to the first point and stops there! It happens seemingly at random, I didn't change anything.

    A couple of interesting points:

    1) if I disable the 'for each enemies' at the start of the patrolling behaviour, they all move! (The problem here being that they all copy the first instance's movement). SO I've ruled out something being wrong with instances themselves.

    2) if I change 'For each enemy' to "for each enemy, pick by IID ascending" then the last 3 work, and the 1st stops working! It's bizarre.

    Again, any suggestions, help or thoughts on this would be much appreciated. I see no reason why the 4th shouldn't work. I've checked to see if there is interdependence or if something is interfering and so far I've come up with nada.

    Jimzip

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hi all!

    I'll keep this brief. I have a level in which enemy NPC units wander on a set course. They wander between pre-defined and positioned position-sprites.

    Everything is running just fine and dandy ... until I add more than 3 enemies. Then the 4th, 5th, 6th etc. simply get ignored by the Enemy wander script. I cannot get my head around this.

    Here is the code:

    And the map (the red points are the position markers):

    And finally, the Enemy properties:

    It's driving me a little nuts. 3 or less and everything's peachy, but subsequent enemies are ignored...

    From the debug view I can see that these extra enemies' bullet behaviour just stays on 'False' the whole time. If I force it on (with a key-press or whatnot) then they activate, but then they just walk off the screen, ignoring all collisions. Very annoying!

    Any help would be much appreciated!! I can try and bust out a custom .capx if necessary but it'll take a while so I'd rather avoid it!

    Jimzip

  • Hey all, thank you so much for the help & sorry I didn't reply (was away the last couple of days).

    Littlestain, I thought that as well, but no matter how I did it the problem remained the same X/ . I had the objects I was referencing pinned to one another in any case, so they moved together. Thank you for taking the time though. Much appreciated.

    Magistross, you hit it! This works like a charm. I had the logic in my head but I couldn't figure out how to do it. This works very nicely. For a visual, I've attached the final block:

    Thanks a heap peeps! This gave me many nights of annoyance! Rock on!

    Jimzip

  • Hey RamPackWobble,

    thanks kindly for making the examples! Unfortunately your solution won't work for this problem, as then the layer objects themselves are being shifted to the front/back of the layer. Rather, the player should be moving in between them.

    To see why your approach would be problematic, here's an example of a level:

    As you can see, there are a lot of overlapping objects, and having them shift up and down causes them to 'pop' behind and in front of each other (I tried this approach early on). So, the challenge is to get the player to move around them, and to have the layer objects stay in order in z-space. Sorry for not clarifying this in the original post (thought I had everything this time)!

    In any case, I assumed (as you did) that I could simply select all the objects in a range, and then move the player in front/behind them, but when there's two objects in the collision zone, there's some issue I just can't seem to resolve whereby construct picks the most recently 'hit' object and disregards the first, rather than applying the conditions to both (edit: it seems to happen if the original object is lower than the new one. If it's above, then things seem to work).

    Anyone else like to take a stab at this? It's trickier than it looks!

    If there was a way to directly edit the z-index of objects (rather than just 'move to top/bottom/another object') it would be very helpful, but I can't seem to find a way to do that.

    Many thanks in advance.

    Jimzip

  • Nobody? Is there something simple I'm missing about this? Any answer here would be really appreciated!

    Jimzip

  • Hi lovely people! I'll do my best to describe the problem here. The problem seems simple but I've attached a GIF for better understanding anyway.

    Problem:

    I have a character sprite, and a family of objects called Layer_Objects. What I'm trying to do is give some depth to the game, by having the character move behind or in front of these objects. So, on collision with Layer objects, I find the Y index of the player, and the layer object collided with, and move the player in front or behind the layer object depending on if the player's y-index is higher or lower than that of the collided object. Following me?

    The function itself actually works, all seems fine and dandy - until two objects are collided with. As you can see in the GIF, one object is no problem, but the second layer object will always override the first, and puts both objects in front or behind of the player. I've been trying to fix this for literally days and am now having Z-Index nightmares. Please help!

    Here's how it looks in action, you can see the problem at the end of the GIF when he collides with the chairs:

    Here's the code I've used thus far (which seems to work the best - ignore the shadow condition):

    I also tried a for loop, but this gave the same results:

    Something to note: on the start of the layout I sort all the Z-Indexes of the Layer_Objects by their Y-index (so the higher they are on the layout, the further back in space they are). That's all kosher. No problems there. It just seems to be this multiple object selection that's the problem.

    I've toyed with the idea of creating an array which stores all the Y-values of all the Layer_Objects, and simply checks the player's Y constantly to determine if he's 'above' or 'below' an object, but this seems like CPU overkill for a simple effect, and what I suspect might be a simple solution.

    Any help would be much appreciated! Thank you in advance.

    Jimzip

  • Thank you guys! StormHo you're right, and lannaert using your method it now works. I still have much to learn about arrays. I just set the depth to 1 and it functions. Now to figure out that duplicate entry...

    Jimzip

Jimzip's avatar

Jimzip

Early Adopter

Member since 15 Jun, 2014

None one is following Jimzip yet!

Connect with Jimzip

Trophy Case

  • 10-Year Club
  • Email Verified

Progress

11/44
How to earn trophies