Colonel Justice's Forum Posts

  • Can you please share a .c3p that demonstrates the issue?

    You don't need to load the JSON string into the array every tick, once e.g. at start of layout is enough.

  • Try:

    On start of layout:

    -Add local variable (string)

    -Set variable to tilemap.asjson

    Repeat 5 times:

    -Create tilemap

    -Set tilemap from json: variable

    -Set z-elevation to -1 -loopindex

    EDIT:

    Be sure to disable collisions on the tilemap copies.

  • Hello fellow constructeers,

    I was wondering if there is a feasible way to alter the texture offset on a 3d shape.

    Let's consider the following scenario:

    Consider 16x16 box 3d shape. The shape has set a tiled background (256x256 image) as face. The 3d shape gets cloned 16 times (e.g. create, then set from JSON) and the copies are placed next to each other. Altering the y-offset of the tiled background by loopindex * 16 during the creation loop of course changes every box instance.

    The common workaround is to put box & texture in a container or create a hierarchy.

    This though is resulting in unnecessary object count overhead.

    I was wondering if there is another way (maybe JS) to offset the box face per box instance?

  • The object you want to apply the image texture from has to be on the same layout.

    Be aware though of having more than 1 image object on the layout, since you can't tell which instance is chosen when the face is applied manually.

    To overcome this issue, you can create a container with the 3d shape and the sprite / tiled background / 9 patch object.

    Like this, you can control animations and such at instance level.

    Regarding the transparency, the rendering impediments described in the manual / tutorial apply.

    https://www.construct.net/en/tutorials/using-3d-construct-2746

  • Use int(random(1,10)) to convert to an integer value.

    Additional information:

    Repeat X times makes only sense with integer values, because you can't repeat something only a fraction of times. That's why it's converted during the call.

  • Do you want to display the score in the 3D environment or just have the score displayed on a HUD overlay?

    For the latter, use the method I described earlier.

    If you want to have text rendered in 3D, well, that's another story.

    As you pointed out correctly, you can only use sprites, tiled backgrounds and 9-patches a source textures for 3d shapes.

    You could, however, do the following:

    1) Use a spritefont object for the scores

    2) Add a hidden 2d layer to the project and place the spritefont on it.

    3) Add a drawing canvas and sprite object to the same layer. Set the 3d object face to the sprite.

    4) Add some events:

    Every tick:

    -Canvas: Paste spritefont on drawing canvas.

    -System: Wait for previous actions to complete.

    -Canvas: Save image(PNG quality).

    -> On Canvas image saved:

    -> Sprite: Set image from URL: Canvas Saved Image URL.

    Voila.

  • Create a 2D layer and put it on top of the 3D layer, then put the text on that 2D layer.

  • When changing an image via URL download, it affects every object because the image information is just referenced in memory - that‘s why the copies you create during edit or runtime are called instances.

    There are some workarounds to tackle this challenge though. For example, you could use a sprite with let‘s say 100 placeholder frames, and then everytime you want to load an image, change the animation frame to the desired (empty) frame beforehand.

  • Yes. The performance will probably be sub-par, but yes.

  • Seconded!

    The only problem is that there's no Unix / Mac support with WebView2 as of yet.

    https://docs.microsoft.com/en-us/microsoft-edge/webview2/roadmap

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Colonel Justice I managed to use coordinates for sprites on the 2d layer. But I do not understand how to achieve the correct size of sprites. This method can be used for a coin in my case. Since the question arises how to move sprites if we constantly set their position.

    https://drive.google.com/file/d/1Z36JfxluwTB0vrWVDJi97Ko6H5HAkvq3/view?usp=sharing

    But even a coin I would like to animate (smooth movement up and down). Therefore, the ideal option would be for a coin or a flying ship that comes from the sky or whatever to be displayed correctly in 3d mode. And here is an example of a game in which i want to do this:

    The sprite scaling seems fine to me, maybe needs a little tweaking.

    To properly scale, you need to take into account the viewport height of your project and relatively scale in function of the aspect ratio. http://graphicdna.blogspot.com/2009/09/properly-scaling-point-sprites-in.html

    You can use controller sprites that are joined via containers with the display sprites, position the controller sprites in the 3d space and then translate their x,y,z coordinates to properly position the viewport sprites. Collisions, behaviors etc. are solely done via controller sprites (which are set to invisible).

  • You can use a 2D layer on top of the 3D layer, then translate the 3D coordinates to screen coordinates, then use a 3d distance calculation to store the distance from each sprite to camera, then sort the 2d sprite by that value. Additionally, you can use that distance value to scale the sprite according to distance.

    To retrieve the plane coordinates, e.g. screen X coordinate, do something like

    3DCamera.CanvasToLayerX("Viewport", 3DCamera.LayerToCanvasX("Floor", PosX, PosY, PosZ), 3DCamera.LayerToCanvasY("Floor", PosX, PosY, PosZ), 0)

    where "Floor" is the 3D layer, "Viewport" the 2D layer, and the variables PosX, PosY, PosZ is the sprite's x,y and z elevation.

    To get the distance of sprite to camera, use the Pythagorean principle in 3dimensional space, which is distance = square root of (x² +y² +z²), while

    x = abs(sprite.x - camera.x)

    y = abs(sprite.y - camera.y)

    z = abs(sprite.z - camera.z)

  • Having had a look at your project, I'd say with this method you're pretty much out of luck. May I ask if your assets are completely composed of sprites and you only use the engine's 3d features for perspective?

    If so, there may be an alternative.

  • You do not have permission to view this post

  • You do not have permission to view this post