I have this game over scene that is presented by the main scene. When the player runs out of money I can get the main scene to fade out and the game over scene to present but it does not fade from 0 to the maximum alpha. I also have an issue on the main screen where only some things are fading. I have a main node and then a card node. Most everything fades in as the game starts but the cards are still on the table. When the game is over I would like everything including the cards to fade away on the table. I should be able to figure this out but I must be missing something.
Here is the code for the GameOver seen that I’m having trouble fading the alpha.
The later is The section of code that fades most of the stuff but not the cards on the main scene.
class GameOver(Scene):
def setup(self):
#self.main.wooden_border()
self.go_node = Node(parent=self)
self.go_node.alpha=0
self.bg_color = SpriteNode(
color='#477148',
position=(self.size.w/2, self.size.h/2),
size=(self.size.w, self.size.h))
self.game_over = SpriteNode(
'GameOver.PNG',
position=(self.size.w/2, self.size.h/2),
parent=self.go_node)
self.new_game = SpriteNode(
'StartNewGame.PNG',
position=(self.size.w/2, self.size.h/2 * 0.33),
scale=0.25,
parent=self.go_node)
self.go_node.run_action(A.fade_to(1, 4))
Main screen code
if self.bankroll_amount == 0 and self.stake_amount == 0:
self.card_node.run_action(A.fade_to(0, 1))
self.main_node.run_action(A.fade_to(0, 1))
go = GameOver()
go.main = self
self.present_modal_scene(go)