"left-hand side of an assignment must be a variable, a property, or an indexer" error :(

I’ve been working on this fighting game and i was trying to implement a form of knock back but this error showed up. Can you help me fix this? Keep in mind I am not very good at coding so I might not understand some of the terms. Thank you!

(btw the error is on line 24 where is says:

“currentHealth + damage = RB.AddForce(Vector2.up * JumpForce);”)

,I’ve been working on this fighting game and i was trying to implement a form of knock back but this error showed up. Can you help me fix this? Keep in mind I am not very good at coding so I might not understand some of the terms. Thank you!

(btw the error is on line 24 where is says:

“currentHealth + damage = RB.AddForce(Vector2.up * JumpForce);”)

Add force is a method that returns void i.e. doesnt return a value … you cant assign nothing to a variable.

Not only that but currentHealth + damage is not a variable its an equation you need to do any operations on the right side of an assignment



I suggest you go away and learn the basics of programming before trying to build a game. This is page one programming. Which means you havent even read the first page.