Hello everyone,
I am working on my project but I hit a matter.
Now I want to add number to the existing array, I’ve tried two ways:
Create a new array and add numbers to it (first array has number 0-7, second array I added 8,9,10), it seems work fine but I feel it’s not the optimized way to add numbers and very amatuer.
Should I follow the first way or use other way?
And how I add a range of numbers to array, ex: add a range of numbers from 8 to 20 intead of typing a single number?
And one more question, I want the animations are not duplicated in name (numbers work ok now). Ex: when I add the heart2 to array, I want the heart(1) will not show (it same “heart” word but following by a number “2”), what should I do? I tried the animation by name but just the same name can work.
Thanks!
I trie
Hello v9um,
I made cards show on the screen.
After few hours of work, both solution seem work now, need test more to tell.
I made a small question in there to avoid creating other topic.
I think this matter is out of my knowledge.
I want to show just one of two cards at same time.
The Heart II with animation name: heart2
The Heart with animation name: heart
I different name buy same “heart” word in there. So I’m finding a way to show one of these animations that have same word “heart” in. You can think that Heart II card is replace the Heart card but only in one roll, not replace entirely (It’s easier to use “remove child in array”)
System that shows upgrade cards (assuming the cards are picked randomly). The player picks one card to affect his character, either good or bad.
You have 2 cards about health upgrades, one of them is more helpful than the other (Health lvl1, Health lvl2)
The problem:
The system sometimes picks the same card type (type, as in health upgrade, attack upgrade) but with different levels of effect. In your case, the system picks up Health I, and Health II.
Expected solution
Avoid the system picking up cards of the same type.
Let me know if I understood correctly.
Now my question
May you provide the events of the system, and how it works?
Hi everyone, How can we add a range of numbers to an array, like 8 to 20, without typing each one? Also, how can we make sure only one card, like ‘Heart’ or ‘Heart II,’ shows during a roll?
For creating a random roll without repeat, there are other posts. The general idea is to create an array, shuffle the array, use the last array item and remove the last index so it doesn’t get picked again.
I used a button for testing and a text box to display it.
Hello Keith,
Thanks for rep.
I am using array tool to compare animations in same index(number) to reroll the animations again in random number in array.
I know how to remove child in array but it will remove forever.
I have 2 animations with different name and index(number), i want only one animation will show in 3 cards.
Compare in index (same number) will not duplicate the same card to show.
But I want something like:
If animation named “Heart2” and “Heart” roll at the same time, change (reroll) the animation to just show one of them.
Ex: the Heart card below should show other card. The Heart II card is the higher version of Heart card. If show both card with same function (+ Max HP), it will be something weird (to me).
I’m not entirely sure that I’m understanding your intent. I think I’m still just creating different ways to not repeat a list. I think you want a different thing. My issue is I don’t understand the complete dynamics.
I don’t like the brute force type of logic that requires repeated random numbers because that relies on uncertainty.
You might need a mixed approach.
Use the version with a main list. The default deck.
Copy it to a temp array for the play deck.
Shuffle the deck
Remove the last card (pop) from the temp array
Use your test logic if it matches then draw another card from the temp array and again remove it.
You could use a while event just make sure you also check the size of the deck. It’s easy to create an infinite loop with a while event.
What happens if the 2nd card is also a heart? Does the higher heart replace the lower heart or does the 2nd heart get skipped? Do you get another chance at the higher heart later? Can you discard or otherwise remove cards?
Hi Keith,
I meant there are other version of “Heart” Card, which will add “Max HP” (same function but different value) to my character. Ex: the Heart I(1) will +5 max HP, Heart II(2) + 7 max HP, Heart III(3) + 10 max HP. Only one of these cards should apprear on the display when roll the cards in my upcoming roguelike game.
About not to duplicate the same card (eg: Heart 2 vs Heart 2), I made it in my project. My matter now is when this card show on display, the other card will not. Two cards are different, they’re not the same entirely. they’re just same function to add “Max HP” but different amount of HP to add.
As you said, the higher card will replace the lower card but it will not remove lower card in other roll, the lower card may show on the display in later roll, at this time, the higher card will not show.
My apology, this my first project ever in programming, I’ve never known about programming before. Thus, it may make you guys misunderstand my explaination
About my project, it’s reached about 70%, I am trying to finish the logic of my action roguelike game then polish it.
This is my event that prevent to duplicate the same card (same animation) using array tool. But I’m still finding the way to prevent to display different card (same function) as mentioned above.
It can be difficult to explain a situation. It’s a balancing act. You want to be as brief as possible because if you provide too many details it can be intimidating. Too long; didn’t read.
Your vision might not match our vision. Your way is ultimately the one that matters.
Here’s what I’m imagining. I could be way off base.
A card gets dealt.
It goes to a staging area or dealing area.
There’s a pause.
If the card is unique, it gets added to the hand
If the type exists then it increases the HP of the existing card and the new card is merged or deleted.
If something else happens maybe the card is discarded and another card is dealt.
I often try to imagine how something would work in the real world. Envision the game being played with real cards. How would the mechanics work.
Yes, it’s also difficult for me, I’m trying to finding out like find a needle in the ocean but in scope of Gdvelop engine, I hope the engine can handle my idea, haha. If not, I will find other direction for my card system.
You can play Brotato, my upgrade card system is inspired from it. In the game, it would never show same function card when level up or reroll.
Each upgrade has 4 tiers with same function card but different “add (+) value”.
GD comes across as simplistic but that’s what I Iove about it. I love that it’s neatly organized. Some of the other apps break things up. Some require a bunch of different files. I love that GD manages it for the most part.
Instances and groups can really simplify things. As you advance, you can create your own functions, extensions, behaviors and custom objects like sliders which are a collection of objects and code. They’re a bit like a scene with in a scene. It can help to move events into extensions or external events. It makes it easier to debug and gets rid if repetition. Although , I’ve never cared for external events. There’s also external layouts. There are a ton of extensions and behaviors. You can even use Javascript.
Yes, at least in 1 month I tried it, I’ve not hit any serious bug. The Engine helps to build a prototype very quick and also helps me know how game logic is. I’ve never thought I can build my current game like this.
The cons of GD is it only uses single thread (tested in both build and preview) so you have to optimize your project to prevent dropping heavily in performance and you cant capture via built-in recorder of Nvidia or AMD driver, you have to use OBS window mode or desktop mode due to WebGL.