Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

index-out-of-bounds at collision with animationframe #13

Open
GoogleCodeExporter opened this issue Feb 10, 2016 · 0 comments
Open

index-out-of-bounds at collision with animationframe #13

GoogleCodeExporter opened this issue Feb 10, 2016 · 0 comments

Comments

@GoogleCodeExporter
Copy link

hey guys,
english isn't my first language and im not a proffesional in java so 
please correct me if im wrong at something.

my problem:
If you have a sprite of type AdvanceSprite with a animationframe which is 
longer than the getImages() array, and you use a subclass of 
PreciseCollisionGroup or lower to check collisions, you will get a 
IndexOutOfBounds exeption in case of a collision.

Found out why: In the isCollided method, the method getImage() is invoked. 
This is the one in AnimatedSprite. It returns the image at the index equal 
to getFrame() in the imagearray so when getFrame() > getImages().length 
the exeption is thrown and getFrame() will be so when you want to repeat a 
image in your animation.

This is a bug because its impossible to repeat images in a animation more 
than 1 time because of it, even while this is the case in the example 
given in the description of isCollided.

i found a work around by chanceing the imagefile I use for the animation 
but you guys might want to check it out. if it mended to be so, please 
explain it to me what im doing wrong.

greetings, peter

ps: uploading .java files of my game on demand if you want.

Original issue reported on code.google.com by peter_bo...@msn.com on 5 Oct 2009 at 7:57

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant