Cameron9990's Recent Forum Activity

  • Is there a way to without having the objects pre-loaded in, to spawn one copy of every object in a given family? I figure it'll save on space... I think...

  • Without the rest of your project it's impossible to help you.

    Test with only 1 or 2 cards, run in debug mode, check all instances, variables and the contents of the dictionary. And you will probably figure it out.

    No you're correct, you're good with this stuff so I knew that if you couldn't tell by looking at the code of them spawning, then it was something else entirely. Since they spawn in at a larger size for a fraction of a second, they spawn in overlapping something that I gave different properties to for overlapping cards. I can't believe I didn't think about that, sorry.

  • Check InDeck variable of all cards in the debugger. Maybe it's 0 for some cards.

    As I mentioned before, referencing cards by UID in the dictionary is a bad idea. Their UIDs may change if you switch to another layout, or restart the layout.

    it's not 0, it's showing the correct number in deck, it's just spawning 1 less of the first card picked. like if there's two, three, or four, it still spawns some, just one less than it's supposed to for specifically the first card. And also only if more than one card spawns, if it's just the one it spawns perfectly fine. Also, I tried switching it to be set by an instance variable attached to the cards and that didn't remotely work. Dictionary.get(str(Cards.InDeck))

  • You'll see what I mean by the example, I tried adding "s but obviously that just changed it to the words

    Tagged:

  • The bottom code is the code I just added, for some reason it spawns one less copy of the first object picked, but only if more than one object is being spawned (if it's just the one card it still spawns it). I've tried adding a delay and it does the same thing. I went into debug to confirm it wasn't the sorter being dumb and overlapping stuff, can confirm, it spawns one less. Not really sure why or how to fix it.

  • As I explained in another post, you need to pick that second card instance. If you want to do this in the same event, you have to use "Pick all" condition. Another option is to call a function.

    OOOOHHHH, I never thought about using local variables. I see. And sorry, I asked on the other after this because nobody had an answer after a long time and you're very knowledgeable. :)

  • Everything is possible. You just need to pick that other instance of the same object or family. You can use "System Pick All":

    > On Card clicked
    Card compare variable code="A"
    ... Pick all Card
    ... Card compare variable code="B" : Card set variable price to 100
    

    or call a function:

    > On Card clicked
    Card compare variable code="A" : Call function UpdateAnotherCard(Code: "B")
    
    On Function UpdateAnotherCard
    .....
    
    

    I uhh... don't think I did it right. Keeps picking the wrong card.

  • Try adding "For each Cards" condition to that event.

    Also, why are you using UIDs as key names? UID is not a reliable identifier. If cards are created in runtime, their UIDs may be different every time the game or layout is restarted.

    If you are placing cards manually in the layout editor, their UIDs will stay the same until the card is destroyed. Still I suggest using an instance variable as a unique card ID.

    I did UID because that's what the other guy suggested. Also... is there literally any way to interact with other copies of the same object in a family? Like if I click on an object it'll change the variable of another of the same object?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Like I want it to where whenever you either left click one of the objects on the left, it deletes itself and lowers the variable of the one on the right, or whenever you right click the ones on the right, it lowers the variable of how many are in then deletes one of the ones on the left. Either one works, or preferably both.

  • > Exact same way I did it for Cards.GetObjectType only that one didn't need to start with str()

    The code on your screenshot works fine for me.

    Are you using "Set key" or "Add key" action? Use "Add key", because "Set key" only works if the key already exists.

    Well now that that's working, I'm trying to make a number variable equal to this, it there a way to recall it and turn it back into a number? Like on start of layout set "number" to dictionary.get(str(Cards.UID)) I just don't think it's converting to a number so it's staying 0 since str is in it, is there a way to fix that?

    If it's not that then I'm confused.

    The first one is changing the value, the second one isn't.

  • > Exact same way I did it for Cards.GetObjectType only that one didn't need to start with str()

    The code on your screenshot works fine for me.

    Are you using "Set key" or "Add key" action? Use "Add key", because "Set key" only works if the key already exists.

    I... I could of sworn I hit copy and paste and then tweaked the words... I'm not sure why it was "set key", you are absolutely correct. Thank you for the clarification.

  • I think we may be talking about different things at this point. I was talking about something along the lines of:

    Mykey = str(sprite.uid)

    Dictionary: add key mykey with value dictionary.get(mykey)+1

    But I may have misunderstood what was being asked.

    Exact same way I did it for Cards.GetObjectType only that one didn't need to start with str()

Cameron9990's avatar

Cameron9990

Member since 2 Feb, 2019

Twitter
Cameron9990 has 1 followers

Trophy Case

  • 6-Year Club
  • Forum Contributor Made 100 posts in the forums
  • Regular Visitor Visited Construct.net 7 days in a row
  • RTFM Read the fabulous manual
  • Email Verified

Progress

10/44
How to earn trophies