• flight_714

    I realize this is a few weeks old, but had a few thoughts.

    I typically add scene objects of a shared type to a list and then iterate over a method of their class in update.

    So at the end up the enemy class init I would add 'enemies.append(self)' and then in the scene update method add 'for enemy in enemies': enemy.cooldown() or something to that to that effect.

    Obviously, you'd have to write a bit more AI methods for the enemy ships, so you'd probably want to subclass them to save space.

    posted in Pythonista read more
  • flight_714

    Full disclosure: I'm a perpetual noob both with Pythonista and programming in general, but I have wrestled with this issue quite a few times tooling around with game ideas.

    The simplest solution is to set up a manual timer that uses the Scene update method to subract a number from a starting point.

    [scene setup code]
    self.timer = 100

    def update(self):
    self.timer -= 1
    if self.timer <= 0:
    self.timer = 100

    Obviously, once this makes sense you can make a timer class and have multiple instances running for different events.

    Alternatively, you can mess around with threading, but I've found that this route is best for simpler tasks.

    Obviously, frame rate is an issue and I'm sure the more experienced folks around here will have a more elegant solution.

    posted in Pythonista read more
Internal error.

Oops! Looks like something went wrong!