• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Array Out of Bounds Exception in Java Tower Defense Game

 
Kian Sattar
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • 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
 
Maneesh Godbole
Saloon Keeper
Posts: 11096
13
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • 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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic