omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular
    1. Home
    2. Slimebot32

    Welcome!

    This is the community forum for my apps Pythonista and Editorial.

    For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.


    • Profile
    • Following 0
    • Followers 0
    • Topics 2
    • Posts 6
    • Best 0
    • Controversial 0
    • Groups 0

    Slimebot32

    @Slimebot32

    0
    Reputation
    646
    Profile views
    6
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    Slimebot32 Unfollow Follow

    Latest posts made by Slimebot32

    • RE: Please help.

      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)```
      posted in Pythonista
      Slimebot32
      Slimebot32
    • Please help.

      Can anyone tell me what im doing wrong here?

      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)
      
      		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)
      
      	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)
      		
      	def update(self):
      		if random.randint(0, 100 - int(d)) == 0:
      			self.spawn_meteor()
      		if self.ship.intersects(self.meteor):
      			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)
      		
      run(game(), show_fps=True)```
      posted in Pythonista
      Slimebot32
      Slimebot32
    • RE: My code won’t work

      Thanks, how do you add_child for a set()?

      posted in Pythonista
      Slimebot32
      Slimebot32
    • RE: My code won’t work

      Thanks! I’m also wondering how to make multiple children of meteor at once, is this possible?

      import time
      import random
      from scene import *
      
      class game (Scene):
      	def setup(self):
      		self.background_color = '#6F6'
      		self.ship = SpriteNode('spc:PlayerShip3Green')
      		self.ship.position = self.size / 3
      		self.add_child(self.ship)
      		self.meteor = SpriteNode('spc:MeteorGrayMed1')
      	def spawn_meteor(self):
      		self.add_child(self.meteor)
      		self.meteor.position = random.randint(0, 1000), random.randint(0, 750)
      		
      	def update(self):
      		if random.randint(0, 100) == 1:
      			self.spawn_meteor()
      	
      	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)
      		
      run(game(), show_fps=True)```
      posted in Pythonista
      Slimebot32
      Slimebot32
    • RE: My code won’t work

      Sorry, but I’m confused why spawn_meteor says it isn’t defined

      import time
      import random
      from scene import *
      
      class game (Scene):
      	def setup(self):
      		self.background_color = '#6F6'
      		self.ship = SpriteNode('spc:PlayerShip3Green')
      		self.ship.position = self.size / 3
      		self.add_child(self.ship)
      		self.meteor = SpriteNode('spc:MeteorGrayMed1')
      	def spawn_meteor():
      		self.add_child(self.meteor)
      		self.meteor.position = random.randint(0, 1000), random.randint(0, 750)
      		
      	def update(self):
      		if random.randint(0, 1000) == 1:
      			spawn_meteor()
      	
      	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)
      		
      run(game(), show_fps=True)```
      posted in Pythonista
      Slimebot32
      Slimebot32
    • My code won’t work

      I’m making a basic game (I’m new to python) and am wondering why the app freezes when I try to run this code.

      import time
      import random
      from scene import *
      
      class MyScene (Scene):
      	def setup(self):
      		self.background_color = '#6F6'
      		self.ship = SpriteNode('spc:PlayerShip3Green')
      		self.ship.position = self.size / 3
      		self.add_child(self.ship)
      		self.meteor = SpriteNode('spc:MeteorGrayBig4')
      		while True:
      			self.meteor.position = random.randint(0, 1000), random.randint(0, 750)
      			self.add_child(self.meteor)
      			time.sleep(1)
      		
      	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)
      		
      run(MyScene(), show_fps=True)
      
      posted in Pythonista
      Slimebot32
      Slimebot32