C# 2D platformer movement code

There are a couple of ways to achieve this but following your current implementation: why not set the isGrounded flag to false when you jump and just let the trigger handle resetting the flag when you land? Some things you could check: Are all your colliders 2D and set to be triggers?Have you checked your … Read more

C# Set collection?

Try HashSet: The HashSet(Of T) class provides high-performance set operations. A set is a collection that contains no duplicate elements, and whose elements are in no particular order… The capacity of a HashSet(Of T) object is the number of elements that the object can hold. A HashSet(Of T) object’s capacity automatically increases as elements are added to the object. … Read more

Input string was not in a correct format

The error means that the string you’re trying to parse an integer from doesn’t actually contain a valid integer. It’s extremely unlikely that the text boxes will contain a valid integer immediately when the form is created – which is where you’re getting the integer values. It would make much more sense to update a and b in the … Read more

C# compiler error: “not all code paths return a value”

You’re missing a return statement. When the compiler looks at your code, it’s sees a third path (the else you didn’t code for) that could occur but doesn’t return a value. Hence not all code paths return a value. For my suggested fix, I put a return after your loop ends. The other obvious spot – adding an else that had a return value to the if-else-if – … Read more

Adding values to a C# array

You can do this way – Alternatively, you can use Lists – the advantage with lists being, you don’t need to know the array size when instantiating the list.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)