dop2000's Forum Posts

  • Yes, System -> Wait

  • Why do you pick by lowest value?? Use "ItemIcon compare variable" condition:

    ItemIcon compare variable InvX=ItemPosition.CurX
    ItemIcon compare variable InvY=ItemPosition.CurY
    

    And, as I mentioned earlier, when using "For each element" loop you need the way to stop it. Otherwise it will update all slots with "Nothing" value.

    It would've been a lot faster if you could just share your project file.

  • How hard is it for someone, who has 0 programming experience to add multiplayer to my game?

    It's going to be hard. I suggest studying the official multiplayer examples and this tutorial:

    construct.net/en/tutorials/multiplayer-tutorial-concepts-579

    It's for Construct 2, but most things will still be relevant.

  • You need to pick the correct ItemIcon instance, corresponding to the array element. Without picking, the animation will change for all ItemIcon instances.

    When ItemIcon sprites are created, give them two instance variables - invX and invY.

    Set invX to ItemPosition.CurX
    Set invY to ItemPosition.CurY
    

    Then, when an item is picked up and you found an empty slot, you can pick ItemIcon instance by invX and invY.

    Also, if I undertand correctly, your inventory array has 4 rows and 8 columns. So you need to use "For each XY element" loop. (not "For each X")

  • Is it possible to add text to a sprite inside of the editor screen, or do I actually need this separate sprite text layer on top of it as a separate item?

    You need to add a text object on top of the button sprite, yes. You can add them to a hierarchy, then the text will scale with the button, move with the button etc.

    And also, what is preventing this layer 2 from appearing when I click on the button (while obviously hovering over it too)?

    That's why I suggested to use a different animation when the button is clicked. Something like this:

    Button set animation to "clicked"
    Wait 0.1 seconds
    Button set animation to "idle"
    

    Then changing animation frame will have no effect.

  • You do not have permission to view this post

  • You need to show the code, the entire event.

  • Several options:

    1. Use Button object and style it with CSS. But this is not a good choice for many games, because HTML elements are rendered above the canvas (or will require a special HTML layer), can "steal" mouse focus and have a few other annoying quirks.

    2. Use a sprite with several frames or animations. If mouse cursor over the sprite -> Set frame 1, Else set frame 0. On sprite clicked -> Set animation "clicked" and so on.

    3. Use an addon like ProUI. (also not recommended unless you require lots of other UI controls)

  • Then you need to show the code where the inventory screen is updated after picking up an item.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • So you are storing "name,quantity" strings! Then ignore what I said about writing them to different cells.

    I don't see anything wrong on your screenshots.

    What is the problem again? The icon is not updated when you add an item to the inventory?

  • It must be a different issue. You need to share a new screenshot or your project file.

  • Loopindex expression only works with System loops. When using Array For Each Element loop, you need Array.CurValue, Array.CurX and Array.CurY expressions.

    Also, if your array is 2D, then you probably need to store item name and item quantity in separate cells. Your current code tries to write them into one cell as a string:

    "Axe,2"

    Stop Loop action also won't work with this loop. You will need another way to stop it, for example reset the item quantity.

    So the correct code should look like this:

    For Each X element
    Array.CurValue="Nothing"
    Item.quantity>0
     : Array set at (Self.CurX, 0) to Item.name
     : Array set at (Self.CurX, 1) to Item.quantity
     : Item set quantity to 0
     : Item destroy
  • You can try turning pixel rounding off, and round them manually with events.

    For example, when the character stops, set its position to round(self.x), round(self.y)

    Same for the camera - make sure its coordinates are always integer when it's not moving.

  • For example enemyA and enemyB would have the same health and damage

    Not necessarily. The way it's usually done is you add a repository layout where you put one instance of each object - it will be the default instance. Every new instance you create in the editor or in runtime will be copied from that default instance.

    So you can place all enemies and friendlies on that repository layout and configure different hp/damage values for them.