Convert SpriteNode position to float
im trying to create a laser/missle that fires at the player ship position. But im getting type error: A float is required. When using the following
actions = [A.move_to(self.ship.position, self.ship.position, 2 * 2), A.remove()]
Is it possible to convert the self.ship.position to float somehow or is it an orher way to do it?
ccc last edited by
x, y = self.ship.position actions = [A.move_to(x, y, 2 * 2), A.remove()]
@ccc Yes been looking at that but the problem is the X,Y coordinates, seems not to accept
self.ship.positionas X,Y values if I use regular numbers it works
Guessing the problem is that
self.ship.positionhas both x,y coordinates in it so the
A.move_tocan't read it.
ccc last edited by ccc
I don't quite get it. What do you get when you
print(self.ship.position, x, y)?
[A.move_to(self.ship.position.x, self.ship.position.y, 2 * 2), A.remove()]?
[A.move_to(self.ship.position, self.ship.position, 2 * 2), A.remove()]?
@ccc so sorry didn't see your whole response, That got it to work thank you very much!!!