788578's Forum Posts

  • 6 posts
  • > Thanks for the reply! Let me be a bit more specific:

    >

    > I have a dictionary containing in-game currencies. I'd like to use a text object to show these currencies.

    >

    > When adding a new currency to the dictionary, I'd like to add its CurrentKey and CurrentValue to the text object.

    > If the text object already has such key, I'd like it to only add its CurrentValue.

    >

    > I hope this makes sense, I'm pretty stuck at this and it might be a suboptimal approach. If you have a better method I'm all ears.

    >

    > Thanks again.

    Instead of checking the Txt object if has the key you need to keep track of the Printed (Keys & Values), for this, I will just check if the Key exists will be much easier:

    Example:

    On Currency Check:

    --------- Dictionary has Key?

    -----------------If Yes: add the value to the existing value in the dictionary and then clear the Txt to Print all currency (Key & Values) again

    ----------------- Else Key Doesn't Exist: add the new (Key and Value) to the dictionary then Update the Txt object with a new line and print the new (Key & Value)

    This is so to avoid updating every tick the Txt object

    Thanks tarek! I figured it out :)

  • Thanks for the reply! Let me be a bit more specific:

    I have a dictionary containing in-game currencies. I'd like to use a text object to show these currencies.

    When adding a new currency to the dictionary, I'd like to add its CurrentKey and CurrentValue to the text object.

    If the text object already has such key, I'd like it to only add its CurrentValue.

    I hope this makes sense, I'm pretty stuck at this and it might be a suboptimal approach. If you have a better method I'm all ears.

    Thanks again.

  • I have a simple item pickup on collision. The item is added to a dictionary. I'm now trying to have a text object "read" that dictionary. That is, adding/removing CurrentKey, CurrentValue and newline for each key. Any help is appreciated!

  • Hi, try this: Textarea SetText -> Textarea.Text & newline & "TextYouWantToAppend"

    or if You want to put the fresh message to the first line, then:

    Textarea SetText -> "TextYouWantToAppend" & newline & Textarea.Text

    Hope this helps

    Yes, that's exactly what I had in mind, thank you for your time!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I've searched a bit for a solution to this; I'm trying to design a event/combat log for my game and need to be able to append (add) text when new things happens ingame.

    However, the problem is that the textarea object only has "set text", which removes the current text when I'd like it to stay, and have the new text added in the bottom.

    How should I approach this problem? Any solutions appreciated!

  • First of all, let me thank the devs and supporters of C2 for a brilliant product and awesome resources in the forums. I'm completely new at the coding part and I'm slowly trying to learn the ropes.

    Here's what I'm trying to achieve in my 2d platformer:

    1: Pin weapon sprite to player and have its mouse aim angle limited to between 300? and 60?, facing the direction of the player (left/right). Whenever outside the angles it should simply not turn further.

    2: Have player and weapon turn whenever the mouse is opposite current facing direction (eg. left/right).

    imgur.com/PEqR4RI

    I sort of understand different ways to approach this, but the solutions I come up with seem bloated and hacky, with the gun acting all wonky. I was hoping that I could get some samples or assistance to look at.

    Thanks!

  • 6 posts