• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Array Out of Bounds Exception in Java Tower Defense Game

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey All,

This my first post here and I'd appreciate some help figuring out a bug I'm dealing with. I'm trying to create a 'tower defense' style game in Java and I'm getting an 'Array Out of Bounds' exception whenever I attempt to launch the program. From what I've researched of this particular exception, it seems that I'm trying access a specific array with an index that is either too low in value (less than 0) or too high in value (greater than the max of the array). I'm not sure exactly how exactly to resolve this error, but here's my stack trace and the code for the classes referenced in said stack trace:

Stack Trace:
http://pastebin.com/WGkmTJnm

Turret Dispenser Class:

http://pastebin.com/e7xeNN45

Screen Class:

http://pastebin.com/mfcRaMJC

Room Class:

http://pastebin.com/xK07Yaud


Thanks in advance for any and all help.

See ya on the flipside,

Tempest Desh
 
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch.
The stack trace tells you exactly which line of code generated the exception.
Copy past the full stack trace and the relevant class here to help people help you. Also please UseCodeTags
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic