开发者

Scrolling the 2d world with physics

I'm writing a side scrolling game with physics. Before get my hands dirty i started concentrating on physics and rendering graphics. Initially i thought of keeping every thing static (non scrolling). For physics after referring to many tutorial finally i ended up here http://www.tonypa.pri.ee/vectors/tut08.html. This set of tutorial covers most of the basic/advanced physics required for simple game. By following this tutorial i have created my 2d world with objects like triangle , box ,..... Each different objects vertices are saved as vectors for calculating the collision,bounce , ....... Response is pretty good if i apply force in x/y , is working perfect as long as each collidable objects are static. now im struggling in how to move all the vectors according to the direction (right/left) and at the same time updating the new change in vector for collision. i have some basic underst开发者_如何学Canding how this translation works in tile based environment. But for the non tile based world what is the best practice. Thanks in advance.


If you're going to move everything, the best way would be just to scroll the virtual camera.

I'm afraid I don't know anything about flash, but I would assume it has some functionality to manipulate the virtual camera, default transform matrix or something similar.

You shouldn't need to change anything else if you can manipulate the virtual camera or default transform matrix.


If you're using OpenGL...

I'm sating this from memory so you need to check exacts, but I think there is an GL method that stats the location and what you are looking at. That is all you have to do. You can specify it in world co-ords so the x,y co-ords of the respective objects dont change, just your veiw does.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜