1

if someone could explain how this works or give an include that is somewhat easy to follow, as i'm still a little knew, I would graitely apreciate it.
[wow], thinking about it, i end a lot of posts with i would graitely apreciate it, hahahahaahahha.

i'm currently in the process of learning how to code, if you would like to contact me, skype is preffered, use one of the following:
skype: brennan draves
email: [email protected]
website; not yet up: redfoxproductions.com

Thumbs up

2

coding weapons is like coding any other thing
think about each problem and how you can solve it
there is no one only way to do something in programming.

hth

Thumbs up

3

This is why you need to learn to code before you go trying to make a game. More aptly put, you need to learn how to think in programming terms. And no I"m not some great developer or anything, the struggle is real for me too, but its all about sitting down, thinking things out. Programming is very logical, and when you break it down to this next sentence, you'll maybe understand a bit better. Computers are very dumb. they can do only what you tell them to do, and exactly what you tel them to do. If you get a text, your brain has sort of got its own algorithm on how to deal with that. Think about the steps, and break it down, how would you deal with getting a text. The first thing I'd do is see if I can remember where I left my phone, if not, I will use sound cues to locate it. But its more than just that, next I will need to reach for it, lower my arm down to the phone, open my hand, clamp it down on the phone. lift slightly, rotate at the elbow and shoulder to bring the phone to me. Then I locate the apply pressure to the lock button. After that, I will pub my finger about center on the screen and explore up and down until I see the notification. Then I decide if I want to reply or not.
It's just that, everything in coding is about breaking it down to the smallest steps you can. That's why we use functions, or class methods in coding, because we can take a repetitive task and make it less so by writing the code only once and then executing it. I've seen some code from BGT developers, and  lot of is it messy and disorganized. Even though it is functional, things are sort of just chilling in the main loop. My way is to take each thing you want to do and write a function for it, and the main loop will be nothing but function calls. Of course, you have to find your own way, but that for me looks a lot cleaner and more organized.

Onto your actual question, what kinds of weapons do you want to have, what attributes does each of them have. Don't just say guns, abstract it further, pistols, shotguns, rifles. OK what do those guns have in common, and what are the differences. Well, first off, they all take ammo. Secondly, they fire a bullet from the cartridge as a projectile out the barrel. Third, they can each accept more than one round to fire before needing to be reloaded. OK, some differences. Pistols are usually semiautomatic, using blowback from the gas expulsion from the round to blow the slide back to trigger the ejection of one round and the clip, having constant pressure on it from the spring inside it, that will force another round into the chamber. So, it can fire about as fast as you can repeatedly press the triggers. While there are semiautomatic rifles certainly, let's focus on ones that aren't. When you fire a rifle, you generally put it up to your shoulder, take it off safe, aim and fire. To fire a new round though, you first will need to open the bolt by pulling it back, which will cause the shell to be ejected, then, due to the constant pressure exerted by the spring in the magazine, a new round will feed into the bolt carrier, which will be forced into the chamber when you push the bolt forward, and lock it into the down position. Shotguns often work the same way, but have a pump rather than a bolt, you fire a round, pull the pump which forces a shell out, push the pump which forces one in and fire again. Now, we have things that don't fit into those categories and you will need to consider if you want those outliers or not. Things like revolvers which can and cannot be semiautomatic. There are older revolvers that you have to cock the hammer back each time you want to shoot, and newer ones where there's a double action, so that by you pulling the trigger, you're exerting force to cock the hammer back, then at the end of the pull, the mechanical device that is pushing the hammer back moves out of its way, allowing it to slam forward again, using its spring tension to make it strike the primer of the round that's lined up with it to cause the powder to ignite. You also have breach loading shotguns, meaning that they take only one round, you pull a lever, the barrel and receiver tip apart from each other, you insert one round into the chamber, then push them together again and you can fire.

SO what can we put into code from this. Well, Each weapon is going to need a clip size, and a current ammo in clip. Those in BGT would be uints, since they should never be negative. The clipsize could also be a const if you didn't want to code a class called weapon, and create each object from that class. You could really go deep by creating a weapons class, then, derived classes of automatics, semiautomatics, non-automatics and so on, but its not required. Also, what else can we see that we need. A boolean to say the thing is firing, a boolean maybe to see if the safety is on if you want to simulate that for some reason. A bool to say whether its reloading or not, and it goes on from there.

The bipeds think this place belongs to them, how cute.

Thumbs up

4

i'll give you short thing, if you dont understand, tell me i'll give all of eazia weapon coad
first, tell damage, range,, name, and speed  of weapon
well, like this
int weapon1damage=15;
then, string weapons +weapons, like string weapons 15;
then, tell if key pressed key eg f, play draw sound
if key pressed key ctrl shoot,
and etc things

website: mahdi.jc-hosting.me
email: [email protected]: skype: mahdi.abedi82
my name on playroom: mahdi-abedi
my teamtalk server information: mahdi.jc-hosting.me, ports 6661: you should create account to login, and for it, send me private message, in your pm, send me username and passwordh

Thumbs up

5

i'll give you short thing, if you dont understand, tell me i'll give all of eazia weapon coad
first, tell damage, range,, name, and speed  of weapon
well, like this
int weapon1damage=15;
then, string weapons +weapons, like string weapons 15;
then, tell if key pressed key eg f, play draw sound
if key pressed key ctrl shoot,
and etc things

website: mahdi.jc-hosting.me
email: [email protected]: skype: mahdi.abedi82
my name on playroom: mahdi-abedi
my teamtalk server information: mahdi.jc-hosting.me, ports 6661: you should create account to login, and for it, send me private message, in your pm, send me username and passwordh

Thumbs up

6

o sorry for it
dont forget this, you should have bullet.bgt

website: mahdi.jc-hosting.me
email: [email protected]: skype: mahdi.abedi82
my name on playroom: mahdi-abedi
my teamtalk server information: mahdi.jc-hosting.me, ports 6661: you should create account to login, and for it, send me private message, in your pm, send me username and passwordh

Thumbs up

7

hi mahdi, please get in contact with me. if you don't have my email address, go to my website, and click on the send me an email link, and it will open in your email client. i might just need your help and there is some thing else i would like to discuss with you in private also.

best regards
never give up on what ever you are doing.

Thumbs up

8

Have you actually tried to understand the bgt example games in the bgt tutorial? they are very, very well commented and allow you to learn coding. A weapon class is probably different for every game, just like a kitchen is different in every house. They might do the same thing, but each game has other needs. If you'd be creating an fps, a bullit class might have x, y and maybe z coordinates, a specific speed that might decrease with distance traveled and a course. Also damage, but you could also calculate that with speed and maybe radius.

Roel
golfing in the kitchen

Thumbs up

9

A weapon consists of these things:

  • What sound to play when the weapon is fired,

  • How fast the projectile should move towards the target,

  • How far can the projectile go,

  • How much damage can the projectile do.

There is an infinitely many number of ways to code a weapon, but sadly there is no include statement that will magically give you weapons. Weapons are customized to each codebase and come with different attributes, speeds, behaviors, etc.

Check this file for an example:
https://raw.githubusercontent.com/munaw … hipGuns.cs

Thumbs up