简体   繁体   English

Stage2d 改变背景纹理会改变相机缩放! 漏洞?

[英]Stage2d changing background texture changes the camera zoom! BUG?

we are creating a small race game with a lot of fancy features, which deliever a small flavour of rpg depth.我们正在创建一个具有许多奇特功能的小型赛车游戏,它们提供了一种RPG深度的小味道。

I have an infinity scrolling background (the road), that consist of 3 textures, which are moving down and go back, so this infitity scrolling effekt is being created.我有一个无限滚动背景(道路),由 3 个纹理组成,它们向下移动并返回,因此正在创建此无限滚动效果。 3 textures are needed for the proper changing of the background, like new street background, fuel stations, car dealers and so on.背景的适当变化需要3种纹理,如新的街道背景、加油站、汽车经销商等。 So I check for example, that in 200 game-meters I must replace one texture by another to make a fuel station visible and scrolling down.所以我检查,例如,在 200 个游戏米中,我必须用另一种纹理替换一种纹理,以使加油站可见并向下滚动。

By the first replacement the camera of the stage suddenly zooms in. After going back in to the pause menu and then to the game world screen is everything fine.第一次更换舞台的相机突然放大。回到暂停菜单然后回到游戏世界屏幕后一切正常。 I am convinced that it has something with an updating of the camera in the render method or resize method.我确信它在渲染方法或调整大小方法中更新了相机。

The funny thing is that I do nothing, only take the texture object and set a new reference to the other texture.有趣的是我什么都不做,只取纹理对象并设置对另一个纹理的新引用。

It would be greate if somebody could give a tip or perhaps a solution to this problem.如果有人可以提供提示或解决此问题的方法,那就太好了。

Thank You for Your answer.谢谢您的回答。 It is solved now.现在已经解决了。 The reference to the cam was wrong.对凸轮的引用是错误的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM