MikaelS's Recent Forum Activity

  • I am experimenting with the Multiplayer plugin but as far as I can tell, the On kicked event never triggers on the peer side when the peer is manually kicked by the host using Multiplayer Kick peer (it does trigger if the host leaves though).

    The background is that I allow an unlimited number of peers to connect to the room. The host is able to lock and unlock the room dynamically, and admission of new peers is controlled using this code on the host side:

    On the peer side, I want to detect if the peer was kicked. This is done using this code:

    On the host side, the code works as intended and the peer isn't allowed to join, but on the peer side, the On kicked event apparently isn't triggered. As a workaround, I am sending a message (tagged as Game Locked) from the host, but I would have guessed that this should have been unnecessary.

    Just in case, I have also tried waiting for up to several seconds before kicking the peer, but the event is still not triggered on the peer side.

    Am I doing something wrong or is this a bug?

    (Edited to more clearly explain that the On kicked event does trigger when the host leaves, but not when the peer is kicked manually)

  • I intend to use (local) boolean variables to keep some intermediate results from a number of calculations, but can't find how to set the value of the local variables that I want to use. I can't use System->Set value, since the boolean local variables aren't shown in the variable drop down list. I can't use System->Set boolean either, since then I am ony allowed to choose between True and False and can't enter an expression which is what I want.

    How should I do this? Most likely I am missing something simple!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks for your answers. I realized that I had overcomplicated things and was able to make it work. Construct is amazing, but it takes some time to get used to it!

  • I am new to Construct 2 but not to programming. As a small test, I have implemented "zoom towards mouse pointer" like in Google Maps.

    As target for the zoom, I use a Sprite. Since I want to be able to change this sprite dynamically, to a sprite with a different size and different aspect ratio, I have set the layout size to a very big value and handle scale limiting when zooming out myself. As far as I have found out, it is impossible to change the size of the layout itself at runtime.

    When the user zooms out using th emouse wheel, the layer scale of the sprite is changed, and ViewportLeft, -Right, -Top and -Bottom are used to detect if any edge of the sprite is inside the visible area. In that case, scrollx and scrolly are adjusted accordingly.

    Sooner or later when zooming out, both the opposite sides of the sprite become visible, and therefore, a minimum scale (maximum zoom out) that can be allowed has to be calculated. I do this by dividing Browser.ScreenWidth by the width of the sprite. I then do the same for height and choose the maximum value as the limit. All this works fine, as long as the browser covers the entire screen.

    However, if the user resizes the browser, the above scale limit calculation stops working. The problem here is that the browser itself (I have tested with Google Chrome) automatically scales the contents when the browser window is resized. This automatic scaling breaks the calculation and I have found no way to handle this.

    I can see three different solutions:

    • somehow find the automatic scale change and compensate for this mathematically (best),
    • somehow stop the browser from scaling the contents automatically (acceptable),
    • somehow prevent the user from resizing the browser window (worst).

    Can anyone suggest how this could be done, or if there are better ways to do it? Is it possible to determine the value of the automatic scaling that the browser applies?

    Thanks in advance,

    Mikael

MikaelS's avatar

MikaelS

Early Adopter

Member since 21 Feb, 2017

None one is following MikaelS yet!

Trophy Case

  • 7-Year Club
  • RTFM Read the fabulous manual
  • Email Verified

Progress

9/44
How to earn trophies