Can you please tell me how to make a bullet class in BGT?
Thanks in advance!

Thumbs up


Hi Jonikster.
First you go back and forth between pygame and pyglet, now bgt? I've seen you do this multiple times, why don't you pick one or the other, bgt or python? I'm not saying this to be rude, your going to get really confused and have a hard time if you keep switching back and forth like this. I can't help you with this class I don't use bgt. If you practice making these things you will be able to figure these things out yourself. Plus, if you keep on asking people to give you code, you'll never learn what you need to know, and you won't be able to code for yourself.

What are you doing! Don't think, shoot!

Thumbs up +1

3 (edited by NicklasMCHD 2017-04-18 10:31:51)

Agreed with Guitarman. To be honest, you, "Guitarman" just summarized what i would have said to this community since bgt became free.
The point with programming is to create something from your imagination, not taking some others work and releasing it as your own.
This is not ment
to be offensive but thats the truth.

Thumbs up


About Python. I use BGT for offline projects. Python learn for online

Thumbs up


Hello. Well you may do the following:
First you need to write a class, which has veriable x, y, and z in it.
And then you need to handle your class with an array so you may perform stuff to all of your objects(bullets):
we assoom that your bullet class named bullet so you may do like this:
[email protected] braket right braket bullets;
then the hoe class starts here:
class bullet
int x; //X of your bullet
int y; //Y coords of your bullet.
int z; Z of your bullet
int speed; //How fast your bullet travels, In mili seconds.
int range; //How much your bullet should travel. Like 50 tiles or ...
int distance; //How much tiles the bullet passed. This veriable is used to help you when you want to stop your bullet when it goes out of range.
Then your constructor goes here, with the veriables you need.
to be honest, This kind of bullet system can be a bit confusing for you, But that's more realistic as it spawns an object and this object moves until it ritches it's destination.
And this is how your bullet will move around:
a for loop goes to another function that should be called in your while loop
like this:
for(uint i=0; i<bullets.length(); i++)
if(speedtimer.elapsed>=speed) //to move the bullet based on its speed
//And now, the code of moving goes here. Like bullets left braket i right braket.x++;
//You always need to check a function which has your bullet advantages in it. Like what should be done if it hits a wall, or it ritches it's destination. This function should be for all of the bullets that this loop goes through. And it should be called likethis:
//We assoom that function named bcheck so it will be bcheck(i);
to spawn your bullet, Wheather you write a function or you write it in another block of code, That bcheck function should be called another time, To check what is in that bullet's range, like this: bcheck(bullets.length()-1)

You can also visit darkflier.com and download the sourcecode of zombie erina, It has a bullet class like this one I mentioned above.
Hope this helps.

Be careful that what you're saying, Just a word Can break your personality!

Thumbs up