R0J0hound's Forum Posts

  • edit: ninja'd

    Where did you read that? There's nothing amiss with using multiple event sheets.

    As to the op, you could just use a sprite and add instance variables to that. It could be any object really, and if you make it a global object you can make it live on to other layouts.

  • I'm not the dev but here's a quick explanation of what is happening. The behavior doesn't store the angle of motion and speed, instead it stores the horizontal and vertical velocities and calculates speed and angle of motion from them. So when the speed is 0 the velocities are (0, 0) which results in an angle of motion calculated as:

    angleOfMotion = angle(0,0, horizontalVelocity, verticalVelocity) = angle(0,0,0,0) = 0

    That's why whenever the speed is 0 the angle of motion becomes 0. which happens in your capx when you set the speed to iaccelerate, which is zero at the start of the layout and after hitting a wall.

    Anyway's while waiting for an official response you could reproduce the bullet behavior with events. It's rather simple and we can make it keep the angle of motion even when the speed is zero.

    1. add two variables to your object of choice (character for instance), and call them "speed" and "angleOfMotion".

    2. add an event like the following and put it toward the top of your event sheet. basically jut use the "move at angle" action.

    every tick
    --- character: move self.speed*dt pixels at self.angleOfMotion degrees[/code:zts93hcr]
    
    And that's pretty much it.
  • True, and no they don't auto complete from expressions. If you change it I guess the easiest current way would be to search for the old name and then replace every occurrence with the new name. Another idea I've seen others use is make a constant global that they set to the layer name, then whenever referencing the layer with events just use the constant. That way if you rename the layer you only have to change the name in the constant, and in turn you could rename the constant.

  • Well let's test if the container indeed isn't working. We can do this by temporarily disabling the events. Disable all those events in your photo except for the first one (sentryEye: selectOrMove="select"). Next disable all the actions in that event and then add some simple action to see if the objects are indeed being picked. Something like this will work:

    sentryEye: selectOrMove="select"

    --- SentryEye: rotate clockwise by 1 degree

    --- Scout: set opacity to 50

    --- SentryEyeDot: move forward by 1 pixel

    or alternatively instead of adding those actions, enable all that event's actions except the one that changes selectOrMove.

    With that you should be able to verify if the container is working or not. Ideally you'd have multiple instances.

    If it doesn't work at all, then take a look at the value of selectOrMove in the editor. Is it "select"? Beware of case sensitivity.

    EDIT:

    if all else fails post or pm me the capx and I can find exactly what's amiss. First I'd look at the variables, next I'd look for other events that modify selectOrMove and finally I'd disable most of the events (like above) and enable them a bit at a time and verify they're doing what you intend.

  • 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]
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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