Tell me more ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I got a staggered iso map that I want to be able to drag scroll with the mouse. I have it almost working but it is a bit glitchy, especially near the borders. Maybe you have an idea how to fix that.

Here is the full example with random data: http://jsfiddle.net/FTKwR/

share|improve this question
3  
-1 This is either too vague or localized question (depends if one ignores the link or not). To smoothly scroll a staggered map, set X, Y offsets to mouse cursor X, Y coordinates. Anyway, welcome to GDSE and please look at site's FAQ: gamedev.stackexchange.com/faq – Markus von Broady Oct 25 '12 at 14:00

closed as not a real question by Jonathan Hobbs, Laurent Couvidou, Byte56, Maik Semder, Noctrine Oct 25 '12 at 17:36

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, see the FAQ.

1 Answer

This will get closed, but i'll try to help you until then. Your attempt to smooth the movement is screwing you over because you're not including that in your collision checks. So even though your camera is at position 0 or maximum after collision checking your smooth offsets it when rendering and since this offset changes in the range (0, 1) of your tile's size you get jittering because you keep recalculating it each mouse move.

Personally i'd rework most of the code, but this is the immediate issue. Assuming your calculations are correct and skipping your poor coding practices, which i assume are a quick hack, you should either cut the smoothing, since it's kind of unnecessary IMHO, or you should check whether your camera is near an edge before calculating your smoothing.

share|improve this answer
I don't have much experience with JS and the canvas. I would like to know what kind of code improvements you are suggesting. – Chris Oct 25 '12 at 15:25
Answering questions you know will be closed (because they're off topic) is not good for the site. It promotes people asking these questions anyway because they think someone will answer them even if it's off topic. It's best to direct them to another site and answer their question there, or invite them to chat (if they have enough rep). – Byte56 Oct 25 '12 at 15:43

Not the answer you're looking for? Browse other questions tagged or ask your own question.