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

"Variable is already assigned to this value" in the init() method of Particle class Bug #28

Open
wee-zard opened this issue Dec 2, 2023 · 0 comments

Comments

@wee-zard
Copy link

wee-zard commented Dec 2, 2023

Arrange:

  • Configuring the environment (with for example Gradle v3.3).
  • Importing the junit .jar files, so we can run junit test cases.

Act:

  • Making an instance of Particle Class
  • Store this instance in a variable
  • Call the init() method on this variable, with the following params: int type, Vector2 position, Vector2 velocity, float lifespan, int numFrames and float delay.

Assert:

  • A new particle instance will be created after the call of the init() method.

Excepting:

  • No unnecessary line of codes run in the method.

Actually:

  • There is an if statement that check, if the anim variable is null and if yes, then assign this variable a null, but the variable already has the value of null, so the if statement is unnecessary in the init() method.

bug2

Possible solution:

  • Delete the 81 line of the Particle Class, since the anim variable has been already assigned to this value.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant