开发者

How to show only part of map on screen

开发者 https://www.devze.com 2023-03-29 15:59 出处:网络
I\'m developer of game Space STG II for Andr开发者_StackOverflow社区oid phones... and I want to add to this game new option. To do this I need to know how to do movable screen. I want to do a battle l

I'm developer of game Space STG II for Andr开发者_StackOverflow社区oid phones... and I want to add to this game new option. To do this I need to know how to do movable screen. I want to do a battle like in Heroes Might & Magic, but in mobile phone screen is small... I don't know how developers show only a part on screen of all things on map. I want to make a small map in corner which show which part of map is shown on screen. I can't find it :/ I spend 2 days and I found only 2d tile moving, but I need smooth moves. Please help. I will give activation codes for Space STG II for help.


This question is rather vague, and so in return I can't reply with more than a vague answer. Adding this new feature to your game is very specific to how you wrote your game to begin with. If you used bad coding habits, it's going to be very difficult. From what I gather, you are trying to add a mini-map in the corner like many games have. If your model of the game and view are intertwined, you're going to have issues doing this. If you used a design pattern like Model-View-Controller http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller it would be easier to add another "view" of your model and implement it as the minimap. Sorry for the vague answer, but I don't have much else to work with seeing as you have a specific question with not many details of how your game is written.


If you're writing OpenGL code, its extremely easy- just draw the scene and move the camera to look at whatever location you want. Scrolling means moving the camera and will be smooth. Note that a tile approach works fine with OpenGL

If you're using some other 2D API, it might not be that simple. You could try to look up algorithms yourself for how people implement scrolling in widgets (think- how do people make a listview?). You'll come up with something.

Edit: If you do accept this answer, I don't really want your activation codes. Thanks anyway.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号