Re: Can any one please help me with this bullet class, python?

@4
The bullet loop isn't in the class, they're just not putting blank lines between things so you have to go out of your way to notice.

@ashleygrobler04
In order to deal with facing, it is helpful to represent right as 1, and left as -1.  Then you can increment a counter, and every time you do so,  you do:

x = counter * facing

Which will make it go left if facing is -1 and right if facing is 1.  The reason this is helpful is that you can then just do if bullet.counter >= bullet.max which will work for either direction.

You have another bug though: you're determining which way a bullet should be moving based on the way the player is currently facing, so if the player fires the bullet they can turn around and cause it to go back and forth like a boomerang.  You need to store the way bullets are facing on the bullet.

One other comment: don't name x on bullets bx.  Use the same x for everything.  This will let you make code that works on lots of kinds of objects.



-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
  • ... AudioGames . net Forum — Developers room : chrisnorman7 via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : magurp244 via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : ogomez92 via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : ogomez92 via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : ashleygrobler04 via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : redfox via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : ashleygrobler04 via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : titan_of_war via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : chrisnorman7 via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : ashleygrobler04 via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : bhanuponguru via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : chrisnorman7 via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : redfox via Audiogames-reflector

Reply via email to