Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Weapon Heat Variable (Spray Pattern / Spread) #294

Open
0xE69 opened this issue Apr 3, 2024 · 0 comments
Open

Weapon Heat Variable (Spray Pattern / Spread) #294

0xE69 opened this issue Apr 3, 2024 · 0 comments
Assignees
Labels
Bug Something isn't working Improvement New feature or request Urgent

Comments

@0xE69
Copy link
Collaborator

0xE69 commented Apr 3, 2024

Weapon spray pattern needs to be more of a V or Diamond Shape so that it starts at the bottom of the V, As you shoot the weapon goes up and the accuracy goes down. https://youtu.be/-z0gDmojzHM?t=88

Each weapon should have a heat variable. This variable starts at 0 and increases every time the weapon is fired. Over time, this variable should decrease gradually back toward 0, simulating the weapon cooling down.

You'll need to pick a non-random function that will determine the radius (r) and angle (theta, t) of the bullet spread based on the current heat (h) of the weapon. This function defines the shape of your spray pattern (V or diamond). For simplicity, let's start with a basic V-shaped pattern.

We need a heat veriable for weapons.
protected float heat = 0.0F;
protected final float heatIncreasePerShot = 1.0F; // Adjust as needed
protected final float heatDecreasePerTick = 0.05F; // Adjust as needed
Whenever the gun fires, increase the heat variable. This could be done in the handleShoot method or wherever the gun's shooting logic is implemented.
In the handleTick method, gradually decrease the heat over time to simulate cooling down.
Create a method to calculate the bullet spread (radius r and angle theta) based on the current heat. For a simple V-shaped pattern, you might increase the spread linearly with heat and alternate the angle to spread shots left and right as heat increases.
When handling a shot in handleShoot, use the bullet spread calculations to adjust the bullet's trajectory.
We need to be able to adjust the heat increase per shot, the heat decrease per tick, and the bullet spread calculation.

@0xE69 0xE69 added Bug Something isn't working Improvement New feature or request Urgent labels Apr 3, 2024
@0xE69 0xE69 self-assigned this Apr 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Improvement New feature or request Urgent
Projects
None yet
Development

No branches or pull requests

1 participant