Reputation: 3
I wanted to do a Flappy bird kind of project and I needed to import play library.
I use VS Code and when I click on the "play" wiriting it converts to "Playsound". It doesn't work and I use MacBook. If you can help me I would be glad... Thanks in advance :)
import play
import random
bird = play.new_image(image ="bird.png",x=-100,size=9)
obstacle_1 = play.new_box(x = 440,y = 300 ,height = 350,width =80,color = "blue",border_width= 5,border_color="black")
obstacle_2 = play.new_box(x = 440,y = -300,height = 550,width =80,color = "blue",border_width= 5,border_color="black")
bird.start_physics(stable = True , can_move= True , obeys_gravity= True,bounciness = 0.5)
point = 0
scor = play.new_text(words = str(point),x = 350,y = 250)
@play.repeat_forever
def jump():
global point
scor.words = str(puan)
if play.key_is_pressed("w","W"):
bird.physics.y_speed = 30
if obstacle_1.x > -450:
obstacle_1.x -= 5
obstacle_2.x -= 5
else :
obstacle_1.x = 440
obstacle_2.x = 440
randomnumber = random.randint(0,940)
obstacle_1.height = 940-randomnnumber
obstacle_2.height = randomnumber
if obstacle_1.x == -100:
point += 1
if bird.is_touching(obstacle_1) or bird.is_touching(obstacle_2):
point = 0
obstacle_1.x = 440
obstacle_2.x = 440
play.start_program()
Upvotes: 0
Views: 56