BigBuckBunny's Forum Posts

  • Honestly I needed this to have control over the UVs of each point, since as far as I know the built-in mesh is the only way to specify the sampling coordinates of the texture.

    It would be nice to be able to specify UVs when rendering quads or convex polygons, but that doesn't seem to be supported.

  • Good to know, thank you. I guess that means that there isn't a way to manually allow a certain plugin to use meshes for now (e.g.: by specifiying some plugin _info) (?)

  • Hi all!

    I'm trying to make a drawing plugin using the addon SDK v1. I want to be able to modify the mesh of the instances of my object type at runtime. To do this, i created a mesh using wi.CreateMesh(2,2).

    When this method is called, i receive the error "object does not support mesh". Digging a bit into the worldinfo.js code i find this:

    CreateMesh(t, e) {
     if (t = Math.floor(t),
     e = Math.floor(e),
     !this.GetInstance().GetPlugin().SupportsMesh())
     throw new Error("object does not support mesh");
     this.ReleaseMesh(),
     this._meshInfo = {
     sourceMesh: C3.New(C3.Gfx.Mesh, t, e),
     transformedMesh: C3.New(C3.Gfx.Mesh, t, e),
     meshPoly: null
     }
     }
    

    So it seems that the plugin itself has a flag that tells Construct if its objects support mesh or not. However, i can't find anything in the docs related to this. Is it possible to allow a custom object type to use meshes?

    Doing the same thing using a behavior on a sprite works since the sprite object by defaults allows the usage of meshes, so I wonder how i can achieve the same thing, but without a behavior and on a custom drawing plugin.

  • The closest you can get to achieving this without delving into complex js scripting involving the Web Audio API and audio file formats is by using the Video Recorder plugin. You can record the modified audio as it plays and then trigger the download by passing VideoRecorder.RecordingURL as the URL.

    Here's how to do it:

  • Hi! By looking at your code, i suppose that the problems are:

    1. The crosshair at (0,0) is the PC crosshair. In the cursor controls group you set the PC crosshair position to (mouse.x , mouse.y), however on mobile these expressions default to zero (since you don't use a mouse on mobile devices).

    2. the touch crosshair position is reset when the joystick is dropped, but in your events you move it every tick whithout checking if you're actually using the joystick or not.

    To fix 1. use the PlatformInfo plugin to detect wether you are on PC or on mobile. If you are on mobile, delete the PC crosshair.

    To fix 2. ensure that you are dragging the joystick before moving the crosshair (just add a is Dragging Joystick condition on the first event on joystick controls).

    Hope this helps.

  • Using a second tilemap is a good idea actually. Comparing the tile number at a position is a O(1) operation, and that's optimal performance wise. In your events you would then check the number of the tile underneath the player to determine which sound to play.

    The only downside may be that you basically need to have a whole second copy of your main map as a tilemap, which increases memory usage, but I wouldn't worry too much about that, unless your map is really huge and your tiles are relatively small.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I took a look too. I'm 100% sure that the problem is that the enemies in the previous room can't find a path to the player, hence they get stuck in place.

    I don't really know how Construct handles pathfinding maps between instances of the same object type, but I suppose that after a door is destroyed, all enemies still use the old map with the door still present.

    I fixed your issue by adding a global boolean DoorRecentlyUnlocked which I set to true when a door is destroyed. Then, when an enemy is created (using On created enemies), if DoorRecentlyUnlocked is true I update the whole obstacle map using Regenerate pathfinding obstacle map and set DoorRecentlyUnlocked to false prevent unnecessary calculations. Give it a try :)

  • Set the sprite opacity to 100% and set the layer opacity to 35% instead. That should work.

  • Yes that's doable. You need to work with both raycasting, distances and property of triangles.

    Here's the project revised for your needs: dropbox.com/scl/fi/o6yahpuq691w0bvw9edrx/Non-infinite-shadow-collision.c3p

    I made a IsOnShadow(x , y) function that you can use to check if a point is on shadow or not. It works by raycasting from the sun to the point and from the point to the sun, keeping track of the first raycast hit.

    Using this data + the height of the objects and the height of the light, you notice the following triangle similarity, calculate the amount of shadow projected onto the ground, and compare it with the distance from the point to the light exit point.

  • Supposing that you have an "HUD" layer with parallax 0% where you want to position your coins after you collect them; the problem is that in your code you keep your coin in the same layer and you treat the hud coordinates the same way as the world coordinates.

    What i mean is that you may have your coin at position x:2000, y:2000 in your game world. If you simply move it to x:50 y:50, you're still moving the coin in the game world.

    So, what you need to do is move the coin to the HUD layer and set its position to the position the coin would have if it was on that layer to begin with. Basically you need to translate the coin coordinates from the "Game" layer to the "HUD" layer.

    Here's a revised version of the code:

    Note that Construct has specific expressions to make the translation easier:

    CanvasToLayerX(layer, x, y)

    CanvasToLayerY(layer, x, y)

    LayerToCanvasX(layer, x, y)

    LayerToCanvasY(layer, x, y)

  • Hi! You're right, you can use the Line of Sight behavior.

    Just like in real life, you know that a point is in shadow if there is an obstacle between the line that connects the point itself to the light source. We can use this to check if a specific point is on shadow or not. Simply check the LOS between the point coordinates and the sun coordinates.

    If you have a big sprite with complex geometry and you want to check if that sprite is on shadow, you need to repeat the same thing, but with all collision polygon points. If no collision point has line of sight with the sun, then the whole object is in shadow.

    Since Construct doesn't provide a simple way to get the collision polygon points in the event sheet, you can use image points placed at the position of the collision polygon points, and test if those points have line of sight with the sun.

    I made a small working prototype that implement this mechanic: dropbox.com/scl/fi/5ocbuher2dshq0yyz3wqr/Shadow-collision.c3p

  • Like this

  • That happens because the On any touch ends condition applies whenever any thouch input ends: as soon as you lift your finger from the screen, the condition will be triggered.

    The fix is very simple.

    Instead of having:

    On any touch end && is touching speedBtn

    simply have a single condition:

    On touched speedBtn (End)

  • Open a project. In the project bar (where you see all your objects) scroll down until you find the "files" folder and right click.

    more info here construct.net/en/make-games/manuals/construct-3/project-primitives/files