
-
-
Bjucha
Hello Im having a hard time getting Action.call method to work. Is there a tutorial for Scene.Action methods (except for the help documentation) I want to call the function:
def twin_action(self,twinboss): ``` Using this line of code:
blasers.run_action(A.sequence(actions), A.call(self.twin_action())) ```
But It seems that the Action.call function does not like that the twin_action takes both self and twinboss with it.
I really dont know how to fix it, any ideas/solutions?
-
Bjucha
@JonB Thank you, gonna se if I can xome up with some kind of function to be called
-
Bjucha
@JonB I got it to work! But I do still have one question, Can the start position update? As of now it looks like this:
blasers = SpriteNode('spc:LaserRed15' , parent=self) blasers.z_position = -1 a,b = boss.position blasers.run_action(A.repeat_forever(A.sequence(A.move_to(a,b), A.fade_to(1), A.move_to(10,10), A.fade_to(0))))
The problem is that the boss moves, so I though that by using ```
a,b = boss.position -
Bjucha
@JonB hmm, Im starting to understand it now thanks to you. Gonna see if I can get it to work,
-
Bjucha
@JonB But if I don’t use Action.Remove, the SpriteNode will not disappear, Since this is ”Laser” shot by an other SpriteNode I want them to move to a position then disappear and then the repeated. I thought that that the Action.Repeat_forever would run the whole process of the actions phase over and over again.
If I can’t use Action.remove() how can I make it work as I wanted?
-
Bjucha
Hmm still cant get it to work right.
I thought this would work:
blasers = SpriteNode('spc:BoltSilver' , parent=self) blasers.position = twinboss.position + (0, 30) blasers.z_position = -1 b = random.uniform(10.0, 250) actions = [A.move_to(b, 10, 2 * 1),Action.remove()] blasers.run_action(A.repeat_forever(A.sequence(actions)))``` But the action does not repeat, I thought that A.repeat_forever would loop actions, but is only runs once What am I missing?
-
Bjucha
@JonB Ah, I have been looking at it from the wrong way. I thought A.repeat_forever came after, It still does not work perfectly but At least im not getting the Type Error anymore
Thank you man, gonna see if I can get it to work as I want it to now -
Bjucha
@JonB hmm I thought that I just could replace sequence with repeat_forever, but are you saying that remove method can not be there?
Gonna try it and se if I can get it to work -
Bjucha
Hello.
Does anybody know why I get a TypeError, when using repeat_forever method for scene.Action? If I use sequence instead it works, but I would really like to use repeat_forever.Here is the part of the code:
blasers = SpriteNode('spc:LaserRed9' , parent=self) blasers.position = twinboss.position + (0, 30) blasers.z_position = -1 b = random.uniform(10.0, 250) actions = [A.move_to(b, 100, 2 * 1), A.remove()] blasers.run_action(A.repeat_forever(actions)) self.blasers.append(blasers)
But if I use:
blasers = SpriteNode('spc:LaserGreen13' , parent=self) blasers.position = twinboss.position + (0, 30) blasers.z_position = -1 b = random.uniform(10.0, 250) actions = [A.move_to(b, 100, 2 * 1), A.remove()] blasers.run_action(A.sequence(actions)) self.blasers.append(blasers)
It works fine, happy for any help...