Cards and endless swiping

Not favoritedFavorited Favorited 1 favourites
  • 4 posts
From the Asset Store
TCG Game Template
$6.50 USD
50% off
Create your own trading card game with this Fantasy TCG Card Template
  • Hello everyone! I've been stuck on a very difficult task for 2 weeks now. The task is to make the ability to swipe cards infinitely, bind them to an array, and implement the structure of the cards themselves in an optimized and competent manner.

    I'll describe how I implemented it so that you roughly understand:

    I have a card, which consists of a Background. Text. Background image and image. These are 4 elements. Each of them has a local variable id. The text is the same for all projects, so I added a local variable tag and id and attach the text to the card with the tag "Card_Text".

    Each ID is attached to each other. That is, the image with ID 6 is attached to card number 6.

    Image with ID 3 is attached to the background of card number 3, etc.

    I don't know anymore how correct this system is. But containers and families look much worse in my opinion. I don't know. For example, you can't even insert text into a family. And containers are generally unclear how they work and there is no point.

    Next, the essence of cards is that they can be moved, and at the same time you can select the one you need by drag and drop. But since there can be more than 1000 values ​​in the array (the array is the inventory of cards). Then I can’t add 1000 cards to the screen, etc. Where each will have 4 elements, this is already 4000 objects, etc. That’s why I came up with an endless swipe, where a card moved to the left will move to the right. and vice versa, when swiping to the right, the card on the right will move to the left. Thus, there will be an endless swipe, plus with the help of a mask and an overlay effect, I will make the card appear in an invisible zone.

    The main problem with this system is that when teleporting a card, I try to change its ID so that it is as if next on the list and changes. But the OBJECTS that are in it, the background, the text, etc. -> they change the ID to a completely different one. Although when teleporting, I give everyone -5 or +5 to the ID. Because there are only 5 cards. And it turns out that everything is going in disarray, where the object ID is -15, the background ID is 5, the text ID is -10, etc. I don’t understand why, because the teleportation function is activated once and for them at the same time. A very stupid system that I’m stuck on.

    Also, I can’t make a system that these cards need to be dragged onto the table. After all, we can take them and move them higher, but the swipe will still work, and it turns out that when you swipe, the card you’re holding will move, and it will also change its ID if teleportation works on it. Even if you put it on the table to make it inactive, it can still change its ID.

    Also, after that, if I move a card to the table (to the center of the screen), then this card should automatically replace its ID with another one from below. Otherwise, they can be duplicated endlessly. This is also a minus. For example, I don’t understand how to implement all this.

    I have never seen such a complex system in Construct 3. With my 5 years of experience, I don’t understand anything. What is connected with swipes, cards, and endless systems.

    In general, my nerves are already giving out. A lot of problems and loss of motivation. I need help. Please try to explain how to implement such a system. How this system works in other games. And what I need to do. Maybe everything will be done with 2-3 variables, and not 10 like mine... I need optimization and freedom of implementation. Simplicity and ease.. I don't understand.. friends..

    I am attaching screenshots of my crooked system.

  • I don't know anymore how correct this system is. But containers and families look much worse in my opinion

    What you need here is a hierarchy. Add other objects (texts, images) as children to the main Card sprite. They will move together as one unit, and you can pick child objects in events. And it's a lot easier than linking them by ID.

    Then I can’t add 1000 cards to the screen, etc. Where each will have 4 elements, this is already 4000 objects, etc.

    It’s not that bad. Construct can easily handle tens of thousands objects. As long as you keep most of them off-screen, you're not moving all 4000 objects at once, and you’re not updating them every tick, the performance impact should be minimal.

    Another option is to destroy cards once they’re swiped away and create new ones as needed. That approach should be easier than trying to recycle them.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • > I don't know anymore how correct this system is. But containers and families look much worse in my opinion

    What you need here is a hierarchy. Add other objects (texts, images) as children to the main Card sprite. They will move together as one unit, and you can pick child objects in events. And it's a lot easier than linking them by ID.

    > Then I can’t add 1000 cards to the screen, etc. Where each will have 4 elements, this is already 4000 objects, etc.

    It’s not that bad. Construct can easily handle tens of thousands objects. As long as you keep most of them off-screen, you're not moving all 4000 objects at once, and you’re not updating them every tick, the performance impact should be minimal.

    Another option is to destroy cards once they’re swiped away and create new ones as needed. That approach should be easier than trying to recycle them.

    So, I studied the hierarchy in more detail and made cards using them. Yes, it worked. Everyone has the same ID and it's much easier to move them now.

    For now, I left the endless swipe that moves the card from the beginning to the end. And I change their IDs. So far, everything is correct, but I want to study more and wait for pitfalls

    In any case, thank you very much. The hierarchy has already solved 50% the problem.

  • Everyone has the same ID and it's much easier to move them now.

    You only need the ID variable on the parent Card sprite. All children objects are already linked to the Card and can be picked using "Card pick children" condition.

Jump to:
Active Users
There are 0 visitors browsing this topic (0 users and 0 guests)