Thanks a lot, but the game keeps starting back up afterwards, any idea on why?
d = input('enter the difficulty (0 to 100)')
import time
import random
mn = 0
from scene import *
class game (Scene):
def setup(self):
self.background_color = '#000'
self.ship = SpriteNode('spc:PlayerShip3Green')
self.meteor = SpriteNode('spc:MeteorGrayMed1')
self.star = SpriteNode('spc:Star2')
self.ship.position = self.size / 3
self.add_child(self.ship)
if self.ship.frame.intersects(self.meteor.frame):
exit()
while random.randint(0,100) != 32:
self.star = SpriteNode('spc:Star2')
self.star.position = random.randint(0, 1000), random.randint(0,750)
self.add_child(self.star)
if self.ship.frame.intersects(self.meteor.frame):
exit()
def spawn_meteor(self):
self.meteor = SpriteNode('spc:MeteorGrayMed1')
self.add_child(self.meteor)
self.meteor.position = random.randint(0, 1000), random.randint(0, 750)
if self.ship.frame.intersects(self.meteor.frame):
exit()
def update(self):
if random.randint(0, 100 - int(d)) == 0:
self.spawn_meteor()
if self.ship.frame.intersects(self.meteor.frame):
exit()
def touch_moved(self, touch):
x, y = touch.location
move_action = Action.move_to(x, y, 0.3)
move_action2 = Action.move_to(x, y, 1)
self.ship.run_action(move_action)
self.meteor.run_action(move_action2)
if self.ship.frame.intersects(self.meteor.frame):
exit()
run(game(), show_fps=True)```