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

ObjectReferenceException when launching game #2

Open
Hexman768 opened this issue Sep 18, 2024 · 5 comments
Open

ObjectReferenceException when launching game #2

Hexman768 opened this issue Sep 18, 2024 · 5 comments
Labels
bug Something isn't working

Comments

@Hexman768
Copy link

Description

  • As soon as I launched the game I was met with an ObjectReferenceException occurring when trying to set the Position.X value inside the Ball constructor.

Technical Investigation

  • The root cause of this issue may either be that you have already made this change and have just forgot to commit it to master, or perhaps you have a different version of Visual Studio that doesn't throw this error.

Solution

  • The solution is to set the Position attribute before setting Position.X here.
  • I see that you have some pretty formatting going on, so you may want to just set all objects to new instances prior to setting the Id attribute and everything after it.
@Hexman768
Copy link
Author

I think your game here is really cool and looks a lot like 8 ball pool app! Great Job!

@PoLaKoSz PoLaKoSz added the bug Something isn't working label Sep 21, 2024
@PoLaKoSz
Copy link
Owner

Thank You for the input!
Can You try out the dev branch? adc32db commit should fix this. (I do not have Windows installed to test it)

I want to clarify that the original author is Marcelo Ricardo de Oliveira (tutorial).

@Hexman768
Copy link
Author

Gotcha, it is interesting how the game actually works. I am curious to know how they got the background for the image of the pool balls to become transparent, I always have to use GIMP to achieve that effect.

But I will absolutely check out that commit as you are probably right about it resolving the issue. I am curious though, if you do not have Windows installed, then how do you compile your C# projects?

@Hexman768
Copy link
Author

After looking at that commit, that should resolve the issue, hopefully I'll get a couple minutes to try that change!

@PoLaKoSz
Copy link
Owner

I use .NET Core so i can develop, build and run my code not only on Windows, but Linux (Ubuntu in my case) and macOS too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants