• A quick google search found me this:
    Detection between a circle and a line

    Should be a good start.

  • Or try this search , just searches the forums with Google

  • You're an idiot going to Android if you're interested in Python programming and Pythonista in partucular. Sorry I cannot give you a more polite answer from a programmer's position.

  • Pythonista posted

    Listen to your teacher...

    Pythonista has support for bottle and flask which might be good to learn before Django so that you understand how frameworks work. But Django and related frameworks are about building platform independent webapps so you want to avoid platform specific modules like scene. Graphics done via html5, JavaScript canvas, etc. would be more appropriate Django apps and should also run on Pythonista.

  • After playing the real app, I start to understand a bit more. I created a pull request for Agar_io.py and opened five issues on the repo. Please try to work on fixing those issues.

  • In this particular case, it might be good to read the documentation of Rect....

  • Two things to look out for in your code.

    0 times a number is always equal to 0 (look and the initialisation of self.vx and self.vy) The position of the self.cells layer is never changed (i.e. after initialisation the only time it is referenced is to redraw and to check for colision. Try setting self.cells.x and self.cells.y in the update method)

    Also as @ccc mentioned consider creating a Github repository which we can all look at and provide feedback on. I also agree with @wardcliffe

  • Comment out these two lines at the beginning of update():

    #self.vx *= 0.4 #self.vy *= 0.4

    Or slow down the speed decay...

    self.vx *= 0.998 self.vy *= 0.998

    Also, if any of your while loops in touch_moved() start then they will never end (infinite loop with no ui updates) because neither of the terms are modified in the body of those loops.

  • A different suggestion: try using layers. The advantage of layers is that most of the "hard work" is done for you, such as adding and removing objects, positioning objects relative to their parent, rendering them properly, etc. You also don't need to keep track of all objects manually in a list somewhere, instead you add them as sublayers of another layer, and they will be drawn automatically.

    Consider making a backup copy of your script before changing it to use layers, you might run into problems and want to look at your original code.

  • You're a legend. Thanks so much!

  • global cells
    is your problem. I would suggest you avoid using globals, especially in classes that you plan on instantiating many copies of!

  • Attribute Error: 'Intro' object has no attribute 'cells'. means that the Intro object does not have an attribute called cells. You need to define one if you want your code to work.

  • Layers can be larger than the screen, right? In that case you could have a "game field" area that is as large as the entire field. All cells and food are sublayers of the "game field". Then you can simply change the position of the game field relative to the root layer to change the current view position.

    Though I'd imagine this causing framerate issues when many cells (and especially food pellets) are on the field. The real agar.io only renders what the player can see, I'm not sure how scene handles off-screen layers.

  • @Pythonistapro777 , are you on stackflow? It's a great site. Covers a lot of languages, I guess probably all. Absolute massive database of answers to all sorts of questions. I ask some Python oriented questions here sometimes because I am not exactly sure if there are some limitations or differences about running in Pythonista.
    But look if you are not on stackflow, get on there ASAP. You will love it. So many things have already been answered. I use use it all the time. As far as I know, it's the by far the biggest programming resouce on the web. No sign up fees, you can sign in with your Facebook account if you wish.
    Again, don't sweat it too much. It's just using the right resources for the right answers. You also have to be disciplined on stackflow. They want you to search for your answer first, rather than just post a question. Its understandable, otherwise you end up with literally thousands of duplicated questions.
    Btw, I would have got question 2 wrong also :) but I would have done what was suggested by putting in the print statements.
    Happy coding!

  • Ok I stop now. I am sure he does not need a thai lesson :)but that was a difficult thai word for me, I had to ask my thai friend sitting next to me. Basically unauthorised taxis , not literally but local meaning.

  • Thanks you @Phuket2

  • @Pythonistapro777 I think you need to start making more of an effort to debug your own code before you post here. If you post every problem you run into with no clear effort to debug made, it's kind of annoying to some users. Try googling for answers similar to yours. For example, search for "Attribute error Python" to find out more about what your error means and work from there.

  • Remove all lines that start with the word global. Rename all instances of player to self.player. Rename all instances of computer to self.computer. self.add_layer() each of the three buttons to enable their actions. Create a .stop() method to wait until the user closes the scene.Scene. etc.

    See: https://github.com/cclauss/Magic8Ball/blob/patch-4/rock_paper_scissors.py

    Try to avoid global variables where ever possible.

  • @ccc THANKS A BUNCH!

  • stroke_color.py

    You do not need to draw each sublayer individually.

    def draw(self): scene.background(0,0,0) self.root_layer.update(self.dt) self.root_layer.draw()

    will draw all sublayers that have been added to a scene.Scene.

Internal error.

Oops! Looks like something went wrong!