InadequateChris's Forum Posts

  • Hey all,

    I've got a Multiplayer game with one Host and one Peer. The characters are moved around by the HeroBase object.

    With the code below, the conditions are met when a player moves within a certain range of a Puzzle object. It works as expected when one player is within range, but when both are in that area, the "Trigger Once While True" seems to get ignored, and the conditions get met every tick.

    Does anyone know why this is, please? Am I doing this the right way?

    + System: For each HeroBase
    + Hero: associatedPlayer = HeroBase.associatedPlayer
    + Puzzle: Pick nearest to (HeroBase.X, HeroBase.Y)
    --------+ Hero: X ≥ Puzzle.X - 200
    --------+ Hero: X ≤ Puzzle.X + 200
    --------+ System: Trigger once
    ---------> testText: Set text to Self.Text & "1"
    
  • Thanks very much for your help, you two. Being new, it helped me experiment with a few features and techniques I hadn't before, and I've learned a lot.

  • Hello,

    I have some drag-and-drop objects I'd like to keep within the confines of an irregular shape. Is there a way to contain it in the shape using clamp? My understanding is that only square or rectangular shapes can be set for that, but please correct me if that's not true. Or are there better methods for achieving this?

  • Thanks for the response, oosyrag. I did a bit of further experimentation and it seems it was because I was using a tween that had Destroy On Complete set to True. When I just use a normal Destroy action, it works. Is this the expected behaviour? I'd have thought that a Destroy would work regardless.

  • Hello,

    I'm destroying a synced object on the host's side, and my assumption was that it would automatically disappear on the peer's side when that happened. The object does seem to get destroyed because it freezes on the spot and it no longer appears in an object count, but the sprite remains on-screen.

    I've tried all sorts of things like sending a message to the peer to destroy it from their side, but that doesn't work either.

    Does anyone know the correct way to make it disappear for the peer please?

  • You can have a second family with the same objects.

    That worked a treat, thanks blackhornet.

    The code I ended up using was this:

    + Box: Platform has wall to left
    ----+ Box: Is overlapping BoxCollision at offset (-2, 0)
    -----> Box: Set boxToLeft to BoxCollision.UID
    
  • Hi,

    I have some Boxes that the player can move left or right. When a Box (a) is moved up against another one (b), I'd like to store (b)'s UID in (a)'s boxToLeft Instance Variable.

    The problem is that I'm not sure how to select (b) when the Family type is the same. Here's what I'm doing at the moment and it's obviously not working:

    + Box: Platform has wall to left
    ----+ Box: Is overlapping Box
    -----> Box: Set boxToLeft to Box.UID
    -----> testText: Set text to "BINGO BANGO!"
    

    Any help appreciated, thanks!

  • Thanks guys, I hadn't heard of the Canvas To Layer function before. After a bit of digging I've got it working using this code:

    -> inventoryItem: Set position to (CanvasToLayerX("UI", LayerToCanvasX("Characters", inventoryItem.X, inventoryItem.Y), LayerToCanvasY("Characters", inventoryItem.X, inventoryItem.Y)), CanvasToLayerY("UI", LayerToCanvasX("Characters", inventoryItem.X, inventoryItem.Y), LayerToCanvasY("Characters", inventoryItem.X, inventoryItem.Y)))

    -> inventoryItem: Move to layer "UI"

  • I do, but I'm not sure how I'd apply it in this particular problem.

    My best guess so far has been:

    -> inventoryItem: Move to layer "UI"

    -> inventoryItem: Set position to (Self.X - LayerParallaxX("Background"), Self.Y - LayerParallaxY("Background"))

    I'm aware there are no percentages here, just stuck as to how I'd use them!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hello!

    I have an object on a parallax layer, and when I move it to a layer that has no parallax, it (of course) suddenly changes position due to the layers behaving differently.

    Is there a way to get it on to the non-parallax layer that maintains its on-screen position, please?

  • My apologies for bumping this - does anyone know how to 'move along' a column in an array and get the value from it?

  • Hi mrcgkh. Thanks for the help!

    Is there a way to do this without instance variables? I'm pre-populating the Array in the Array Editor with all the necessary information.

    I thought it might be as easy as finding the row containing the name, then moving across a column in the array.

  • I have an array of inventory items. The first column in the array is the item name, the second column contains a description of the item.

    I'm trying to show the description of the item when the player puts their cursor over the item. FOr some reason it's producing "1" in the text box rather than the value of the element. Where am I going wrong here please?

    + Mouse: Cursor is over inventoryItem
    + System: Trigger once
    ----+ itemList: For each XY element
    --------+ itemList: Current value = inventoryItem.ObjectTypeName
    ------------+ itemList: Value at itemList.CurX + 1 ≠ ""
    -------------> testText: Set text to itemList.CurValue
    

    I'm not really sure if I've even gone the best way about this, so if anyone is able to recommend me the best practise for this, I'd really appreciate it.

  • Really helpful, thanks so much!

  • Thanks for all the advice oosyrag, it's really appreciated.

    Alternatively, you don't need to sync animations at all. This could actually be preferred if your game allows for it. Instead of setting animation states based on input, you would set them based on the result instead, locally. This could result in more consistent results in some cases.

    My first thought for this is to send a Message to the Peer when an event happens, and have a listener on the Peer's side that initiates the animation when the Message is received. Is that what you meant by that?

    It's a 2D side scrolling game where the two players share the screen a lot of the time, so it's important the Peer can see the Host's animations rather than seeing them float around.