Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / How to make a scrolling tile map?

Author
Message
LeGugusse
17
Years of Service
User Offline
Joined: 15th Feb 2007
Location: Paris - France
Posted: 21st Jan 2013 14:44
As the function copyImage is very slow and, anyway, doesn't work on android, I wonder how to realise a scrolling tilemap.

To map a dungeon map of 40x40 tiles (a minimum), i could theorically create a 1600 sprites and make a offset scroll over my map.
But I suppose that 1600 sprites are definitely too much for an android device...

So, do someone have an idea to realize that?
Thanks.

Cry "Havoc!" and let slip the dogs of war
LeGugusse
17
Years of Service
User Offline
Joined: 15th Feb 2007
Location: Paris - France
Posted: 21st Jan 2013 14:55
Mmm...
I've an Idea.

I create a 40x40 array of integer.
If the screen can display 10x10 tiles, I create 11x11 sprites corresponding to the displayed part of the map. (The part of the map which is under the "camera")
When I scroll over my map, example on the left, I destroy the sprites on the right which are not visible now and create new sprites to be seen on the left...
So I have always 11x11 sprites.

Mmm... That's a way to explore. I'm going to switch on my brain...

Cry "Havoc!" and let slip the dogs of war
MarcoBruti
13
Years of Service
User Offline
Joined: 20th Nov 2011
Location: Caput Mundi
Posted: 21st Jan 2013 15:05
good idea. Instead of destroying/recreating (that takes a lot of CPU time) the edge sprites (and the internal sprites, too), someone has suggested to replace the frames associated to the tiles. At present I have not yet developed a tile game in AppGameKit (only in other languages e.g. Visual Basic and DarkBasic Pro), but some people in this forum are very experienced.
LeGugusse
17
Years of Service
User Offline
Joined: 15th Feb 2007
Location: Paris - France
Posted: 21st Jan 2013 15:21
Quote: "someone has suggested to replace the frames associated to the tiles."


yes, it's a better idea and the principle stay the same!

Cry "Havoc!" and let slip the dogs of war

Login to post a reply

Server time is: 2024-11-24 05:50:51
Your offset time is: 2024-11-24 05:50:51