R0J0hound's Forum Posts

  • Whatever you like. You could also reduce it by making everything bigger and zooming out.

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

  • I don't have all the plugins required to open your capx. If you want to attach objects together like that then yeah, joints would work. There are probably some examples in the forum that do that.

    If the original cell is the same object type as the other cells then you'll need to do a forum search on how to pick two different instances of the same type so you can attach one to the other.

    Once you can do that then the pivot joint combined with a gear joint is a useful way to attach two objects together (there's an example of this in the chipmunk topic). If the attached objects overlap at all they will jitter around so it's also to put connected objects in a collision group so the ignore collisions with each other.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • It is faster but I'd go with what was more readable.

  • dellong

    If you look at the source of the example, paperJS only does the drawing part. Everything else is done with code.

  • Joints won't help in this case, and in your image you're creating a joint with itself which does nothing. what you want is to apply a force to all the objects to an average center. Here's one way:

    global number centerx=0
    global number centery=0
    
    every tick
    --- set centerx to 0
    --- set centery to 0
    
    for each sprite
    --- add sprite.x to centerx
    --- add sprite.y to centery
    
    every tick
    --- set centerx to centerx/sprite.count
    --- set centery to centery/sprite.count
    --- sprite: apply force polar(angle(self.x,self.y,centerx,centery), 100)[/code:1187k6ok]
    
    I used a force of 100 but that could be changed.  You could even make it proportionate with the distance from the center.  
    Further ideas include applying the force to the average center of only the particles in a radius around each particle.  You could also do a repelling force between the sprites to keep them away from each other.  It would give more of a fluid motion.  You'd have to tweak it in such a way so the attracting and repelling forces balance.
    
    Here's some fluid experiments i'be done before:
    [url=https://www.scirra.com/forum/viewtopic.php?f=147&t=116854&p=842125&hilit=fluid#p842125]viewtopic.php?f=147&t=116854&p=842125&hilit=fluid#p842125[/url]
    
    And here's one from today:
    [url=https://dl.dropboxusercontent.com/u/5426011/examples31/chipmunk_blob.capx]https://dl.dropboxusercontent.com/u/542 ... _blob.capx[/url]
    To make it more fluid like I made the sprites be in a collision group to disable collisions between each other.  Then I compared the distances between each pair and repel or attract depending on the distance.  The forces are proportionate to the distances using a spring equation: Force=-k*displacement.  To add to the stability I gave the sprites a max speed.  Also I readjusted their positions when they get to close since the force when the objects are almost on top of each other will send the sprites flying.
    
    One thing I haven't tried that's used in fluid simulations is velocity smoothing.  Basically you average out the velocity of the particles around another particle, where the weight they have in the average depends on the distance.
  • vsync works on my machine on firefox/chrome. If it's not disabled in your graphics card properties then i'm not sure where the issue lies.