Timeline for HTML5 - Dynamic canvas grid for scrolling a big map
Current License: CC BY-SA 3.0
11 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
May 23, 2017 at 12:37 | history | edited | CommunityBot |
replaced http://stackoverflow.com/ with https://stackoverflow.com/
|
|
Jul 13, 2015 at 1:40 | history | tweeted | twitter.com/#!/StackGameDev/status/620407472856150017 | ||
Mar 13, 2014 at 17:29 | vote | accept | DARKGuy | ||
Mar 13, 2014 at 17:29 | answer | added | DARKGuy | timeline score: 4 | |
Mar 13, 2014 at 8:20 | comment | added | DARKGuy | Alright, after some more struggling I managed to find a way to absolutely position them. My math knowledge sucks, but something was telling me there was a pattern I could convert into a formula. I made this JSFiddle -> jsfiddle.net/B7Jm6/2 working with 32x32 instead of entire screen size just for testing if the formula is right. My idea is to make it work in double-for X-by-Y loop (for y=1 blah blah { for x=1 blah draw(x,y) etc. }), @Anko or someone other, do you happen to know how to simplify it? thanks! | |
Mar 9, 2014 at 21:57 | comment | added | DARKGuy | Hello Anko! thanks for the warm welcome! :) yeah I wanted to post it as an answer, but while it archieves what I want, that whole code is making noise to me. I mean, I bet there is a formula to position them absolutely instead of doing such increments, seems like it'll bug in the future and create gaps in the scrolling and such. About the clarification (and thanks for the useful link!) yes, indeed, in the case of terrain, I want to do the rendering -once- (when grid cells change position), that should be enough for my camera code to handle the scrolling :) | |
Mar 9, 2014 at 13:26 | comment | added | Anko | The illustrations are really helpful, but for some more clarification: You want to render all objects that are currently on screen (or some other view rectangle), but not redraw any of the off-screen ones, if possible. That's why your've got your world split into rooms, a lot like spatial hashing. Am I getting this right? | |
Mar 9, 2014 at 13:17 | comment | added | Anko | Hi and welcome to GameDev SE! Tip: You could post your own answer in the answers section, even if it's your own question. (It's totally OK on StackExchange, even encouraged, to add and accept your own answers.) | |
Mar 9, 2014 at 8:31 | history | edited | DARKGuy | CC BY-SA 3.0 |
I managed to do it, but is there any way to optimize or make it better?
|
Mar 9, 2014 at 3:06 | review | First posts | |||
Mar 9, 2014 at 13:18 | |||||
Mar 9, 2014 at 2:47 | history | asked | DARKGuy | CC BY-SA 3.0 |