jQuery in Action, 2nd edition*
The moose likes Game Development and the fly likes What's with this stupid line? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Game Development
Bookmark "What Watch "What New topic
Author

What's with this stupid line?

Jake Cirino
Greenhorn

Joined: Jul 27, 2012
Posts: 17

I don't understand whats going on, I have an image being withdrawn from a spritesheet, and being used as a character that moves around the screen. however a little bit of the image below it sometimes appears when the object moves across the screen up and down, why is this?

SpritesheetCode:
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14074
    
  16

It's hard to say with the code you've given. I don't see anything obviously wrong in the code, one thing that caught my attention was: why are you doing y + 1 on line 26?

Since we can't see what classes org.newdawn.slick.Image and com.fanger.ophidian.util.Array2D are we can't say if the problem is in one of those classes.

What does, for example, the method getSubImage() do that you're calling in line 17?

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
Jake Cirino
Greenhorn

Joined: Jul 27, 2012
Posts: 17

Jesper de Jong wrote:It's hard to say with the code you've given. I don't see anything obviously wrong in the code, one thing that caught my attention was: why are you doing y + 1 on line 26?

Since we can't see what classes org.newdawn.slick.Image and com.fanger.ophidian.util.Array2D are we can't say if the problem is in one of those classes.

What does, for example, the method getSubImage() do that you're calling in line 17?

For some odd reason when moving things are a multiple of 0.5f it kinda flips out. not a big deal.
 
 
subject: What's with this stupid line?
 
Similar Threads
Using a spritesheet
Most efficient way to use a spritesheet?
single dimension array to multi dimension
Applet/ Animation/ repaint-update-paint ?
JFormattedTextField