I am creating a platform game in javascript using canvas
which is completely tile- is based. What is the best way to store blocks of objects in games (walls, floors, objects)? The thing is that every tile can be destroyed or made
Currently I have a 2D array so I can quickly check whether an item is on a specific X and AMP ; The problem with Y is that the problem occurs when the user moves and the map needs to be scrolled, I have to reassign every block. And what happens when the item is on x = 0
? I can not use negative index
I would rather have an apostolic scrolling analog for a tile at a time. Apart from this, I am planning to prepare maps as random moves by the user and if it is not already generated then once something is produced, then it should remain in this way forever.
I should mention one more thing that it will also be multiplayer, then it is a good idea to choose the screen until the cached data is dirty and it needs to get the latest from the database. I am very new to all this; It seems impossible, any help is appreciated.
Since you have infinite level i
everything stored in a large array Instead of doing so, and every time when user moves (ouch) rather than moving the stuff inside that array, 9 parts of the map (each one size about which the screen size is almost twice), when the user is current If you reach the edge of the part, then the fragmentation which is offscreen, leaving all the parts Purchaser, and loads of new people the difference.
Hope it was clear, but just in case, there is a picture here:
Comments
Post a Comment