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

2020-08-19 Thread AudioGames . net Forum — Developers room : ashleygrobler04 via Audiogames-reflector


  


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

Ok, i got it working. thanx all for the help.

URL: https://forum.audiogames.net/post/562681/#p562681




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


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

2020-08-07 Thread AudioGames . net Forum — Developers room : redfox via Audiogames-reflector


  


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

@17.This is fair. However, i've found that my own scripting is more recognizable to me if I do all of the formatting myself. May just be a preference, though.

URL: https://forum.audiogames.net/post/559327/#p559327




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


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

2020-08-06 Thread AudioGames . net Forum — Developers room : kianoosh via Audiogames-reflector


  


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

ashley, You need to check the absolute value of bx if you're going to go with your own way of handling bullets. Why? Because if the player is facing left, the x value, as already specified, decreases. Your bullets are not disappearing at all because you have "if bx is greater than max x then disappear" If the player is facing left, and the max x is 40, it means this bullet has a range of 41(be ause you used > not >=). Therefore it is supposed to go until -41 x and then disappear but it doesn't because in your code it is specified that if the bullet's x is only greater than its max x it should disappear. Now, if you use the absolute value for bx in that statement you will haveif math.abs(i.bx) > i.maxx:    #disappearDone.

URL: https://forum.audiogames.net/post/558787/#p558787




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


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

2020-08-05 Thread AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector


  


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

Actually, with respect to formatting:pip install black
black myfile.pyDone.  Will produce something nicely readable.  I don't remember how to run it on entire projects offhand, but you don't even configure it.  Just install and run.

URL: https://forum.audiogames.net/post/558631/#p558631




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


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

2020-08-05 Thread AudioGames . net Forum — Developers room : redfox via Audiogames-reflector


  


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

I'd recommend Pep8 except for the fact that you might not understand a lot of it's terminology.But yeah, a bullet, by design, is usually something that moves on a predetermined path, and constantly checks if it is inside of anything it needs to interact with.This is different depending on the game, obviously, but they usually work the same.

URL: https://forum.audiogames.net/post/558623/#p558623




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


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

2020-08-05 Thread AudioGames . net Forum — Developers room : chrisnorman7 via Audiogames-reflector


  


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

Hey @13If you get into the habit of using Flake8, it'll point out problems like not enough blank lines for you. It also does other useful things like checking variables that you use actually exist.That's what I used, paired with mypy for code checking.HTH.

URL: https://forum.audiogames.net/post/558495/#p558495




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


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

2020-08-05 Thread AudioGames . net Forum — Developers room : bhanuponguru via Audiogames-reflector


  


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

#13:no. @12 din't mean to put a blank line in each line of code. @12 is saying to put a blank line between 2 classes or 2functions or between one class and function etc.

URL: https://forum.audiogames.net/post/558493/#p558493




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


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

2020-08-04 Thread AudioGames . net Forum — Developers room : ashleygrobler04 via Audiogames-reflector


  


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

Ok, in the future, i will put a blank line between the lines of code.

URL: https://forum.audiogames.net/post/558248/#p558248




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


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

2020-08-04 Thread AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector


  


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

@9For those of us who are used to reading code, blank lines also matter.  It's like splitting your code into paragraphs, "hey this new thing is starting now", and with a screen reader you can find where things start just by arrowing really fast for the blanks.@10Yes. That's the definition in any game, really.  There will usually be some game-specific behavior around how much damage is done and stuff.

URL: https://forum.audiogames.net/post/558172/#p558172




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


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

2020-08-04 Thread AudioGames . net Forum — Developers room : chrisnorman7 via Audiogames-reflector


  


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

@10It's anything you want it to be. Maybe you're building a splinter missile that turns from 1 bullet into 10 when it moves past 2 tiles, maybe it's a subspace warp-enabled battle-bastard torpedo, and it should vanish as soon as it's fired, and only re-appear when it's about to hit it's target.Honestly, you can do whatever you like.Once you realise that stuff in games is rarely magic, you can stop being afraid of stuff. I mean, a magic spell in a game is probably an instance of a Spell class, with a custom animation, sound, whatever.

URL: https://forum.audiogames.net/post/558171/#p558171




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


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

2020-08-04 Thread AudioGames . net Forum — Developers room : titan_of_war via Audiogames-reflector


  


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

is a bullet in audiogames basicly just a thing that moves that takes helf from a player that you just add a hit sound too.

URL: https://forum.audiogames.net/post/558158/#p558158




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


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

2020-08-04 Thread AudioGames . net Forum — Developers room : ashleygrobler04 via Audiogames-reflector


  


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

Thanx all for the help. and yeah, it was a loop outside the class. look at the indentation... but camlawn thanx for the help, will try it.

URL: https://forum.audiogames.net/post/558122/#p558122




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


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

2020-08-03 Thread AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector


  


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

@7I don't think it's called anything, or if it is I haven't seen anyone call it anything in something like 6 or 7 years of Python.  people just call it self, or the current instance, or the object, or whatever.  Maybe there's a Python term somewhere.Yes, you can name it anything. No, you really shouldn't.  That's only really allowed because Python is older than most of the people on this site.  Started in 1989, believe it or not.  It wasn't always so clear to everyone that making everyone use the same name for the current instance mattered, I don't think, but I doubt they'd allow for it these days if they were designing it again.  Mind you, you can do some very interesting and evil things that you should never ever do with Python's design for instance methods if you know what you're doing.

URL: https://forum.audiogames.net/post/558047/#p558047




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


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

2020-08-03 Thread AudioGames . net Forum — Developers room : redfox via Audiogames-reflector


  


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

Remember, this isn't BGT, where every god forsaken variable is accessible from anywhere. You don't have to worry about conflictions with variable names with something outside of the class and inside, provided you have the class's self keyword. What's that called by the way? I've noticed you can place anythin in the place of self inside of method declarations and you can then use that keyword instead of self, I asume this is bad habbit, hence, I don't do it.

URL: https://forum.audiogames.net/post/558033/#p558033




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


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

2020-08-03 Thread AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector


  


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

@4The 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.@ashleygrobler04In 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 * facingWhich 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.

URL: https://forum.audiogames.net/post/557956/#p557956




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


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

2020-08-03 Thread AudioGames . net Forum — Developers room : ashleygrobler04 via Audiogames-reflector


  


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

The reason why i am using a for loop in the class, is because i have a bullet loop running in the game. that's why, but i guess i can change it...

URL: https://forum.audiogames.net/post/557874/#p557874




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


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

2020-08-02 Thread AudioGames . net Forum — Developers room : ogomez92 via Audiogames-reflector


  


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

Why are you doing for i in bullets: inside the bullet class?The reason for having class instances is exactly so you don't have to run loops that spawn multiple things from inside the same class, your bullet should fire alright, but the world class should be the one to run the loop cycles, not the bullet running through all the bullets! do you realize performance wise how bad this is? Every bullet is going to loop through every bullet, so it's going to run like, if you have 10 bullets, 10 loops * 10 loops because each bullet runs the loop a million times because you're making it go through the array.

URL: https://forum.audiogames.net/post/557839/#p557839




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


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

2020-08-02 Thread AudioGames . net Forum — Developers room : ogomez92 via Audiogames-reflector


  


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

Why are you doing for i in bullets: inside the bullet class?The reason for having class instances is exactly so you don't have to run loops that spawn multiple things from inside the same class, your bullet should fire alright, but the world class should be the one to run the loop cycles, not the bullet running through all the bullets! do you realize performance wise how bad this is? Every bullet is going to loop through every bullet, so it's going to run like, if you have 10 bullets, 10 loops * 10 loops because each bullet runs the loop.

URL: https://forum.audiogames.net/post/557839/#p557839




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


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

2020-08-02 Thread AudioGames . net Forum — Developers room : magurp244 via Audiogames-reflector


  


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

The problem of the disappearing bullets could be how your handling the maxx variable:if i.bx>i.maxx:
bullets.remove(i)If your moving right, it makes sense that the bullet should reach X distance than disappear, being greater than. But if your moving left, it would have to be less than i.maxx, not greater. Left = less than, right = greater than.Logic wise, i'd also encapsulate a lot of this into the bullet class itself, like direction and updating. The direction the player is facing shouldn't matter once the bullet is fired afterall, that would be a property of the bullet once its in play.

URL: https://forum.audiogames.net/post/557822/#p557822




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


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

2020-08-02 Thread AudioGames . net Forum — Developers room : chrisnorman7 via Audiogames-reflector


  


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

A couple of possibilities:Firstly, you should probably use constants or an enum for directions, so you can't mistype, and therefore skip the if statements concerning directions. If you're not going to do that, at least do:if direction == "right:
# Whatever.
elif direction == "left":
# Whatever.
else:
raise NotImplementedError(f"Direction {direction} is invalid.")The other thing, is your penultimate line. I'm wondering, if you're using >= to check the x coordinate, will that still work if your bullet is moving down the x coordinate, as in to the left?HTH,

URL: https://forum.audiogames.net/post/557784/#p557784




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector