R0J0hound's Recent Forum Activity

  • Hmm...

    Are you using arrays to do this or is it just laying down sprites?

    If you're using an array to do this then you could loop over the array and create a wall where the floor isn't. Actually a tilemap would be better and done in the same way.

    If those are just sprites, then it may take a different approach. It's an interesting enough idea that I had a go at it:

    https://dl.dropboxusercontent.com/u/542 ... _edge.capx

  • I don't think a plugin could be made to understand a tilemap like that. Your image is vague but I guess the walls are on the edge of the tiles? No idea if you can do this with existing behaviors, but what you'd need to do is loop over all the tiles of the tilemap and build a mesh of movable area and then pass that to the behavior.

    Or if the existing plugins can't do that, it's possible to do it with events.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • A bounce is basically done after a collision. Basically the steps are:

    1. check for collision

    2. resolve the collision by moving the object out of the other so it's just touching

    3. find the angle of the edge of the object where the object's touch. This is the collision normal.

    4. using the normal calculate the new velocities. This can be done with the angleOfMotion and the normal angle, or with the xy components and some vector math.

    2 and 3 are the more involved ones. The simplest for 2 would be to just move the object backwards till it's not colliding. Calculating the normal with 3 can either be done with detector sprites to get a good approximation or you can do some math with the object's geometry (typically polygon or circle) and calculate a exact normal. Another way to handle both is to use SAT (separating axis theorem).

  • I think you can make it a global layer.

  • This topic is probably relevant:

    Basically you'd need to use some kind of 3d to do it.

  • 1.

    Yes that should still be a top-level event. They didn't use to be but it was changed, so maybe that's the confusion.

    2.

    It depends on where the function was called from.

    3.

    It depends when the event was triggered.

  • Usually you'd use two tilemaps. One would be for the visuals, and one would have the solid behavior and define the walls.

  • christina

    Glad it helped the performance.

    Changing the position and size of the canvas wouldn't affect the performance. What would affect it, I imagine, is the "resize canvas" action, which changes the texture size. If you can i'd leave the texture size be, and just change the object size. The only issue is the positions would be off when you zoom in and out because the line draw commands are relative to the texture, not the object. This doesn't apply for the "paste" action though, it will paste in place regardless.

    Typically when the texture size is the same as the object size you can do this to map layout positions to the canvas:

    sprite.x-canvas.left

    sprite.y-canvas.top

    When the sizes are different you can do this instead:

    (sprite.x-canvas.left)*textureWidth/canvas.width

    (sprite.y-canvas.top)*textureHeight/canvas.height

    I didn't seem to include a way to read the texture width and height so you'll want to save them to variables. Just note when the canvas object is created the texture size will be the same as the object size. Then you if you ever use the "resize canvas" action you'll want to update those variables with the new size.

  • Another thing you can look at is the .asJSON expression and the "load from json" action. Every object has them and you can use that to save only objects that you want.

    Here's an example:

    https://dl.dropboxusercontent.com/u/542 ... load2.capx

    The saving saves three values for each object:

    "zindex" so the when we load they zorder will be the same.

    "name" so we can know what object to load.

    ".asJSON" the actual object data.

    after all that is put in the array it sorts the array by the zindexes, so then the array has each object that needs to be created in order of z.

    Loading is simple enough, and we use the "name" to create the right object type, and then the json is loaded.

    The capx has some comments of what you can do and what would require further implementation. Globals could be saved too but I'll leave that as an exercise for the user.

    But actually the more you want to save the more you probably should just use the save/load actions included with C2. You can use the "no save" behavior on objects you don't want to save.

    https://www.scirra.com/tutorials/526/ho ... -savegames

  • When you add an effect you can use an action in the event sheet to do it. My machine doesn't like webgl so I won't make an example.

  • yes you can. Look on the left side.

    Or click on an empty space in the layout.

    in the properties bar click on project properties.

    scroll down and you'll find it