• FLAME130

    Oh, okay thank you. I didn’t want it to exit I just set it to that so I can see the change immediately. Do you have any examples of shape nodes?

    posted in Pythonista read more
  • FLAME130

    Thank you

    posted in Pythonista read more
  • FLAME130

    I’ve looked at the code and I can’t figure out a way to get it to work. I know the code could use a lot of work but can you run it and see if you could get the pipe collision to work? There’s a code at the bottom with a note.

    from scene import *
    import sound
    import random
    import math
    A = Action

    class MyScene (Scene):
    def setup(self):

        self.game_running = False
        
        self.y = 600
    
        self.background_color = '#4a1919'
        
        self.pipes = []
        
        self.score = 0
        
        self.score_label = LabelNode(text='score: 0')
        self.score_label.anchor_point = (0, 0)
        self.score_label.position = (20, 760)
        self.score_label.font = ('Chalkboard SE', 30)
            
        self.frame_counter = 0
    
        self.player = SpriteNode('Untitled 2.PNG')
        self.player.position = (100, self.y)
        self.player.scale = 1.5
        
        self.ground = Node(parent=self)
        x = 0
        
        while x <= self.size.w + 64:
            tile = SpriteNode('plf:Ground_GrassHalf_mid', position=(x, 0))
            
            x += 64
            
            self.ground.add_child(tile)
            
        self.loading_screen = SpriteNode('Screen.PNG')
        self.loading_screen.position = (550, 450)
        self.loading_screen.scale = 1.5
        self.add_child(self.loading_screen)
        
        self.play_button = SpriteNode('Untitled 3.PNG')
        self.play_button.position = (550, 130)
        self.add_child(self.play_button)
    
    def update(self):
    
        for touch in self.touches.values():
            if touch.location in self.play_button.bbox:
                self.play_button.scale = 1.3
                self.game_running = True
        
        if self.game_running == True:
            self.add_child(self.score_label)
            self.add_child(self.player)
            
            self.background_color = '#49c9dc'
            self.loading_screen.remove_from_parent()
            self.play_button.remove_from_parent()
            
            
            if self.player.position.y == 400:
                self.player.position = (self.player.position.x, self.player.position.y - 1)
        
            for touch in self.touches.values():
                self.player.position = (self.player.position.x, self.player.position.y + 25)
                self.player.rotation = 101
            else:
                self.player.postion = (self.player.position.x, self.player.position.y - 10)
        
            if self.player.position.y > 400:
                self.player.position = (self.player.position.x, self.player.position.y - 9)
            elif self.player.position.y < 400:
                self.player.position = (self.player.position.x, self.player.position.y - 10)
                self.player.rotation = 100
            elif self.player.position.y < 300:
                self.player.position = (self.player.position.x, self.player.position.y - 11)
            elif self.player.position.y < 200:
                self.player.position = (self.player.position.x, self.player.position.y - 12)
            elif self.player.position.y < 100:
                self.player.position = (self.player.position.x, self.player.position.y - 13)                
            
            self.frame_counter += 1
    
            if self.frame_counter >= 220:
                self.frame_counter = 0
                new_pipe = SpriteNode('Untitled.PNG')
                new_pipe.scale = 2.5
                new_pipe.position = (1300,random.randint(250, 600))
                self.add_child(new_pipe)
                self.pipes.append(new_pipe)
        
            for new_pipe in (self.pipes):
                new_pipe.position = (new_pipe.position.x - 2, new_pipe.position.y)
                if new_pipe.position.x < -150:
                    new_pipe.remove_from_parent()
                    self.pipes.remove(new_pipe)
                
            for new_pipe in (self.pipes):
                if new_pipe.position.x == 130:
                    sound.play_effect('arcade:Coin_5')
                    self.score += 1
                    self.score_label.text = "score: " + str(self.score)
    

    #this is the part that keep messing up
    if new_pipe.bbox.intersects(self.player.bbox) and new_pipe.position.x <= 130:
    exit()

    if name == 'main':
    run(MyScene(), show_fps=False)

    posted in Pythonista read more
  • FLAME130

    I’ve been creating a flappy bird style game. I’m new to programming, and I can’t get the bird to pipe collision to function. It seems as if the bbox on everything is massive. Any help?

    posted in Pythonista read more

Internal error.

Oops! Looks like something went wrong!