BigBuckBunny's Forum Posts

  • 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

  • In Construct you can create and edit .txt files if you wish. Simply right click on Files and select New -> Plain Text

  • There is not a specific expression for that, but you can calculate the exact number using events.

    The number of line wraps is equal to the textHeight of the full text (line height offset excluded) divided by the textHeight of a single character / line.

    Here's a working prototype: dropbox.com/scl/fi/jmccjnkc9tdvmhchvl8qe/Line-wrap.c3p

    Note that modifying the text appearence at runtime is needed for the calculations to work.

  • If you want to keep the animation when the player is moving to the other side of the screen, you need to have a copy of your player sprite that can handle that animation while the sprite is at the other side of the screen.

    Basically, as soon as the player leaves the layout, you teleport it on the other side of the screen, and you place your player copy where the player previously was. Then you animate the player copy.

    I made an example project to show you how to do this. Note that i don't use the wrap behaviour for the player (implementin it is just 4 events). The animation itself is done with the tween behaviour. If you go in debug mode, you'll see that the player is inside the screen at all times.

    Here's the project: dropbox.com/scl/fi/d4ab0aolo0vkmm2pueway/Tile-movement-warp.c3p

    I suggest not to have a player of size different from the cell size. That could cause bugs in the future that will be hard to find.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You can stack various tiled backgrounds on top of each other in a single layer, and then change the OffsetX property of each background individually at an increasingly lower rate to fake the 3d parallax.

    You can do the same thing with more layers if you wish.

  • Two things that instantly come to mind are families and hierarchy.

    You should group your panels into a single family, so that you can call actions on all panels at once. Do the same for the text.

    When you tap an object of the panels family, you first reset the 10 pixels offset of all panels using the family, and then apply the 10 pixel offset only to the desided panel.

    You can also avoid having to move the text of each panel by using hierarchies. Simply set each text as a child of its panel (with the y position constraint) and then each time you move your panel on the Y axis, the child will move automatically without needing to write additional events.

  • When the sprite is in direct contact with the wall and the collision polygon changes, the polygon itself may overlap with the wall. When this happens, the engine assumes that the sprite is passing through the wall and instantly pushes it out. Shortly after, however, the collision polygon changes again, and the cycle repeats. Each time this occurs, the sprite's position shifts abruptly, and if the camera follows the exact position of the sprite, it results in a screenshake effect that you see.

  • There are a lot of factors in play which could cause this. First of all, make sure that your sound is exactly 9.6 seconds long. Then check your Audio Output Latency, since that plays a role in these situations.

    Even then, as oosyrag suggests, it seems that you're building up errors over time. I tried setting up a small project and I notice the problem too.

    A solution which seems to be working is to calculate the difference between the expected playback time of the sound and the actual playback time, and use that difference to slow down / speed up the tween so that it is always synced.

    Give it a try: dropbox.com/scl/fi/sc8ehxu0njhg8lfs3cin0/Sound-issue-fix.c3p

  • Normally that doesn't happen if everything is set up properly. Also, the invisible box isn't a bad idea, a lot of games use that same technique.

    Can you check and make sure that the collision polygon for your character is the same for each frame? If your character has an animation playing but the collision polygon changes during the animation, the character won't stay still when touching the wall.

    To fix this, simply pick the smallest (lowest width/height) frame, and set the collision polygon of each frame to that of the smallest one.

    If your character doesn’t have an animation, the issue might stem from a different problem. In that case a project file would be useful.

  • The way you save the recording looks good. If you want to play that data back, one way to do that is to get the data from the BinaryData object in Base64 format using BinaryData.GetBase64. Assign the data in that format to a string local variable (i'll call it Base64String).

    Now you have to use the Add Remote URL action (Audio) to add the recording so that you can play it. Since the URL you pass to the action itself will be applied to the src field of the html audio element, you can pass as URL "data:audio/mp3;base64,"&Base64String and leave the other parameters unchanged (except for the name) to be able to play your sound by name.

    I tried this solution and it works fine, even though there may be more efficient ways to do the same thing. Give it a try :)

  • Right click the family folder in the project bar and select add family. Note that objects of a family must be of the same type (ex: you cannot have sprite and text in the same family). For more information check the manual: https://www.construct.net/en/make-games/manuals/construct-3/project-primitives/objects/families