File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes Array Out of Bounds Exception in Java Tower Defense Game Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Array Out of Bounds Exception in Java Tower Defense Game" Watch "Array Out of Bounds Exception in Java Tower Defense Game" New topic
Author

Array Out of Bounds Exception in Java Tower Defense Game

Kian Sattar
Greenhorn

Joined: Aug 09, 2013
Posts: 1
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

Joined: Jul 26, 2007
Posts: 10535
    
    9

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


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Array Out of Bounds Exception in Java Tower Defense Game