• How about this slight modification to the original -- should prevent the lasers from disappearing when touch ends. Also, keeps track of the lasers for use in hit detection

    from scene import * import sound import random import math class MyScene (Scene): def setup(self): self.background_color = 'midnightblue' self.ship = SpriteNode('spc:PlayerShip1Orange') self.ship.position = self.size / 2 self.add_child(self.ship) self.lasers=[] def update(self): x, y, z = gravity() pos = self.ship.position pos += (x * 15, y * 15) # Don't allow the ship to move beyond the screen bounds: pos.x = max(0, min(self.size.w, pos.x)) pos.y = max(0, min(self.size.h, pos.y)) self.ship.position = pos def touch_began(self, touch): laser_animation=Action.repeat_forever(Action.sequence(Action.call(self.fire_laser), Action.wait(0.1) ) ) self.run_action(laser_animation, 'laser') def touch_ended(self,touch): self.remove_action('laser') def remove_laser(self,laser): del self.lasers[laser] def fire_laser(self): a=random.random()*500-250 laser = SpriteNode('spc:LaserBlue9', position=self.ship.position, z_position=-1, parent=self) self.lasers.append(laser) laser.run_action(Action.sequence(Action.move_by(a, 1000), Action.remove(), Action.call(lambda:self.remove_laser(laser)))) sound.play_effect('arcade:Laser_1')
  • @JonB @cvp
    Thank you for the suggestions! I ended up going the easy way and requiring to pass in the master view. Kept the TableView hidden on the master (and thus un-touchable) until the combobox is touched.

  • Thanks, it’s working now!

  • @abcabc Thank you very much for this. You have shown me a new way that seams to make the motion smoother. Thank you again.

Internal error.

Oops! Looks like something went wrong!