Today I finally had the time to dig into my code (since I don't use Brent's code 1:1, I like to "tidy it up" after each lesson so it adheres to my own standards) and managed to find the culprint.# # A fatal error has been detected by the Java Runtime Environment: # # EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x0000000066bcbd0d, pid=156, tid=7088 # # JRE version: Java(TM) SE Runtime Environment (8.0_45-b15) (build 1.8.0_45-b15) # Java VM: Java HotSpot(TM) 64-Bit Server VM (25.45-b02 mixed mode windows-amd64 compressed oops) # Problematic frame: # C [gdx-box2d64.dll+0xbd0d] # # Failed to write core dump. Minidumps are not enabled by default on client versions of Windows # # If you would like to submit a bug report, please visit: # http://bugreport.java.com/bugreport/crash.jsp # The crash happened outside the Java Virtual Machine in native code. # See problematic frame for where to report the bug. #
The problem was in the end that PlayScreen.update() tried to set the boodies of destroyed Goombas active - that caused the Box2d engine to try to access memory that is not available anymore (Box2D is written in C, there is just a tiny Java-Wrapper around it so it can do that).
The solution is something like this:
In PlayScreen.update() instead of
if(enemy.getX() < player.getX() + 224 / MarioBros.PPM) { enemy.b2body.setActive(true); }
do something like
if(!enemy.isDestroyed() && enemy.getX() < player.getX() + 224 / MarioBros.PPM) { enemy.b2body.setActive(true); }
For that to work we need to create this variable and method in Enemy:
protected boolean destroyed; public boolean isDestroyed() { return destroyed{ }and remove the variable "destroyed" from Goomba and Turtle.
My own current progress can be found here.
man i fucking love you, i've been trying to find why i got this error for 3 days
ReplyDeleteGlad I could help you :)
DeleteLove what you're doing here guys, keep it up!.. exception_access_violation
ReplyDeleteMan, I have a problem with this, I did what you said, my error changed for a while, but still there, I googling for 2 days now, still the same, I played your mario, looked at your source code, but you refactored everything, so we have nothing common now))) please email me frozenito@mail.ru
ReplyDeleteHey, I replied to you via Hangouts but it seems you did not see the message.
DeleteIf you can upload your code somewhere I'll take a look when I get a few minutes time.