MikaelS's Forum Posts

  • In that case I just have to enable the buttons. Thanks!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • First, thanks for a great product!

    I was planning to use a number of button/dialog pairs to work kind of like a tab view, with each button first closing any open dialogs and then opening its own dialog (tab). However, the non-modal dialogs block access to the buttons, thereby preventing this to work. Is this by design or is it a bug? I would have expected only modal dialogs to block everything outside the dialog.

  • I'd like to control the led light of a mobile phone from Construct 3, in order to take pictures using the User Media plugin in darkness. Is it possible? I can find no expressions for this and I have searched both the User Media plugin and other plugins without success.

    Tagged:

  • Yes, I didn't understand that. Strange.

    However, I have now implemented your other solution using movement and scaling with events. This works as expected. The only problem now is that I have been mixing sprites and tilemaps on different elevations to create my map. Basically, I have used tilemaps for floors and sprites for walls, creatures and objects. With Construct 3's z elevation this wasn't a problem, but since tilemaps can't be scaled I don't think they can't be put on different elevations using events, at least not easily. Also, z-sorting tilemaps and sprites together seems to be difficult to achieve using events.

    Painting the tilemaps onto DrawingCanvases would solve the scaling issue, but not the z sorting issue. Z-sorting would be solved if DrawingCanvases could be put into the same family as sprites, and the family then being z sorted, but mixed families aren't allowed, as far as i know. I will have to think about this some more. Perhaps I will have to convert everyting to sprites instead.

    Anyway, thanks a lot for your help!

  • Thanks for the new example. I might use that method instead.

    However, I would really like to understand why I can't get DrawingCanvas to work. I have attached a new example with only six sprites and two groups, one with z elevation and one without. There is no scrolling at the moment. How much the DrawingCanvas should be translated to the right side is controlled by the global variable Movement. Apart from that, I use exactly the same events as in your first example.

    For both groups, a Movement value of zero works as expected.

    For neither group, a Movement value other than zero works. There is no translation, and I don't understand why.

    https://1drv.ms/u/s!AmzKqSRFlvJqa9elDEImSJco0ho

  • I have been doing some more experimenting. If the same events are triggered from a keypress, I get exactly the same result as before, but by adding a small wait, it works as expected:

    Wait 0 is not enough.

    According to the manual, pasting an object happens at the end of the tick, which I assume is why the wait solves the problem. However, I don't understand why dop2000's example is working and mine isn't.

  • dop2000, I tried to modify your example to use it in my project, but I can't get it to work. The sprites with no z elevation don't move at all, and those with a higher z elevation move in the wrong direction and the wrong distance too. I center the canvas on the screen, draw the objects and then move the canvas 400 pixels to the right. Could you take a look and see what I am doing wrong:

    https://1drv.ms/u/s!AmzKqSRFlvJqatvdb2fUk57-FzY?e=huqyw4

    Thanks!

  • I think I will try something similar to your DrawingCanvas example. That seems to be exactly what I need. Thanks!

  • I am trying to use z elevation on a layout that is divided in two parts, one status window on the left side and a top-down view of the game to the right. The status window is on one layer with 0% parallax and the top down view is on another layer with 100% parallax. Both have an approximately equal width.

    Now I would like to use z elevation on the top down view to make it more interesting when scrolling. This works partially, but since the center of the top down view is not at the center of the layout, the objects aren't moving as expected when the top down view is scrolled. Instead of moving relative to the center of the top down view, they are moving relative to the center of the layout.

    Is it possible to set the position of the focus of the z elevation camera to a point other than the layout center?

    Tagged:

  • Of course! I have now changed the wait statement and the progress bar updates as it should. Thanks!

  • It turns out that I was mistaken. My code doesn't work fine with large arrays. These are my events (CurrentColumn is a local static number defined above):

    With the wait statement in event 32 enabled, Construct just goes through the Array very fast, but the entire loop ends before everything is actually loaded. It doesn't seem to wait the 0,5 seconds per CurrentColumn. With the wait statement disabled, the Array eventually loads as intended and the browser prints log messages during the loop, but Chrome says that the page is not responding and the progress bar is not updated during the loop.

    I am using this to load a very large csv file, exported from Tiled and containing 400 times 400 tiles, so the calculation of each row takes quite some time, up to 1.5 seconds. I have tried with different wait times, up to two seconds, but without success. I guess that I am doing some obvious mistake here, but can't figure out what it is.

  • Thanks for the answer and the example! I have changed my code accordingly and now it works fine.

  • I am iterating through a very large array using For each element. Because of the size of the array and the calculations done to its contents this takes a long time, and I would like to show some kind of progress to the user during the calculations. The problem is that For each element locks the operations. Neither setting a text nor logging to the browser works within the iteration. I've tried other ways, like inserting a wait statement or updating a global variable which is shown from another event, but without success.

    How can I show how far the iteration has gone during a For each element event?

    Tagged:

  • I am using the custom movement behaviour to move a sprite. The player can drag the sprite, and when it is released, it starts slowing down using the tween behaviour to reduce the speed of the custom movement until the sprite stops completely. This works fine.

    Under some circumstances, I want to restrict the position of the sprite and stop it immediately if it passes outside certain x and y coordinates. For this I use the linear stepping mode of the custom movement behaviour with the step size set to 1 pixel. On each step (using the On Custom Step event), I compare the position of the sprite to the limits and sets its speed to 0 as soon as it passes outside these borders. This, however, does not work.

    Apparently the custom movement uses the same speed for all steps during one tick, even if the speed is changed during one of the steps. Is this a bug or the intended behaviour? In my opinion, it makes the use of multiple steps per tick a bit less useful. Of course, it can still be used for pushing out of a solid, but it prevents other ways of using this behaviour for pixel perfect movement.

  • AllanR

    Thanks a lot for the answer and the fantastic example. The reason that I was pasting the hexes to the canvas instead of using them directly was that I had imagined that having thousands of sprites as tiles would be a performance problem. However, this was not the case, and I am now using animated hexes for the map and still have 60 FPS.

    Thanks!