Error running my program in libGDX Minidumps are not enabled

0

i am coding a game using libGDX from Java.

Everything was working fine until now, the problem is when i am adding figures in my game. My game does not run in the IDE when i put five new materials (figures) on it. But when i add just four materiales, it works fine.

The problem is when i run the program from eclipse Neon IDE, when i export a jar for the game it works fine!

Here is the error that i am getting:

       Execution protection violation
    #
    # A fatal error has been detected by the Java Runtime Environment:
    #
   #  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x417b999a, pid=5488, 
  tid=0x000015dc
   #

    # JRE version: Java(TM) SE Runtime Environment (8.0_121-b13) (build 1.8.0_121-b13)
    # Java VM: Java HotSpot(TM) Client VM (25.121-b13 mixed mode, sharing windows-x86 )
    # Problematic frame:
    # C  0x417b999a
    #
    # Failed to write core dump. Minidumps are not enabled by default on client versions of Windows
    #
    # An error report file with more information is saved as:
    # C:\Users\HOME\Desktop\videoGameGit\videogameGit\hs_err_pid5488.log
    #
    # 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 file hs_err_pid5488.log is here:

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x417b999a, pid=5488, tid=0x000015dc
#
# JRE version: Java(TM) SE Runtime Environment (8.0_121-b13) (build 1.8.0_121-b13)
# Java VM: Java HotSpot(TM) Client VM (25.121-b13 mixed mode, sharing windows-x86 )
# Problematic frame:
# C  0x417b999a
#
# 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.
#

---------------  T H R E A D  ---------------

Current thread (0x14818400):  JavaThread "LWJGL Application" [_thread_in_native, id=5596, stack(0x14af0000,0x14b40000)]

siginfo: ExceptionCode=0xc0000005, ExceptionInformation=0x00000008 0x417b999a

Registers:
EAX=0x005aff50, EBX=0x148f2778, ECX=0x148f5f80, EDX=0x148ca2a0
ESP=0x14b3f60c, EBP=0x148b0c18, ESI=0x148f5f80, EDI=0x14b3f674
EIP=0x417b999a, EFLAGS=0x00010202

Top of Stack: (sp=0x14b3f60c)
0x14b3f60c:   6cee0256 005aff50 148b0c18 14083358
0x14b3f61c:   14b3f64c 14084c58 00000000 140833d0
0x14b3f62c:   148f2778 148b0c18 148f5f80 14b3f6f8
0x14b3f63c:   6cedf285 148f5f80 148b0c18 148f2778
0x14b3f64c:   14b3f674 141d1810 141d1810 14818400
0x14b3f65c:   6cee8834 148f2778 14b3f674 00000000
0x14b3f66c:   14b3f698 14b3f6ec 005aff50 00000000
0x14b3f67c:   00000000 00000000 00000000 00010000 

Instructions: (pc=0x417b999a)
0x417b997a:   
[error occurred during error reporting (printing registers, top of stack, instructions near pc), id 0xc0000005]

Register to memory mapping:

EAX=0x005aff50 is an unknown value
EBX=0x148f2778 is an unknown value
ECX=0x148f5f80 is an unknown value
EDX=0x148ca2a0 is an unknown value
ESP=0x14b3f60c is pointing into the stack for thread: 0x14818400
EBP=0x148b0c18 is an unknown value
ESI=0x148f5f80 is an unknown value
EDI=0x14b3f674 is pointing into the stack for thread: 0x14818400


Stack: [0x14af0000,0x14b40000],  sp=0x14b3f60c,  free space=317k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C  0x417b999a

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j  com.badlogic.gdx.physics.box2d.Body.jniCreateFixture(JJFFFZSSS)J+0
j  com.badlogic.gdx.physics.box2d.Body.createFixture(Lcom/badlogic/gdx/physics/box2d/FixtureDef;)Lcom/badlogic/gdx/physics/box2d/Fixture;+49
j  box2D.map00.buildMap(Lcom/badlogic/gdx/physics/box2d/World;)V+1210
j  box2D.maps.chooseMap(I)V+160
j  box2D.box2DCode.create()V+153
j  com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop()V+29
j  com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run()V+27
v  ~StubRoutines::call_stub

---------------  P R O C E S S  ---------------

Java Threads: ( => current thread )
  0x18b50400 JavaThread "AsynchExecutor-Thread" daemon [_thread_blocked, id=5188, stack(0x15f80000,0x15fd0000)]
  0x0123c000 JavaThread "DestroyJavaVM" [_thread_blocked, id=5064, stack(0x01960000,0x019b0000)]
=>0x14818400 JavaThread "LWJGL Application" [_thread_in_native, id=5596, stack(0x14af0000,0x14b40000)]
  0x017a3800 JavaThread "Service Thread" daemon [_thread_blocked, id=4432, stack(0x03ca0000,0x03cf0000)]
  0x01771800 JavaThread "C1 CompilerThread0" daemon [_thread_blocked, id=5112, stack(0x145b0000,0x14600000)]
  0x0176f400 JavaThread "Attach Listener" daemon [_thread_blocked, id=5304, stack(0x14520000,0x14570000)]
  0x0176c400 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=4672, stack(0x144d0000,0x14520000)]
  0x01764000 JavaThread "Finalizer" daemon [_thread_blocked, id=6124, stack(0x142d0000,0x14320000)]
  0x01707800 JavaThread "Reference Handler" daemon [_thread_blocked, id=1416, stack(0x03d40000,0x03d90000)]

Other Threads:
  0x01703400 VMThread [stack: 0x03db0000,0x03e00000] [id=5316]
  0x017b7c00 WatcherThread [stack: 0x14650000,0x146a0000] [id=628]

VM state:not at safepoint (normal execution)

VM Mutex/Monitor currently owned by a thread: None

Heap:
 def new generation   total 4928K, used 4928K [0x03e00000, 0x04350000, 0x09350000)
  eden space 4416K, 100% used [0x03e00000, 0x04250000, 0x04250000)
  from space 512K, 100% used [0x04250000, 0x042d0000, 0x042d0000)
  to   space 512K,   0% used [0x042d0000, 0x042d0000, 0x04350000)
 tenured generation   total 10944K, used 2014K [0x09350000, 0x09e00000, 0x13e00000)
   the space 10944K,  18% used [0x09350000, 0x095479e8, 0x09547a00, 0x09e00000)
 Metaspace       used 2026K, capacity 3987K, committed 4032K, reserved 4480K

Card table byte_map: [0x01240000,0x012d0000] byte_map_base: 0x01221000

Polling page: 0x00170000

CodeCache: size=32768Kb used=1115Kb max_used=1115Kb free=31652Kb
 bounds [0x01c80000, 0x01d98000, 0x03c80000]
 total_blobs=468 nmethods=214 adapters=186
 compilation: enabled

Compilation events (10 events):
Event: 1.245 Thread 0x01771800  209             java.util.zip.ZipFile::ensureOpen (37 bytes)
Event: 1.245 Thread 0x01771800 nmethod 209 0x01d93f48 code [0x01d94060, 0x01d94208]
Event: 1.245 Thread 0x01771800  210             java.util.zip.ZipCoder::getBytes (192 bytes)
Event: 1.247 Thread 0x01771800 nmethod 210 0x01d94308 code [0x01d94530, 0x01d9506c]
Event: 1.247 Thread 0x01771800  211             java.util.zip.ZipCoder::encoder (35 bytes)
Event: 1.247 Thread 0x01771800 nmethod 211 0x01d95a08 code [0x01d95b10, 0x01d95bfc]
Event: 1.254 Thread 0x01771800  213             java.lang.String::<init> (10 bytes)
Event: 1.254 Thread 0x01771800 nmethod 213 0x01d96708 code [0x01d96800, 0x01d96890]
Event: 1.254 Thread 0x01771800  214             java.lang.System::getSecurityManager (4 bytes)
Event: 1.254 Thread 0x01771800 nmethod 214 0x01d968c8 code [0x01d969c0, 0x01d96a30]

GC Heap History (4 events):
Event: 0.679 GC heap before
{Heap before GC invocations=0 (full 0):
 def new generation   total 4928K, used 4404K [0x03e00000, 0x04350000, 0x09350000)
  eden space 4416K,  99% used [0x03e00000, 0x0424d180, 0x04250000)
  from space 512K,   0% used [0x04250000, 0x04250000, 0x042d0000)
  to   space 512K,   0% used [0x042d0000, 0x042d0000, 0x04350000)
 tenured generation   total 10944K, used 0K [0x09350000, 0x09e00000, 0x13e00000)
   the space 10944K,   0% used [0x09350000, 0x09350000, 0x09350200, 0x09e00000)
 Metaspace       used 812K, capacity 2824K, committed 2880K, reserved 4480K
Event: 0.686 GC heap after
Heap after GC invocations=1 (full 0):
 def new generation   total 4928K, used 512K [0x03e00000, 0x04350000, 0x09350000)
  eden space 4416K,   0% used [0x03e00000, 0x03e00000, 0x04250000)
  from space 512K, 100% used [0x042d0000, 0x04350000, 0x04350000)
  to   space 512K,   0% used [0x04250000, 0x04250000, 0x042d0000)
 tenured generation   total 10944K, used 772K [0x09350000, 0x09e00000, 0x13e00000)
   the space 10944K,   7% used [0x09350000, 0x094110c8, 0x09411200, 0x09e00000)
 Metaspace       used 812K, capacity 2824K, committed 2880K, reserved 4480K
}
Event: 0.972 GC heap before
{Heap before GC invocations=1 (full 0):
 def new generation   total 4928K, used 4928K [0x03e00000, 0x04350000, 0x09350000)
  eden space 4416K, 100% used [0x03e00000, 0x04250000, 0x04250000)
  from space 512K, 100% used [0x042d0000, 0x04350000, 0x04350000)
  to   space 512K,   0% used [0x04250000, 0x04250000, 0x042d0000)
 tenured generation   total 10944K, used 772K [0x09350000, 0x09e00000, 0x13e00000)
   the space 10944K,   7% used [0x09350000, 0x094110c8, 0x09411200, 0x09e00000)
 Metaspace       used 1832K, capacity 3795K, committed 3904K, reserved 4480K
Event: 0.978 GC heap after
Heap after GC invocations=2 (full 0):
 def new generation   total 4928K, used 512K [0x03e00000, 0x04350000, 0x09350000)
  eden space 4416K,   0% used [0x03e00000, 0x03e00000, 0x04250000)
  from space 512K, 100% used [0x04250000, 0x042d0000, 0x042d0000)
  to   space 512K,   0% used [0x042d0000, 0x042d0000, 0x04350000)
 tenured generation   total 10944K, used 2014K [0x09350000, 0x09e00000, 0x13e00000)
   the space 10944K,  18% used [0x09350000, 0x095479e8, 0x09547a00, 0x09e00000)
 Metaspace       used 1832K, capacity 3795K, committed 3904K, reserved 4480K
}

Deoptimization events (0 events):
No events

Internal exceptions (10 events):
Event: 0.291 Thread 0x0123c000 Exception <a 'org/lwjgl/LWJGLException'> (0x04034690) thrown at [C:\workspace\8-2-build-windows-i586-cygwin\jdk8u121\8372\hotspot\src\share\vm\prims\jni.cpp, line 709]
Event: 0.291 Thread 0x0123c000 Exception <a 'org/lwjgl/LWJGLException'> (0x04034c40) thrown at [C:\workspace\8-2-build-windows-i586-cygwin\jdk8u121\8372\hotspot\src\share\vm\prims\jni.cpp, line 709]
Event: 0.291 Thread 0x0123c000 Exception <a 'org/lwjgl/LWJGLException'> (0x040351a0) thrown at [C:\workspace\8-2-build-windows-i586-cygwin\jdk8u121\8372\hotspot\src\share\vm\prims\jni.cpp, line 709]
Event: 0.291 Thread 0x0123c000 Exception <a 'org/lwjgl/LWJGLException'> (0x04035678) thrown at [C:\workspace\8-2-build-windows-i586-cygwin\jdk8u121\8372\hotspot\src\share\vm\prims\jni.cpp, line 709]
Event: 0.291 Thread 0x0123c000 Exception <a 'org/lwjgl/LWJGLException'> (0x04035b10) thrown at [C:\workspace\8-2-build-windows-i586-cygwin\jdk8u121\8372\hotspot\src\share\vm\prims\jni.cpp, line 709]
Event: 0.292 Thread 0x0123c000 Exception <a 'org/lwjgl/LWJGLException'> (0x04036028) thrown at [C:\workspace\8-2-build-windows-i586-cygwin\jdk8u121\8372\hotspot\src\share\vm\prims\jni.cpp, line 709]
Event: 0.292 Thread 0x0123c000 Exception <a 'org/lwjgl/LWJGLException'> (0x040365d0) thrown at [C:\workspace\8-2-build-windows-i586-cygwin\jdk8u121\8372\hotspot\src\share\vm\prims\jni.cpp, line 709]
Event: 0.292 Thread 0x0123c000 Exception <a 'org/lwjgl/LWJGLException'> (0x04036ac0) thrown at [C:\workspace\8-2-build-windows-i586-cygwin\jdk8u121\8372\hotspot\src\share\vm\prims\jni.cpp, line 709]
Event: 0.292 Thread 0x0123c000 Exception <a 'org/lwjgl/LWJGLException'> (0x04036f38) thrown at [C:\workspace\8-2-build-windows-i586-cygwin\jdk8u121\8372\hotspot\src\share\vm\prims\jni.cpp, line 709]
Event: 0.293 Thread 0x0123c000 Exception <a 'org/lwjgl/LWJGLException'> (0x040374e0) thrown at [C:\workspace\8-2-build-windows-i586-cygwin\jdk8u121\8372\hotspot\src\share\vm\prims\jni.cpp, line 709]

Events (10 events):
Event: 1.253 loading class com/badlogic/gdx/physics/box2d/PolygonShape
Event: 1.253 loading class com/badlogic/gdx/physics/box2d/PolygonShape done
Event: 1.254 loading class box2D/Materials
Event: 1.254 loading class box2D/Materials done
Event: 1.255 loading class com/badlogic/gdx/graphics/g2d/Sprite
Event: 1.255 loading class com/badlogic/gdx/graphics/g2d/Sprite done
Event: 1.256 Executing VM operation: Deoptimize
Event: 1.256 Executing VM operation: Deoptimize done
Event: 1.260 loading class box2D/Bag$Node
Event: 1.260 loading class box2D/Bag$Node done


Dynamic libraries:
0x003e0000 - 0x00413000     C:\Program Files\Java\jre1.8.0_121\bin\javaw.exe
0x77c30000 - 0x77d6c000     C:\Windows\SYSTEM32\ntdll.dll
0x778b0000 - 0x77984000     C:\Windows\system32\kernel32.dll
0x75e90000 - 0x75eda000     C:\Windows\system32\KERNELBASE.dll
0x77470000 - 0x77510000     C:\Windows\system32\ADVAPI32.dll
0x76330000 - 0x763dc000     C:\Windows\system32\msvcrt.dll
0x77da0000 - 0x77db9000     C:\Windows\SYSTEM32\sechost.dll
0x77b80000 - 0x77c21000     C:\Windows\system32\RPCRT4.dll
0x76580000 - 0x76649000     C:\Windows\system32\USER32.dll
0x76720000 - 0x7676e000     C:\Windows\system32\GDI32.dll
0x77d90000 - 0x77d9a000     C:\Windows\system32\LPK.dll
0x76290000 - 0x7632d000     C:\Windows\system32\USP10.dll
0x74d10000 - 0x74eae000     C:\Windows\WinSxS\x86_microsoft.windows.common-controls_6595b64144ccf1df_6.0.7600.16385_none_421189da2b7fabfc\COMCTL32.dll
0x77410000 - 0x77467000     C:\Windows\system32\SHLWAPI.dll
0x77d70000 - 0x77d8f000     C:\Windows\system32\IMM32.DLL
0x76650000 - 0x7671c000     C:\Windows\system32\MSCTF.dll
0x6e8b0000 - 0x6e96f000     C:\Program Files\Java\jre1.8.0_121\bin\msvcr100.dll
0x5bde0000 - 0x5c1ae000     C:\Program Files\Java\jre1.8.0_121\bin\client\jvm.dll
0x72520000 - 0x72527000     C:\Windows\system32\WSOCK32.dll
0x773d0000 - 0x77405000     C:\Windows\system32\WS2_32.dll
0x76080000 - 0x76086000     C:\Windows\system32\NSI.dll
0x70740000 - 0x70772000     C:\Windows\system32\WINMM.dll
0x75280000 - 0x75289000     C:\Windows\system32\VERSION.dll
0x77dc0000 - 0x77dc5000     C:\Windows\system32\PSAPI.DLL
0x70670000 - 0x7067c000     C:\Program Files\Java\jre1.8.0_121\bin\verify.dll
0x60fb0000 - 0x60fd1000     C:\Program Files\Java\jre1.8.0_121\bin\java.dll
0x705e0000 - 0x705f3000     C:\Program Files\Java\jre1.8.0_121\bin\zip.dll
0x76780000 - 0x773c9000     C:\Windows\system32\SHELL32.dll
0x77510000 - 0x7766c000     C:\Windows\system32\ole32.dll
0x75d80000 - 0x75d8b000     C:\Windows\system32\profapi.dll
0x6cec0000 - 0x6cf42000     C:\Users\HOME\AppData\Local\Temp\libgdxHOME\6df0928e\gdx.dll
0x012d0000 - 0x0131c000     C:\Users\HOME\AppData\Local\Temp\libgdxHOME\52d76f2b\lwjgl.dll
0x67e40000 - 0x67f08000     C:\Windows\system32\OPENGL32.dll
0x6f680000 - 0x6f6a2000     C:\Windows\system32\GLU32.dll
0x61820000 - 0x61907000     C:\Windows\system32\DDRAW.dll
0x6f7e0000 - 0x6f7e6000     C:\Windows\system32\DCIMAN32.dll
0x763e0000 - 0x7657d000     C:\Windows\system32\SETUPAPI.dll
0x76050000 - 0x76077000     C:\Windows\system32\CFGMGR32.dll
0x77dd0000 - 0x77e5f000     C:\Windows\system32\OLEAUT32.dll
0x76030000 - 0x76042000     C:\Windows\system32\DEVOBJ.dll
0x74860000 - 0x74873000     C:\Windows\system32\dwmapi.dll
0x018d0000 - 0x01935000     C:\Users\HOME\AppData\Local\Temp\libgdxHOME\52d76f2b\OpenAL32.dll
0x75cd0000 - 0x75cdc000     C:\Windows\system32\CRYPTBASE.dll
0x74b90000 - 0x74bd0000     C:\Windows\system32\uxtheme.dll
0x776f0000 - 0x77773000     C:\Windows\system32\CLBCatQ.DLL
0x74bd0000 - 0x74cc5000     C:\Windows\System32\PROPSYS.dll
0x75ee0000 - 0x75f0d000     C:\Windows\system32\WINTRUST.dll
0x75f10000 - 0x7602c000     C:\Windows\system32\CRYPT32.dll
0x75df0000 - 0x75dfc000     C:\Windows\system32\MSASN1.dll
0x67f60000 - 0x67fd2000     C:\Windows\system32\dsound.dll
0x74670000 - 0x74695000     C:\Windows\system32\POWRPROF.dll
0x74880000 - 0x748b9000     C:\Windows\System32\MMDevApi.dll
0x74230000 - 0x74266000     C:\Windows\system32\AUDIOSES.DLL
0x158c0000 - 0x15cb2000     C:\Windows\system32\ig4icd32.dll
0x15cc0000 - 0x15f5a000     C:\Windows\system32\ig4dev32.dll
0x6d2d0000 - 0x6d349000     C:\Windows\system32\mscms.dll
0x753e0000 - 0x753f7000     C:\Windows\system32\USERENV.dll
0x6e870000 - 0x6e8a8000     C:\Windows\system32\icm32.dll
0x72390000 - 0x7247b000     C:\Windows\system32\dbghelp.dll

VM Arguments:
jvm_args: -Dfile.encoding=Cp1252 
java_command: box2D.Main
java_class_path (initial): C:\Users\HOME\Desktop\videoGameGit\videogameGit\box2DExample\bin;C:\Users\HOME\Desktop\Nueva carpeta (2)\libgdx-0.9.9\gdx.jar;C:\Users\HOME\Desktop\Nueva carpeta (2)\libgdx-0.9.9\gdx-1.7.1.jar;C:\Users\HOME\Desktop\Nueva carpeta (2)\libgdx-0.9.9\gdx-ai-1.7.0.jar;C:\Users\HOME\Desktop\Nueva carpeta (2)\libgdx-0.9.9\gdx-backend-android.jar;C:\Users\HOME\Desktop\Nueva carpeta (2)\libgdx-0.9.9\gdx-backend-gwt.jar;C:\Users\HOME\Desktop\Nueva carpeta (2)\libgdx-0.9.9\gdx-backend-jglfw.jar;C:\Users\HOME\Desktop\Nueva carpeta (2)\libgdx-0.9.9\gdx-backend-jglfw-natives.jar;C:\Users\HOME\Desktop\Nueva carpeta (2)\libgdx-0.9.9\gdx-backend-lwjgl.jar;C:\Users\HOME\Desktop\Nueva carpeta (2)\libgdx-0.9.9\gdx-backend-lwjgl-natives.jar;C:\Users\HOME\Desktop\Nueva carpeta (2)\libgdx-0.9.9\gdx-backend-robovm.jar;C:\Users\HOME\Desktop\Nueva carpeta (2)\libgdx-0.9.9\gdx-natives.jar;C:\Users\HOME\Desktop\Nueva carpeta (2)\libgdx-0.9.9\gdx-openal.jar;C:\Users\HOME\Desktop\Nueva carpeta (2)\libgdx-0.9.9\gdx-pe-loader-1.1.0.jar;C:\Users\HOME\Desktop\Nueva carpeta (2)\libgdx-0.9.9\gdx-pe-loader-1.1.0-sources.jar;C:\Users\HOME\Desktop\Nueva carpeta (2)\libgdx-0.9.9\gdx-setup.jar;C:\Users\HOME\Desktop\Nueva carpeta (2)\libgdx-0.9.9\gdx-setup-ui.jar
Launcher Type: SUN_STANDARD

Environment Variables:
PATH=C:/Program Files/Java/jre1.8.0_121/bin/client;C:/Program Files/Java/jre1.8.0_121/bin;C:/Program Files/Java/jre1.8.0_121/lib/i386;C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\eclipse;
USERNAME=HOME
OS=Windows_NT
PROCESSOR_IDENTIFIER=x86 Family 6 Model 15 Stepping 13, GenuineIntel



---------------  S Y S T E M  ---------------

OS: Windows 7 Build 7600 (6.1.7600.16385)

CPU:total 2 (2 cores per cpu, 1 threads per core) family 6 model 15 stepping 13, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ssse3, tsc

Memory: 4k page, physical 2087160k(547108k free), swap 4174320k(2210268k free)

vm_info: Java HotSpot(TM) Client VM (25.121-b13) for windows-x86 JRE (1.8.0_121-b13), built on Dec 12 2016 18:17:00 by "java_re" with MS VC++ 10.0 (VS2010)

time: Fri Dec 07 17:38:45 2018
elapsed time: 1 seconds (0d 0h 0m 1s)

Here is the part of my code that i am getting this error

public void buildMap(World world) { 


 // LoadingMaterials when i add these five materials the program does not 
    //run in my eclipse neon IDE, and when i add just four it does...
   //There seems to be a limit to adding sprites in my game

    colMaterials[cantM].add(new Materials(30, 42, world, 0, 0));
    colMaterials[cantM].add(new Materials(32, 38, world, 0, 0));
    colMaterials[cantM].add(new Materials(15, 3, world, 1, 20));
    colMaterials[cantM].add(new Materials(35, 40, world, 2, 20));
    colMaterials[cantM].add(new Materials(62, 44, world, 3, 0));
    BodyDef bodyDef = new BodyDef();
    FixtureDef fixtureDef = new FixtureDef();

public void addMaterial(Materials material){

    colMaterials[cantM].add(material);
    cantM++;
}

If you want to see my material class, here it is:

public class Materials {//I just add the path to build and 
            //render my material, and draw it on the screen

private World world;
private float x, y, sizeX, sizeY;
private Body body;
private Sprite sprite;
private Array<Body> tmpBodies = new Array<Body>();
private float angle;

private final String[] materialdir = {
        "C:/Users/HOME/Desktop/videoGameGit/videogameGit/box2DExample-android/assets/data/sprites/materials/chair.png",
        "C:/Users/HOME/Desktop/videoGameGit/videogameGit/box2DExample-android/assets/data/sprites/materials/rotableChair.png",
        "C:/Users/HOME/Desktop/videoGameGit/videogameGit/box2DExample-android/assets/data/sprites/materials/circularTable.png", "C:/Users/HOME/Desktop/videoGameGit/videogameGit/box2DExample-android/assets/data/sprites/materials/bed.png", "sprites/materials/officeChair.png",
        "sprites/materials/squaredTable", "sprites/materials/fsharp/", "sprites/materials/g/",
        "sprites/materials/gsharp/", "sprites/materials/a/", "sprites/materials/asharp/", "sprites/materials/b/" };

public Materials(int posX, int posY, World world, int opcMaterial, float angle) {
    this.x = posX;
    this.y = posY;
    this.angle=angle * MathUtils.radiansToDegrees;
    this.world = world;
    switch (opcMaterial) {
    case 0:
        this.sprite = new Sprite(new Texture(materialdir[0]));
        buildMaterial("chair");
        break;
    case 1:
        this.sprite = new Sprite(new Texture(materialdir[1]));
        buildMaterial("rotableChair");
        break;
    case 2:
        this.sprite = new Sprite(new Texture(materialdir[2]));
        buildMaterial("circularTable");
        break;
    case 3:
        this.sprite = new Sprite(new Texture(materialdir[3]));
        buildMaterial("bed");
        break;
    }
}

public Vector2 getPosition() {
    return body.getPosition();
}

public void destroy() {

}

private void buildMaterial(String name) {
    BodyDef bodyDef = new BodyDef();
    FixtureDef fixtureDef = new FixtureDef();
    if (name.equals("chair")) {

        sizeX=5.5f;
        sizeY=5.5f;
        bodyDef.type = BodyType.DynamicBody;
        PolygonShape chair = new PolygonShape();
        chair.setAsBox(1.3f, 1.1f, new Vector2(0, 0), 0);
        fixtureDef.shape = chair;
        fixtureDef.density = 2.5f;
        fixtureDef.friction = 10;
        fixtureDef.restitution = 0f;
        body = world.createBody(bodyDef);
        body.setTransform(x, y, angle);
        body.createFixture(fixtureDef);
        body.setAngularDamping(5);
        body.setLinearDamping(5);
        chair.dispose();

    } else if (name.equals("rotableChair")) {

        sizeX=5.5f;
        sizeY=5.5f;
        bodyDef.type = BodyType.DynamicBody;
        PolygonShape rotableChair = new PolygonShape();
        rotableChair.setAsBox(1f, 1f, new Vector2(0, 0), 0);
        fixtureDef.shape = rotableChair;
        fixtureDef.density = 1.5f;
        fixtureDef.friction = 5;
        fixtureDef.restitution = 0f;
        body = world.createBody(bodyDef);
        body.setTransform(x, y, angle);
        body.createFixture(fixtureDef);
        body.setAngularDamping(0.2f);
        body.setLinearDamping(2);
        rotableChair.dispose();

    } else if (name.equals("circularTable")) {

        sizeX=13.5f;
        sizeY=13.5f;
        bodyDef.type = BodyType.StaticBody;
        CircleShape circularTable = new CircleShape();
        circularTable.setPosition(new Vector2(0, 0));
        circularTable.setRadius(4.3f);
        fixtureDef.shape = circularTable;
        body = world.createBody(bodyDef);
        body.createFixture(fixtureDef);
        body.setTransform(x, y, angle);
        circularTable.dispose();

    } else if (name.equals("bed")){

        sizeX=6.5f;
        sizeY=6.5f;
        bodyDef.type = BodyType.DynamicBody;
        PolygonShape bed = new PolygonShape();
        bed.setAsBox(1.5f, 3f, new Vector2(0, 0), 0);
        fixtureDef.shape = bed;
        fixtureDef.density = 55f;
        fixtureDef.friction = 0;
        fixtureDef.restitution = 0f;
        body = world.createBody(bodyDef);
        body.setTransform(x, y, angle);
        body.createFixture(fixtureDef);
        body.setAngularDamping(40);
        body.setLinearDamping(20);
        bed.dispose();

    } else if (name.equals("sofa")){

    } else if (name.equals("desk")){

    } else if (name.equals("mediumDesk")){

    } else if (name.equals("bigDesk")){

    }
}

public void dispose(){
    sprite.getTexture().dispose();
    tmpBodies = new Array<Body>();
}

public void render(SpriteBatch batch) {
    batch.begin();
    sprite.setSize(sizeX, sizeY);
    sprite.setOrigin(sprite.getWidth() / 2, sprite.getHeight() / 2);
    body.setUserData(sprite);
    world.getBodies(tmpBodies);
    for (Body body : tmpBodies)

        if (body.getUserData() != null && body.getUserData() instanceof Sprite) {

            Sprite sprite = (Sprite) body.getUserData();
            sprite.setPosition((body.getPosition().x - sprite.getWidth() / 2),
                    (body.getPosition().y - sprite.getHeight() / 2));
            sprite.setRotation(body.getAngle() * MathUtils.radiansToDegrees);
            sprite.draw(batch);
            body=null;
        }
    batch.end();
}

}

The problem is when i run the program from eclipse Neon IDE, when i export a jar for the game it works fine without problems!

Could you help me with this? thank you!.

java
eclipse
libgdx
sprite

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0