omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular
    1. Home
    2. Drizzel
    3. Best

    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 29
    • Posts 135
    • Best 14
    • Controversial 0
    • Groups 0

    Best posts made by Drizzel

    • RE: Flappy bird

      @Karina the issue lies in line 22.
      Since add_column is in the loop, it will get called plenty of times. This results in a lot of columns stacked on top of another, and it is very probable that at least once these columns has the maximum number boxes, and therefore the „smallest“ gap.
      Just remove one of the indents in line 22 to fix this.

      Btw, what @stephen said is certainly worth looking into, like just about any of his suggestions

      posted in Pythonista
      Drizzel
      Drizzel
    • RE: Help! I need help thinking of python projects I can do.

      @Bumbo-Cactoni I'm a bit late to the party, but you could always check out Cambidge IGCSE Computer Science past papers. Just search for them in your favourite search engine. They provide beginner level excercises and solutions, since the exams are aimed at students with 2 years of coding experience.
      Just be aware that for every year, there's one paper with a coding excercise (the one you want) and one paper with theory (boring).

      I had to pass this exam in 2018, just as an example
      There's more here.

      posted in Pythonista
      Drizzel
      Drizzel
    • RE: Flappy bird

      @stephen looking good! I always was a little too lazy to try them all out... and I’m not using scene much nowadays.

      posted in Pythonista
      Drizzel
      Drizzel
    • RE: Access TableViewCells

      @stephen That’s how I understood him. And it worked out really well, after some minor adaptions

      posted in Pythonista
      Drizzel
      Drizzel
    • haptic and vibration feedback

      I was just playing around, and thought this might be useful to others as well. So I signed up to GitHub. Feelback (didn't know how else to call it, I know it's a bit cringey) makes it fairly easy to get vibrations and haptic feedback, assuming your device has a haptic engine built in.

      The oldest supported iPhone is the 6s (mine), and it only works with a little workaround. I don't know which iPads work (my iPad mini 2 is just way too old), or if they have a haptic engine at all.

      Does anyone know if there are other SystemSounds than these? Because even this list doesn't include the ids for haptic feedback (1519, 1520, 1521) , so there may be more.

      posted in Pythonista
      Drizzel
      Drizzel
    • RE: Flappy bird

      @stephen thanks for the kind words, but some things are clumsy at best. Your summary is awesome, though. Although I am really glad that I can help here :) That way I can return at least a small amount of the support this community here has given me

      posted in Pythonista
      Drizzel
      Drizzel
    • RE: Flappy bird

      @Karina

      This is an old and sometimes very poorly written clone I did to learn about ai (flappy bird is an awesome game for basic artificial intelligence experiments). I didn’t bother about graphics, but maybe it’s helpful to you.

      Run this to play the game:

      from scene import *
      import sound
      import random
      import math
      import gameExtension as extension
      #import nnExtension as nn
      A = Action
      
      class MyScene (Scene):
      	
      	def setup(self):
      		self.background_color = 'beige'
      		self.gravity = Vector2(0, -self.size.y/1500)
      		self.birds = []
      
      		self.running = True
      		extension.setup_walls(self)
      		extension.update_walls(self)
      		
      		#self.birdCount = 1 #uncomment if using ai
      		
      		for x in range(self.birdCount):
      			extension.add_bird(self)
      		pass
      	
      	def did_change_size(self):
      		pass
      	
      	def update(self):
      		if self.running:
      			self.running = False
      			extension.update_walls(self)
      			
      			for bird in self.birds:
      				if bird.distance >= 10000: bird.dead = True
      				if not bird.dead:
      					self.running = True
      					extension.count_distance(self, bird)
      					extension.update_bird(self, bird)
      					bird.data = extension.get_data(self, bird)
      					
      					if bird.position.y-bird.size.y/2 <= 0 or bird.position.y+bird.size.y/2 >= self.size.y:
      						bird.color = 'red'
      						bird.dead = True
      						
      					for wall in self.walls:
      						if bird.frame.intersects(wall.frame):
      							bird.color = 'red'
      							bird.dead = True
      				else:
      					if bird.position.x + bird.size.x/2 >= 0:
      						bird.position = (bird.position.x - 1, bird.position.y)
      			
      			
      		
      	def touch_began(self, touch):
      		self.birds[0].up = True
      		pass
      	
      	def touch_moved(self, touch):
      		pass
      	
      	def touch_ended(self, touch):
      		pass
      
      if __name__ == '__main__':
      	run(MyScene(), PORTRAIT, show_fps=True)
      
      

      Save this in the same folder as the upper main code as gameExtension.py

      from scene import *
      import random
      
      def add_bird(self):
      	self.birds.append(ShapeNode(rect(0,0,10,10)))
      	bird = self.birds[len(self.birds)-1]
      	bird.color = 'black'
      	bird.size = (self.size.x/50, self.size.x/50)
      	bird.position = (self.size.x/4, self.size.y/2)
      	bird.z_position = 2
      	bird.dead = False
      	bird.distance = 0
      	bird.up = False
      	bird.max_fall_vel = Vector2(0, self.size.y/100)
      	bird.up_acc = Vector2(0, self.size.y/2)
      	bird.vel = Vector2(0, 0)
      	bird.acc = Vector2(0, 0)
      	bird.data = get_data(self, bird)
      	self.add_child(bird)
      	
      def setup_walls(self):
      	self.wall_distance = self.size.x/4
      	self.gap_size = self.size.y/6
      	self.wall_width = self.size.x/14
      	self.distance_to_next_wall = self.wall_distance + 1
      	self.walls = []
      	
      def count_distance(self, bird):
      	bird.distance = bird.distance + 1
      	
      def update_walls(self):
      	if self.distance_to_next_wall >= self.wall_distance:
      		self.distance_to_next_wall = 0
      		build_wall(self)
      	else: self.distance_to_next_wall = self.distance_to_next_wall+1
      		
      	removal = []
      	for x in range(len(self.walls)):
      		wall = self.walls[x]
      		wall.position = (wall.position.x - 1, wall.position.y)
      		
      		if wall.position.x + wall.size.x/2 < 0:
      			removal.append(x)
      	
      	for x in range(len(removal)):
      		wallIndex = removal[x]-x
      		wall = self.walls[wallIndex]
      		wall.remove_from_parent()
      		self.walls.pop(wallIndex)
      		
      def build_wall(self):
      	posY = random.randint(round(self.gap_size/2), round(self.size.y - self.gap_size/2)) #random position of gap
      	
      	self.walls.append(ShapeNode(rect(0,0,10,10))) #set up the upper wall
      	wall = self.walls[len(self.walls)-1]
      	wall.size = (self.wall_width, self.size.y - posY - self.gap_size/2)
      	wall.color = 'grey'
      	wall.position = (self.size.x + self.wall_width/2, self.size.y - wall.size.y/2)
      	wall.z_position =  1
      	self.add_child(wall)
      	
      	self.walls.append(ShapeNode(rect(0,0,10,10))) #set up the lower wall
      	wall = self.walls[len(self.walls)-1]
      	wall.size = (self.wall_width, posY - self.gap_size/2)
      	wall.color = 'grey'
      	wall.position = (self.size.x + self.wall_width/2, wall.size.y/2)
      	wall.z_position =  1
      	self.add_child(wall)
      	
      def update_bird(self, bird):
      	if bird.up:
      		bird.up = False
      		bird.acc = bird.up_acc
      	else: bird.acc = self.gravity
      		
      	bird.vel = bird.vel + bird.acc
      	if bird.vel[1] > bird.max_fall_vel[1]: bird.vel = bird.max_fall_vel
      	
      	
      	bird.position = bird.position + bird.vel
      	
      def get_data(self, bird):
      	data = []
      	for x in range(len(self.walls)):
      		wall = self.walls[x]
      		if wall.position.x + wall.size.x/2 >= bird.position.x - bird.size.x/2:
      			y_to_gap = (wall.position.x - wall.size.x/2) - (bird.position.x + bird.size.x/2)
      			if y_to_gap < 0: y_to_gap = 0
      			data.append(y_to_gap)
      			x_to_upper_wall = (wall.position.y - wall.size.y/2) - (bird.position.y + bird.size.y/2)
      			data.append(x_to_upper_wall)
      			wall = self.walls[x+1]
      			x_to_lower_wall = (wall.position.y + wall.size.y/2) - (bird.position.y - bird.size.y/2)
      			data.append(x_to_lower_wall)
      			break
      	distance_to_top = self.size.y - bird.position.y + bird.size.y/2
      	data.append(distance_to_top)
      	distance_to_bottom = bird.position.y - bird.size.y/2
      	data.append(distance_to_bottom)
      	velocity = bird.vel[1]
      	data.append(velocity)
      	return data
      
      posted in Pythonista
      Drizzel
      Drizzel
    • RE: [RPG Update] - For those following along

      Im not even positive anyone is even wanting to follow the progress of this lol but just in case one person is here is change log 1 lol

      Don’t sell yourself short😂 it’s always interesting to know what others are working on

      posted in Pythonista
      Drizzel
      Drizzel
    • RE: Pure Python gestures

      @stephen True, I corrected it :) The code was a bit rushed 🤷‍♂️

      posted in Pythonista
      Drizzel
      Drizzel
    • RE: need some criticized input please.

      As far as I've understood, you want some design feedback on these graphics, right?
      Did you design these graphics yourself? If not, this might be a bit too detailed, sry

      General feedback

      • all designs are really well recognisable
      • every color scheme is good
      • not a single flaw in the perspectives
      • you repeat that they're icons. If they're going to be shown in a small size, they might be too detailed

      Rune Stone

      • I love the design
      • if you want to minimalise it, get rid of the grey scratches (not the black cracks)

      Common Sword

      • I dunno, but I'd assume that a common sword would neither have a gem inlay nor a fancy hilt and guard (after all it's a golden color)
      • if you want to minimalise it, get rid of the scratches.
      • the dents look awesome

      Short bow

      • What you show here is a long bow, a short bow usually has a recurve in order to deliver greater power (check out recurve bows)
      • the wrapping fits the sword handle, nice touch

      Attributes:

      • Amazing looking
      • already quite minimal, since there's no scratches
      • absolutely no more improvement suggestions

      spell book icon

      • looks great
      • maybe a bit to detailed (depends on how large it is when shown in your rpg)
      • maybe add some shadows around the rune stones to add depth, they are weirdly flat right now

      barrel

      • good color scheme, but I'd darken the wood colors to a walnut color, looks more aged interesting

      mana potion

      • darken the cork, otherwise the design is great
      • no need to minimalise

      health icon

      • too detailed, get rid of the "HP"
      • the ouch and scratches in the top left are a nice touch.
        *maybe replace the patches with the scratches from the top left, and leave the top left empty

      ruby garnets

      • look amazing, perspective is well done
      posted in Pythonista
      Drizzel
      Drizzel
    • RE: ui view anchor redefine constraints

      Thanks a lot @stephen!
      I was worried I’d have to rewrite everything, so I for now decided on a different ui layout that uses as few moving views as possible. I’ll play around a bit and, if I haven’t figured it out by then, get back to you.

      posted in Pythonista
      Drizzel
      Drizzel
    • RE: pip install gestures, WKWebView, UI animations and more

      @mikael Just a tiny correction, please correct me if I’m wrong. In the multipeer readme it says one should use <pip install multipeer> to install your module, which doesn’t work. You probably meant <pip install pythonista-multipeer>.

      posted in Pythonista
      Drizzel
      Drizzel
    • RE: Getting program to run multiple times

      Put main() into a while True or for x in range() loop.

      #your definitions and so on...
      
      While True:
        main() #the indented part is now repeating for eternity... :-) if you wish to stop the loop, just insert the command break 
      
      

      The for x in range(range) loop will repeat for x times whatever integer the range variable is set to.

      for x in range(12):
        print(x) # x is equal to the number of times that the loop has been executed already
        main() # now your code is repeated 12 times
      
      posted in Pythonista
      Drizzel
      Drizzel
    • RE: MapMan (made in Pythonista) Available NOW in the App Store

      How did you manage to implement in-app purchases? Would be truly awesome if you could explain it :)

      posted in Pythonista
      Drizzel
      Drizzel