Forum Archive

Moving a node help!

amharder

I'm sorry I have so many questions lol, I am sort of new to programming, but here is my question. When you use Action to move a node, for example to a Touch.location, there are two drawings of it on the screen! One in the new position, and one in the old position, here is my code:

from scene import *
class game(Scene):
  def __init__(self):
    Scene.__init__(self)    
  def setup(self):
    pass
  def draw(self):
    background(0,0,0)
    self.test = LabelNode("memes", font=('Helvetic
    a', 100), position=  (500,500), parent=self)
  def touch_ended(self, Touch):
    self.test.run_action(Action.move_to
    (Touch.location.x,Touch.location.y))
run(game())

This works, but as I said before there is a node in the old location of the node, even after it is moved. Please help!

omz

You should add the LabelNode in the setup method instead of draw.

amharder

@omz Will that fix the problem?

amharder

@omz omg lol it worked! Thank you so much omz!