blackhornet's Forum Posts

  • I've done this quickly, so there may be some missing cases. I also altered your health icons to 0-speed. You can also get away with just one heart object, not three, but that won't affect performance much.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Problem Description

    Coding error

    Attach a Capx

    function getListRoomAt(roomList, i)

    {

    if (!roomList)

    return null;

    i = Math.floor(i);

    if (i < 0 || i >= roomList.length)

    return nul; <------------------------------------

    return roomList;

    };

    Description of Capx

    Steps to Reproduce Bug

    • Call Multiplayer.ListRoomName with a bad index

    Observed Result

    I ended up getting an empty list (which may be another issue), and accidentally passed a bad index (-1). Game crashed referencing the bad "nul" line.

    Expected Result

    return null;

    Affected Browsers

    • Chrome: (YES/NO)
    • FireFox: (YES/NO)
    • Internet Explorer: (YES/NO)

    Operating System and Service Pack

    N/A

    Construct 2 Version ID

    169

  • I was going to comment on this on your other thread, but couldn't actually prove this causes lag, however, there is no good reason to test this every tick. You know exactly when the health value goes up or down, so call a function at that point that processes this code. That is ultimately more efficient.

  • It's your style sheet: background-color

  • Layer opacity, visibility???

  • Check your layers. Layer 0 should have Transparent set to No. All others are (typically) Yes, unless you changed this on purpose.

  • You use ret.set_int() with 0 or 1.

  • Astrosus PM'd me about making the game use AutoJoin. This is a very quick reworking to support AutoJoin. A new global variable has been added to eLogin: IsAutoJoin, set to 1. A new group was added: AutoMainRoom. Button:on clicked now checks for IsAutoJoin and activates AutoMainRoom & connects to the signalling server.

    I make no claims on robustness for this version. It is what it is.

  • It's a bit of a tricky concept, but run the example included. You'll see three squares. The red and yellow are on the same layer (0), blue is on a different layer (1) with parallax of 50,50. The coordinates of each are displayed at the bottom. Use the arrow keys to move the red square.

    If you move the red square a little bit, only the Red coordinates change, as you'd expect. But as you move further right or down, you'll see two things on the Blue coordinates. The first pair never move, as there is no movement being applied to the blue square, but clearly the blue square is moving on the screen. That's because the parallax calculation is coming into play and making the layer that Blue is on appear to move. The second coordinates are the coordinates of the blue square according to layer 0. They move, as they are showing the location of the blue square according to layer 0.

    When you need to calculate locations between two layers, you need to account for this. That is what the CanvasToLayer and LayerToCanvas expressions help with. You convert from the layer to the canvas, which is the global coordinate system, and then back to the layer you care about.

  • RE: "also": no. You'd have to have 15 checks - that's the problem. You'd need to do everything 15 times. You can do it in one.

  • That is dealt with by using different animation frames for each.

  • This isn't the way to do this. Use a single object and either use a different frame for each, if they display a number, or give it an instance variable with the number you care about. The frame number or instance variable then tells you which is which.

  • eli0s has just described exactly what I was suggesting is the problem. You've got to get the coordinates all relative to the same layer.

  • You might need to take the layer/parallax into consideration. Look at the Mouse manual page: https://www.scirra.com/manual/114/mouse regarding X("layer"), Y("layer")