-
-
Notifications
You must be signed in to change notification settings - Fork 709
Particlebugfix #1473
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
Open
jasmine3339
wants to merge
11
commits into
AlmasB:dev
Choose a base branch
from
jasmine3339:particlebugfix
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+79
−1
Open
Particlebugfix #1473
Changes from 9 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
526cf45
uploaded particle sample 2
jasmine3339 2e796d0
updated particle and particleemitter
jasmine3339 1ddedb4
explained difference in circles, and why this is important
jasmine3339 c42d404
added particleScaleSample
jasmine3339 82f6c23
Refactor Particle class by removing 'corrected' field
jasmine3339 8404265
Delete fxgl-samples/src/main/java/intermediate/particles/ParticleScal…
jasmine3339 9ae0235
Remove corrected field and setter from ParticleEmitter
jasmine3339 ddfee1d
removing reference to corrected
jasmine3339 1af9f33
Remove corrected flag setting for emitted particles
jasmine3339 85ca8cd
fixing unnecessary changes to file
jasmine3339 a0e17e9
reset particle emitter to original code
jasmine3339 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
fxgl-samples/src/main/java/intermediate/particles/ParticleScaleSample2.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| package intermediate.particles; | ||
|
|
||
| import com.almasb.fxgl.animation.Interpolators; | ||
| import com.almasb.fxgl.app.GameApplication; | ||
| import com.almasb.fxgl.app.GameSettings; | ||
| import com.almasb.fxgl.core.math.FXGLMath; | ||
| import com.almasb.fxgl.dsl.components.ExpireCleanComponent; | ||
| import com.almasb.fxgl.dsl.components.ProjectileComponent; | ||
| import com.almasb.fxgl.particle.ParticleComponent; | ||
| import com.almasb.fxgl.particle.ParticleEmitters; | ||
| import javafx.geometry.Point2D; | ||
| import javafx.scene.effect.BlendMode; | ||
| import javafx.scene.paint.Color; | ||
| import javafx.scene.shape.Circle; | ||
| import javafx.util.Duration; | ||
|
|
||
| import java.util.function.Supplier; | ||
|
|
||
| import static com.almasb.fxgl.dsl.FXGL.*; | ||
| import static com.almasb.fxgl.dsl.FXGL.entityBuilder; | ||
| import static com.almasb.fxgl.dsl.FXGL.random; | ||
| import static com.almasb.fxgl.dsl.FXGL.runOnce; | ||
| import static com.almasb.fxgl.dsl.FXGL.texture; | ||
|
|
||
| public class ParticleScaleSample2 extends GameApplication{ | ||
| @Override | ||
| protected void initSettings(GameSettings settings) { | ||
| settings.setWidth(1280); | ||
| settings.setHeight(720); | ||
| } | ||
|
|
||
| @Override | ||
| protected void initGame() { | ||
| getGameScene().setBackgroundColor(Color.BLACK); | ||
|
|
||
| //this circle has a difference in the x and the y points in the scale | ||
| spawnMinor(new Point2D(450, 300), false); | ||
|
|
||
| //this cricle has the same x and y points in the scale | ||
| spawnMinor(new Point2D(450, 300), true); | ||
|
|
||
| //both of their locations are the same, they should spawn in the same space. but because the x point is affected by the scale, the circles appear in different locations. | ||
| //this shows the biggest issue with this bug, the x value is being affected by the y scale, when it should not be. | ||
| } | ||
|
|
||
| private void spawnMinor(Point2D p, Boolean pointsTheSame) { | ||
| var emitter = ParticleEmitters.newExplosionEmitter(17); | ||
|
|
||
| //this sets the new points to be either the same or different | ||
| if (pointsTheSame) { | ||
| emitter.setEntityScaleFunction(() -> new Point2D(1, 1)); | ||
| } else { | ||
| emitter.setEntityScaleFunction(() -> new Point2D(1, 2)); | ||
| } | ||
| emitter.setExpireFunction(i -> Duration.seconds(10)); | ||
| emitter.setSize(10, 20); | ||
| entityBuilder() | ||
| .at(p) | ||
| .with(new ParticleComponent(emitter)) | ||
| .with(new ExpireCleanComponent(Duration.seconds(3)).animateOpacity()) | ||
| .zIndex(100) | ||
| .buildAndAttach(); | ||
| } | ||
|
|
||
| public static void main(String[] args) { | ||
| launch(args); | ||
| } | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.