I have a script that selects 4 cards (named #1-10 and first letter of suit) from a deck and moves them to 4 points… The script works perfectly outside of BGE, but the game never refreshes when running. The screen glitches a moment but nothing moves, but when the game stops, the cards are even there.
Blender.Redraw() doesn’t work… what am I doing wrong?
import Blender as B
import random as rand
deck_loc = (0.0,-10.0,0.0)
suit = {"d":"Diamonds", "s":"Spades", "h":"Hearts", "c":"Clubs"}
switch_suit = {"d":"s", "s":"h","h":"c","c":"d"}
suit_number = {"1":"d","2":"s","3":"h","4":"c"}
object = B.Object.Get
############moves cards to start
for j in range (1,11) :
card_num = str(j)
for k in range (1,5) :
card_suit = suit_number [str(k)]
card_ob = object(card_num + card_suit)
card_ob.loc = deck_loc
###########chooses random number from 1-10 for each card "pt.x"
for i in range (11,15) :
s = str(i)
pt = object("pt." + s.zfill(3))
rand_num = str(rand.randint(1, 10))
rand_suit = str(rand.sample(["d","s","h","c"],1)).strip("'[]")
############change suit for duples
card_choice = object(rand_num + rand_suit)
while card_choice.loc != deck_loc:
rand_suit = switch_suit[rand_suit]
card_choice = object(rand_num + rand_suit)
card_choice.loc = pt.loc
B.Redraw(-1)