Python Forum
Boomerang implementing logic
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Boomerang implementing logic
#21
lol that's the same thing I had in my example.

You should try to rewrite it so you're only changing self.pos a single time. Incrementing it and then decrementing it every update is what's causing issues. That's what direction was for, so that sometimes you'd be increasing pos, and sometimes you'd be decreasing it.
Reply
#22
(Nov-07-2019, 05:17 PM)nilamo Wrote: You should try to rewrite it so you're only changing self.pos a single time. Incrementing it and then decrementing it every update is what's causing issues. That's what direction was for, so that sometimes you'd be increasing pos, and sometimes you'd be decreasing it.
From what nilamo said. On line 19, you're increasing the pos when you only need to do it at the end of the code where you're already increasing (or decreasing) it.
Reply
#23
Now it works with the boomerang.

But the problem is, that this class is also for other weapons. Now they are not flying forward anymore.
Reply
#24
If you were using line 19 to move the other weapons, simply add an else statement to the boomerang if statement (line 25) and in the else statement, increment the weapon's pos as you were with line 19.
Reply
#25
I fixed it now. Thanks it is working!
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  A question about implementing the state engine code marienbad 4 3,229 Oct-20-2018, 02:08 PM
Last Post: metulburr

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020