i used this forum for over two years since i was getting started with RenPy.
Everytime i was stuck in my code, i found the perfect workaround here ^^
But now (stuck for about three weeks ) i'm running in circles and nothing i am figuring out is working.
To my person, i'm 30 years old from germany and no python professional...
I'm working with two friends on some kind of "screenbased Trading Card Game", one is designing and the other is writing the storyline and some kind of plot.
My job is the programmer part.
Routines like "Purchasing a Boosterpack" and "Card Battles" are already finished and working.
NOW COMES THE PROBLEM
I want to create a screen, where you see all your obtained cards, sorted by strengh.
-> Imagebuttons on a grid ...
-> Action when you click on one card ... Screenoverlay where you see the full card and an have the option to level it up
So what is done so far:
- I got a script where i got something like a database. Here are all carddetails written in a label
Code: Select all
label No1:
$ name = "Beispielkarte001"
$ attribut = "Feuer"
$ hp = 100
$ atk = 10
$ grad = "Gewöhnlich"
$ stern = 1
if stern == 1:
$ bild = "Beispielkarte001a.png"
elif stern == 2:
$ bild = "Beispielkarte001b.png"
return
label No2:
$ name = "Beispielkarte002"
$ attribut = "Wasser"
$ hp = 200
$ atk = 20
$ grad = "Gewöhnlich"
$ stern = 1
if stern == 1:
$ bild = "Karte002a.png"
elif stern == 2:
$ bild = "Karte002b.png"
return
Code: Select all
$ count = 0
while count != 11:
$ count += 1
call expression "No"+str(count)
if grad == "Gewöhnlich":
$ gewoehnlich.append(count)
elif grad == "Selten":
$ selten.append(count)
elif grad == "Episch":
$ episch.append(count)
elif grad == "Legendär":
$ legendaer.append(count)
Code: Select all
menu:
"Bronze Kiste":
$ kcount = 0
while kcount != 3:
$ zufall = renpy.random.choice ( ('gewoehnlich', 'gewoehnlich', 'selten') )
if zufall == "gewoehnlich":
$ zufall = renpy.random.choice((gewoehnlich))
elif zufall == "selten":
$ zufall = renpy.random.choice((selten))
$ erhalten.append(zufall)
$ newcard = zufall
call newcard
$ kcount += 1
$ zufall = ""
pass
"Silber Kiste":
$ kcount = 0
while kcount != 4:
$ zufall = renpy.random.choice ( ('gewoehnlich', 'gewoehnlich', 'gewoehnlich', 'selten', 'selten', 'episch') )
if zufall == "gewoehnlich":
$ zufall = renpy.random.choice((gewoehnlich))
elif zufall == "selten":
$ zufall = renpy.random.choice((selten))
elif zufall == "episch":
$ zufall = renpy.random.choice((episch))
$ erhalten.append(zufall)
$ newcard = zufall
call newcard
$ kcount += 1
$ zufall = ""
pass
"Gold Kiste":
$ kcount = 0
while kcount != 5:
$ zufall = renpy.random.choice ( ('selten', 'selten', 'selten', 'episch', 'episch', 'legendaer') )
if zufall == "selten":
$ zufall = renpy.random.choice((selten))
elif zufall == "episch":
$ zufall = renpy.random.choice((episch))
elif zufall == "legendaer":
$ zufall = renpy.random.choice((legendaer))
$ erhalten.append(zufall)
$ newcard = zufall
call newcard
$ kcount += 1
$ zufall = ""
pass
"zurück":
pass
What I want to do now, is creating an array where I store all obtained cards.
"If card == obtained:
append to array"
But i need to give this list the label number like
Code: Select all
call expression "No"+str(count)
In the second step i would fill this array into an other one:
why?
Because i want to sort it like:
"array1.max(strengh).append to array2"
and after that i need to remove the actual index from the array1.
So I would get a loop till the array1 is empty and sorted into array2.
After that i need to fill array2 into some kind of grid with imagebuttons on a screen.
After that is done, placeholders with grey cards should appear in the rest of the grid.
So if you obtain 30 of 100 cards, 30 cards should be displayed as imagebuttons sorted by strengh and after the weakest card the 70 grey not obtained cards should appear.
That system should be easily expanding if more cards come with updates in future.
OMG, hope someone can give me a suggestion by this mess
Sorry for typos and the "not so professional" english.
Please help me.
Best regards
Baseliner