R0J0hound's Recent Forum Activity

  • I guess it's time for some debugging. There's probably some logic error somewhere.

    You can either look at the variables in the debugger to get an idea what's up or add some events to display the variable values at various points.

    Since the events in the photo look fine the problem could be elsewhere. Do those objects start with a value of "move" or "select"? If they do are they all lowercase? If that looks good then do those variables get set anywhere else in your events?

  • I agree those would be useful additions, but if you want to get them now you can do this:

    global text tilesJSON=""
    global number horizontalTiles=0
    global number verticalTiles=0
    
    Start of layout
    --- set tilesJSON to tilemap.tilesJSON
    --- set horizontalTiles to int(mid(tokenat(tilesJSON, 4, """"), 1,20))
    --- set verticalTiles to int(mid(tokenat(tilesJSON, 6, """"), 1,20))[/code:ixdzkbtt]
  • Whatever you like. You could also reduce it by making everything bigger and zooming out.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I can confirm the first issue happening with webgl on, it doesn't happen with the canvas2d renderer.

    The second issue occurs with both renderers for me.

  • The term is "slop". Box2d uses it to keep things more stable. You can make the collision polygon a bit smaller to avoid it.

  • You can use the layer name in expressions instead of the index. So something like LayerOpacity("Layer 1") would work. You can also do the same thing with imagepoints, either use an index or the name.

  • Do you have more than one instance of this? My guess the issue arises from that event with trigger once. It will work fine with one instance but with multiple instances the actions will only run again if all the instances aren't on "move" for a tick. So maybe you could do this instead?

    SentryEye: selectOrMove="move"

    --- find path

    --- set selectOrMove to "thinking"

  • When you create your object with events the new object is picked immediately so you can enable/disable stuff with events right there.

    mouse: On left mouse click

    --- system: create sprite at (100,100)

    --- sprite: 8direction: disable

    By default when you create a new object it copies all the settings of the first object of that type you put in the editor. If you want to copy the settings of some other object when you create a different one you could use the "sprite.asJSON" expression and the "Load from JSON" action.

    global text template=""

    mouse: On left mouse click

    --- system: set template to sprite.asJSON

    --- system: create sprite at (100,100)

    --- sprite: load from json template

  • I understand that a bit better. So basically you want to only process a certain number of objects at a time instead of doing it all at once?

    The "pick nth instance system" condition could be useful. You could also use an array to make a list of uids i suppose but picking the nth instance is simpler.

    So basically you're doing this? It only loops over 100 of the sprites per frame. So with 1000 instances it would take 10 frames to loop over them all.

    global number n=0
    
    system: repeat 100 times
    system: pick sprite instance n
    --- function: call "doStuff" (sprite.uid)
    --- system: set n to (n+1)%sprite.count
    
    on function "doStuff"
    sprite: pick by uid function.param(0)
    --- ...[/code:27411qou]
    
    Edit:
    That code assumes there are more than 100 instances. Probably should change the "repeat" to the following to keep instances from being looped on more than once when the sprite count is less than 100.
    system: repeat min(100, sprite.count) times
  • I don't really get what you're doing. I understand you have a lot of objects with the pathfinding behavior and I guess you want them to target each other? I get lost with the talk of uid and for each loops and such. I must be tired I guess.

  • You could do it by manually editing the layout's xml file. Under the tilemap instance there is a block called "tilemap-data" that stores the tilemap's tiles.

    Now what the tilemap's tilemap.tilesJSON expression gives is compressed with rle, and the ordering is a bit different.

    Here's a utility that you can use to convert it to be usable in the xml.

    https://www.dropbox.com/s/w7b6tjsawhdbp ... .capx?dl=1

    /examples31/tilesJSON_convert.capx

  • bilgekaan

    The water motion in that post's video can be done with this:

    You could in turn utilize this to draw those points to draw a smoothed curve using the canvas plugin: