我将如何制作像pygame中的运动这样的相机? [英] How would I go about making a camera like movement in pygame?

查看:140
本文介绍了我将如何制作像pygame中的运动这样的相机?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的游戏是平台游戏。我希望玩家在距中心X像素的位置移动,向左或向右移动。

My game is a platform game. I want the player to move when it is X pixels away from the center, moving left or right.

我了解pygame没有任何可以使相机移动的东西

I understand pygame doesn't have anything that would make a camera move.

当玩家到达距离中心X像素的位置时,请停止玩家移动并让地形向相反方向移动以显示幻觉。

When the player has reached the point where it is X pixels away from the center, stop the player movement and have the terrain move in the opposite direction to display the illusion of a movable terrain, acting like camera motion.

推荐答案

可视化:

视差滚动: http://blog.shinylittlething.com /wp-content/uploads/2009/08/parallax.png (通常有多层,以不同的速度滚动以显示距离。)

Parallax scrolling: http://blog.shinylittlething.com/wp-content/uploads/2009/08/parallax.png (Usually has multiple layers, that scroll at different speeds, to show distance. )

2d tilemap滚动:
http://mikecann.co .uk / wp-content / uploads / 2011/11 / tm.png

2d tilemap scrolling: http://mikecann.co.uk/wp-content/uploads/2011/11/tm.png

绘图在纸上坐标/这些图像有助于可视化问题。

Drawing coordinates on paper / these images help visualize the problem.

这篇关于我将如何制作像pygame中的运动这样的相机?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆