jobel's Forum Posts

  • Hi, Anyone else having issues when recording C2 game video with Bandicam? (using Chrome)

    I was getting this annoying screen "hiccup" about every 2 seconds in my game and thought I had a major performance leak. But I loaded up a blank project with no events and got the same hiccup...My computer is relatively fast, and I use Bandicam to record other games all the time without issue.

    The capx only has 1 tiled background and 1 sprite with the 8Direction behavior.

    for Bandicam recording options I just used the YouTube 720p preset

    here is the video capture with those "hiccups" (6MB video)

    https://dl.dropboxusercontent.com/u/362 ... 23-307.avi

  • rexrainbow I did a couple days testing on this because when it wasn't working, I thought I had a flaw in my design. I wasn't able to see what the CSV had in memory in the debugger, so I wrote the contents to a Text object as I would use it. Everything seemed okay variable-wise.

    The pick statement with the int(CSV.At("field",sprite.idnum) was NEVER true even though the data was there, so I thought I was doing something wrong. But when I replaced the CSV line with the constant value "3" it worked... which blew my mind! meaning that CSV statement was never giving the argument a "3" even though the data was there. I tried to preface the CSV line with int() or str() both in the Pick reference and in Set Entry to make sure it wasn't something funky like that, but it wasn't as far as I could tell.

  • rexrainbow does the CSV plugin have a problem resolving when it comes to picking? i.e Using the System Pick All, or Pick by Comparison, Pick random etc...

    I'm using the CSV to remember every sprite's position last time the Layout was loaded.

    FOR EACH sprite
         PICK gridSprite where  gridSprite.field1 = int(CSV.At("field1",sprite.idnum))[/code:1r7mnxcl]
    
    and this won't work at all.. I finally found a way to make it work using the System Compare two values:
    
    [code:1r7mnxcl]FOR EACH sprite
       Pick ALL gridSprite
          FOR EACH gridSprite
            System gridSprite.field1 = int(CSV.At("field1",sprite.idnum))  THEN Set Position sprite to gridSprite
    [/code:1r7mnxcl]
    does this make any sense?
  • nimos100

    yeah I don't know about this, seems heavy handed when you can probably just rearrange how you do things; initialize all the relative objects within the same event umbrella. Because we aren't really talking about anything other than initialization or rather, things that happen only once. Otherwise a reoccurring event will catch up with no noticeable problem.

    Not saying your object handler won't work, it's just maybe not very practical? I don't really know, I'd have to see a situation where you couldn't keep created object references together.

    In those examples of Create Enemy, Initialize Enemy, GiveEnemyWeapon. You could still have those functions perform actions and have the function return a result you could apply to the newly create object within the same event nest.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • aha! thank you thank you!

    I've seen pick nearest before, but wasn't sure where to find it. It's not a System expression, it's in the object condition...

    wow, this makes things SIMPLE!

    DuckfaceNinja thanks again!

  • I want to take a subset of instances and get the min distance to an object.

    so...

    Pick all Sprite1 AND Sprite1.isEnabled = true

    so let's say I have 20 Sprite1s and this line above picks 10 of them

    now I want to find which of those 10 Sprite1s is closest to a particular x/y (let's say Home).

    Pick Sprite1 where min(distance(Sprite1(0).x, Sprite1(0).y, Home.x, Home.y),distance(Sprite1(1).x, Sprite1(1).y, Home.x, Home.y), etc..

    the problem here is I am referencing each instance directly and not filtering the instances that are Enabled=false

    how do I apply the min expression to a subset of instances??

    Thanks...

  • sorry blackhornet you seemed to know since you said this has come up before.

    thanks R0J0hound - a nice visual explanation! So does Wait 0 sort of make the Function act like a top level event?

  • from the manual: The action then triggers the corresponding On function event (e.g. On function "CreateEnemy"), running the event's actions and any sub-events, before returning to the original Call function action and continuing from where it was.

    so maybe it is a scope issue?? okay, now I'm confused to why Wait fixes it. Unless wait causes the proceeding events to happen after the tick? Wait 0 works and I assumed proceeding events were pushed to the end of the sheet, yet still in the same tick.

    blackhornet do you know why "wait" fixes it?

  • there's a tutorial on it..

    https://www.scirra.com/tutorials/1118/path-finding

  • use the PathFinder behavior on your sprite.

  • local like on the same computer? that's easy.. just like a normal game except with more inputs... have one player use the mouse/keyboard and one use a gamepad. Or have one person use WASD keys and the other use Arrow keys..

  • Also "Wait 0 seconds" postpones the following actions until the end of the event sheet. So depending on what you are doing that might muck things up.

    For me it worked because it was just database stuff and displaying information.

  • I can't find any doc on how events in functions work opposed to normal top-to-bottom events that are checked once per tick. but from my experience they seem to run parallel (or at least out of sequence) to normal events since they branch off. Which is probably why it's a good practice as newt said to change the sprite inside the function instead of after.

    When I add a 0.001 Wait after your function call I get all green check boxes. Now that might be messy code, but it exposes the issue. It seems the For Each Sprite event (setting animation frame) is happening at the same time as the Create event For-Loop and its NOT happening top down. So how could those objects exist? I'm talking about the order of events inside 1 tick.

    I had a similar thing happen where I use RexRainbow's CSV plug-in. I called a function which modifies the CSV(comma delimited file) in memory. And my very next event after the function call references that change that happens inside the function but I kept having problems as if the function didn't work. It turned out to be order of events issue. The only way I could work around it was to "wait" for the function to be done.

  • I believe you need to put in a 0.1 wait after the function call since the Function is happening at the same time as the For Each Sprite.

    I don't think those objects exist yet at the time it's executing.

  • Just make sprites and add frames for different states of the button.

    Mouse: OnClick SpriteButton do Action